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


##########
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);
+      }
+      Thread.sleep(1000);
+    }
+    throw new IOException("Region " + region + " failed to close within" + " 
timeout " + timeout);

Review Comment:
   Missing space in error message: 'within' + ' timeout' should be 'within ' + 
'timeout' or 'within timeout'.
   ```suggestion
       throw new IOException("Region " + region + " failed to close within 
timeout " + timeout);
   ```



-- 
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