wchevreuil 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_r299919359
##########
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:
Maybe we could simplify this test by moving this logic to the inner
_Waiter.Predicate.evaluate_ method from line #529? Related _evaluate_ method is
already called every 100 millis, so we could get rid of the extra thread, its
_while_ loop and extra atomic boolean variable, whilst all relevant validations
would be concentrated at the end of the method. What do you think @sunhelly? We
can leave this as it is if you think it would be more complicated.
----------------------------------------------------------------
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