-
Notifications
You must be signed in to change notification settings - Fork 7
HBASE-29072 StochasticLoadBalancer#areReplicasColocated ignores rack colocation
#135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…Map, rather than ordinal based indexing
| assertFalse(loadBalancer.needsBalance(HConstants.ENSEMBLE_TABLE_NAME, | ||
| new BalancerClusterState(map, null, null, new ForTestRackManagerOne()))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just naively swapped to assertFalse in HBASE-26327 when we began ignoring rack colocation. The intention was originally for this case to be true
| BalancerClusterState cluster = new BalancerClusterState(map, null, null, null); | ||
| loadBalancer.initCosts(cluster); | ||
| assertTrue(loadBalancer.needsBalance(HConstants.ENSEMBLE_TABLE_NAME, cluster)); | ||
| } | ||
|
|
||
| @Test | ||
| public void testNeedsBalanceForColocatedReplicasOnRack() { | ||
| // check for the case where there are two hosts and with one rack, and where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really two distinct tests that were previously in one method, so I've split it up.
e2104a5 to
c9d2bbb
Compare
| @Test | ||
| public void testNoNeededBalanceForColocatedReplicasTooFewRacks() { | ||
| // Three hosts, two racks, and three replicas for a region. This cannot be balanced | ||
| List<RegionInfo> regions = randomRegions(1); | ||
| ServerName s1 = ServerName.valueOf("host1", 1000, 11111); | ||
| ServerName s2 = ServerName.valueOf("host11", 1000, 11111); | ||
| ServerName s3 = ServerName.valueOf("host2", 1000, 11111); | ||
| Map<ServerName, List<RegionInfo>> map = new HashMap<>(); | ||
| List<RegionInfo> regionsOnS2 = new ArrayList<>(1); | ||
| regionsOnS2.add(RegionReplicaUtil.getRegionInfoForReplica(regions.get(0), 1)); | ||
| map.put(s1, regions); | ||
| map.put(s2, regionsOnS2); | ||
| // there are 3 replicas for region 0, but only add a second rack | ||
| map.put(s3, ImmutableList.of(RegionReplicaUtil.getRegionInfoForReplica(regions.get(0), 2))); | ||
| BalancerClusterState cluster = new BalancerClusterState(map, null, null, null); | ||
| loadBalancer.initCosts(cluster); | ||
| // Should be false because there aren't enough racks | ||
| assertFalse(loadBalancer.needsBalance(HConstants.ENSEMBLE_TABLE_NAME, cluster)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new test validates our smarter way of deprioritizing rack balancing for topologies with too few racks.
c9d2bbb to
f552bb9
Compare
f552bb9 to
6e71102
Compare
61bd05a to
b8ab794
Compare
I'll rebase this PR to master when HBASE-29071 has shipped. This is yet another bite of apache#6593