HBASE-19194 TestRSGroupsBase has some always false checks

This commit is contained in:
Andrew Purtell 2017-11-07 15:53:25 -08:00
parent dc1310f487
commit c5e60d16b4
2 changed files with 13 additions and 3 deletions

View File

@ -414,7 +414,7 @@ public abstract class TestRSGroupsBase {
getTableServerRegionMap().get(tableName);
final ServerName first = assignMap.entrySet().iterator().next().getKey();
for(HRegionInfo region: admin.getTableRegions(tableName)) {
if(!assignMap.get(first).contains(region)) {
if(!assignMap.get(first).contains(region.getRegionNameAsString())) {
admin.move(region.getEncodedNameAsBytes(), Bytes.toBytes(first.getServerName()));
}
}
@ -516,7 +516,11 @@ public abstract class TestRSGroupsBase {
});
//verify that targetServer didn't open it
assertFalse(ProtobufUtil.getOnlineRegions(targetRS).contains(targetRegion));
for (HRegionInfo region: ProtobufUtil.getOnlineRegions(targetRS)) {
if (targetRegion.equals(region.getRegionNameAsString())) {
fail("Target server opened region");
}
}
}
@Test

View File

@ -181,6 +181,7 @@ import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.ServletHolder;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.protobuf.Descriptors;
import com.google.protobuf.Service;
@ -1666,7 +1667,12 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
return;
}
} else {
dest = ServerName.valueOf(Bytes.toString(destServerName));
ServerName candidate = ServerName.valueOf(Bytes.toString(destServerName));
dest = balancer.randomAssignment(hri, Lists.newArrayList(candidate));
if (dest == null) {
LOG.debug("Unable to determine a plan to assign " + hri);
return;
}
if (dest.equals(serverName) && balancer instanceof BaseLoadBalancer
&& !((BaseLoadBalancer)balancer).shouldBeOnMaster(hri)) {
// To avoid unnecessary region moving later by balancer. Don't put user