HBASE-17658 Fix bookkeeping error with max regions for a table
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
b141603e2e
commit
6b96b0ce85
|
@ -661,7 +661,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
|
||||||
|
|
||||||
//check whether this caused maxRegionsPerTable in the new Server to be updated
|
//check whether this caused maxRegionsPerTable in the new Server to be updated
|
||||||
if (numRegionsPerServerPerTable[newServer][tableIndex] > numMaxRegionsPerTable[tableIndex]) {
|
if (numRegionsPerServerPerTable[newServer][tableIndex] > numMaxRegionsPerTable[tableIndex]) {
|
||||||
numRegionsPerServerPerTable[newServer][tableIndex] = numMaxRegionsPerTable[tableIndex];
|
numMaxRegionsPerTable[tableIndex] = numRegionsPerServerPerTable[newServer][tableIndex];
|
||||||
} else if (oldServer >= 0 && (numRegionsPerServerPerTable[oldServer][tableIndex] + 1)
|
} else if (oldServer >= 0 && (numRegionsPerServerPerTable[oldServer][tableIndex] + 1)
|
||||||
== numMaxRegionsPerTable[tableIndex]) {
|
== numMaxRegionsPerTable[tableIndex]) {
|
||||||
//recompute maxRegionsPerTable since the previous value was coming from the old server
|
//recompute maxRegionsPerTable since the previous value was coming from the old server
|
||||||
|
|
|
@ -326,6 +326,8 @@ public class TestBaseLoadBalancer extends BalancerTestBase {
|
||||||
|
|
||||||
// now move region1 from servers[0] to servers[2]
|
// now move region1 from servers[0] to servers[2]
|
||||||
cluster.doAction(new MoveRegionAction(0, 0, 2));
|
cluster.doAction(new MoveRegionAction(0, 0, 2));
|
||||||
|
// check that the numMaxRegionsPerTable for "table" has increased to 2
|
||||||
|
assertEquals(2, cluster.numMaxRegionsPerTable[0]);
|
||||||
// now repeat check whether moving region1 from servers[1] to servers[2]
|
// now repeat check whether moving region1 from servers[1] to servers[2]
|
||||||
// would lower availability
|
// would lower availability
|
||||||
assertTrue(cluster.wouldLowerAvailability(hri1, servers[2]));
|
assertTrue(cluster.wouldLowerAvailability(hri1, servers[2]));
|
||||||
|
|
Loading…
Reference in New Issue