petersomogyi commented on code in PR #155:
URL: 
https://github.com/apache/hbase-operator-tools/pull/155#discussion_r2465345755


##########
hbase-hbck2/src/main/java/org/apache/hbase/hbck1/HBaseFsckRepair.java:
##########
@@ -139,8 +140,33 @@ public static void waitUntilAssigned(Admin admin, 
RegionInfo region)
   public static void closeRegionSilentlyAndWait(Connection connection, 
ServerName server,
     RegionInfo region) throws IOException, InterruptedException {
     long timeout = 
connection.getConfiguration().getLong("hbase.hbck.close.timeout", 120000);
-    ServerManager.closeRegionSilentlyAndWait((ClusterConnection) connection, 
server, region,
-      timeout);
+    HBCKRegionServerAdmin admin = new HBCKRegionServerAdmin(connection, 
server);
+    admin.closeRegion(region.getRegionName());
+    if (timeout < 0) {
+      return;
+    }
+    long expiration = timeout + System.currentTimeMillis();
+    while (System.currentTimeMillis() < expiration) {
+      try {
+        RegionInfo rsRegion = admin.getRegionInfo(region.getRegionName());
+        if (rsRegion == null) {
+          return;
+        }
+      } catch (IOException ioe) {
+        if (
+          ioe instanceof NotServingRegionException
+            || (ioe instanceof RemoteWithExtrasException && 
((RemoteWithExtrasException) ioe)
+              .unwrapRemoteException() instanceof NotServingRegionException)

Review Comment:
   nit: formatting is a bit off here.



##########
hbase-hbck2/src/main/java/org/apache/hbase/hbck1/HBaseFsckRepair.java:
##########
@@ -139,8 +140,33 @@ public static void waitUntilAssigned(Admin admin, 
RegionInfo region)
   public static void closeRegionSilentlyAndWait(Connection connection, 
ServerName server,
     RegionInfo region) throws IOException, InterruptedException {
     long timeout = 
connection.getConfiguration().getLong("hbase.hbck.close.timeout", 120000);
-    ServerManager.closeRegionSilentlyAndWait((ClusterConnection) connection, 
server, region,
-      timeout);
+    HBCKRegionServerAdmin admin = new HBCKRegionServerAdmin(connection, 
server);
+    admin.closeRegion(region.getRegionName());
+    if (timeout < 0) {
+      return;
+    }
+    long expiration = timeout + System.currentTimeMillis();
+    while (System.currentTimeMillis() < expiration) {
+      try {
+        RegionInfo rsRegion = admin.getRegionInfo(region.getRegionName());
+        if (rsRegion == null) {
+          return;
+        }
+      } catch (IOException ioe) {
+        if (
+          ioe instanceof NotServingRegionException
+            || (ioe instanceof RemoteWithExtrasException && 
((RemoteWithExtrasException) ioe)
+              .unwrapRemoteException() instanceof NotServingRegionException)
+        ) {
+          // no need to retry again
+          return;
+        }
+        LOG.warn("Exception when retrieving regioninfo from: " + 
region.getRegionNameAsString(),
+          ioe);

Review Comment:
   ```suggestion
           LOG.warn("Exception when retrieving regioninfo from: {}", 
region.getRegionNameAsString(),
             ioe);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to