Allow user to set cost balancer threads more than or equal to the number of cores. (#2964)

* Allow user to set cost balancer threads more than the number of cores.

Allow user to set cost balancer threads more than the number of cores.

* modify test
This commit is contained in:
Nishant 2016-05-13 23:57:42 +05:30 committed by Himanshu
parent d3e9c47a5f
commit a9b721a01b
2 changed files with 3 additions and 5 deletions

View File

@ -57,10 +57,7 @@ public class CoordinatorDynamicConfig
this.replicantLifetime = replicantLifetime;
this.replicationThrottleLimit = replicationThrottleLimit;
this.emitBalancingStats = emitBalancingStats;
this.balancerComputeThreads = Math.min(
Math.max(balancerComputeThreads, 1),
Math.max(Runtime.getRuntime().availableProcessors() - 1, 1)
);
this.balancerComputeThreads = Math.max(balancerComputeThreads, 1);
this.killDataSourceWhitelist = killDataSourceWhitelist;
}

View File

@ -40,6 +40,7 @@ public class CoordinatorDynamicConfigTest
+ " \"maxSegmentsToMove\": 1,\n"
+ " \"replicantLifetime\": 1,\n"
+ " \"replicationThrottleLimit\": 1,\n"
+ " \"balancerComputeThreads\": 2, \n"
+ " \"emitBalancingStats\": true,\n"
+ " \"killDataSourceWhitelist\": [\"test\"]\n"
+ "}\n";
@ -56,7 +57,7 @@ public class CoordinatorDynamicConfigTest
);
Assert.assertEquals(
new CoordinatorDynamicConfig(1, 1, 1, 1, 1, 1, 1, true, ImmutableSet.of("test")),
new CoordinatorDynamicConfig(1, 1, 1, 1, 1, 1, 2, true, ImmutableSet.of("test")),
actual
);
}