sunhelly commented on a change in pull request #323: HBASE-22414 Interruption 
of moving regions in RSGroup will cause regi…
URL: https://github.com/apache/hbase/pull/323#discussion_r302401190
 
 

 ##########
 File path: 
hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java
 ##########
 @@ -459,4 +464,250 @@ public boolean evaluate() throws Exception {
     Assert.assertEquals(null, rsGroupAdmin.getRSGroupInfo(fooGroup.getName()));
   }
 
+  @Test
+  public void testFailedMoveBeforeRetryExhaustedWhenMoveServer() throws 
Exception {
+    String groupName = getGroupName(name.getMethodName());
+    rsGroupAdmin.addRSGroup(groupName);
+    final RSGroupInfo newGroup = rsGroupAdmin.getRSGroupInfo(groupName);
+    final byte[] familyNameBytes = Bytes.toBytes("f");
+    final int tableRegionCount = 10;
+    // All the regions created below will be assigned to the default group.
+    TEST_UTIL.createMultiRegionTable(tableName, familyNameBytes, 
tableRegionCount);
+    TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        List<String> regions = getTableRegionMap().get(tableName);
+        if (regions == null) {
+          return false;
+        }
+        return getTableRegionMap().get(tableName).size() >= tableRegionCount;
+      }
+    });
+
+    Pair<ServerName, RegionStateNode> gotPair = setARegionState(newGroup);
+
+    // start thread to recover region state
+    final ServerName movedServer = gotPair.getFirst();
+    final RegionStateNode rsn = gotPair.getSecond();
+    AtomicBoolean changed = new AtomicBoolean(false);
+    Thread t1 = new Thread(() -> {
 
 Review comment:
   Here the added thread will be concurrently with the UT running thread. I 
designed this to help make the actions of recovering region state and moving 
regions concurrently. As a result, during one call of move and after some 
failed retries, the chosen region will be moved successfully, like the real 
production situation.  Waiter.Predicate.evaluate will make the UT wait on its 
evaluate method, if move operations of RSGroup is Async, it may be helpful. 

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