Skip to content

Commit

Permalink
Allow user to set cost balancer threads more than or equal to the num…
Browse files Browse the repository at this point in the history
…ber of cores. (apache#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
  • Loading branch information
nishantmonu51 authored and himanshug committed May 13, 2016
1 parent d3e9c47 commit a9b721a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ public 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void testSerde() throws Exception
+ " \"maxSegmentsToMove\": 1,\n"
+ " \"replicantLifetime\": 1,\n"
+ " \"replicationThrottleLimit\": 1,\n"
+ " \"balancerComputeThreads\": 2, \n"
+ " \"emitBalancingStats\": true,\n"
+ " \"killDataSourceWhitelist\": [\"test\"]\n"
+ "}\n";
Expand All @@ -56,7 +57,7 @@ public void testSerde() throws Exception
);

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
);
}
Expand Down

0 comments on commit a9b721a

Please sign in to comment.