Apache9 commented on a change in pull request #135: HBASE-22198 Fix flakey 
TestAsyncTableGetMultiThreaded
URL: https://github.com/apache/hbase/pull/135#discussion_r273953551
 
 

 ##########
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableGetMultiThreaded.java
 ##########
 @@ -155,12 +159,23 @@ public String explainFailure() throws Exception {
 
       for (HRegion region : 
TEST_UTIL.getHBaseCluster().getRegions(TABLE_NAME)) {
         region.compact(true);
-
-        //Waiting for compaction to complete and references are cleaned up
+      }
+      for (HRegion region : 
TEST_UTIL.getHBaseCluster().getRegions(TABLE_NAME)) {
+        // Waiting for compaction to complete and references are cleaned up
         RetryCounter retrier = new RetryCounter(30, 1, TimeUnit.SECONDS);
-        while (CompactionState.NONE != admin
-            
.getCompactionStateForRegion(region.getRegionInfo().getRegionName())
-            && retrier.shouldRetry()) {
+        for (;;) {
+          try {
+            if (admin.getCompactionStateForRegion(
+              region.getRegionInfo().getRegionName()) == CompactionState.NONE) 
{
+              break;
+            }
+          } catch (IOException e) {
+            LOG.warn("Failed to query");
 
 Review comment:
   The UT aims to test whether we can deal with region moving/splitting, so it 
is possible that the region is not online at some point, but the admin method 
will not fail immediately without retrying, which is not like what we do in 
normal get/put operation, so here we need to catch the exception and use an 
external RetryCounter to retry. Otherwise it will cause the test to fail.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to