Fix bug in computed value of balancerComputeThreads (#14947)

In smartSegmentLoading mode, use computed value of balancerComputeThreads
rather than configured value.
This commit is contained in:
Kashif Faraz 2023-09-07 01:14:05 +05:30 committed by GitHub
parent a8fa979115
commit 88f3c9baed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -94,7 +94,7 @@ public class PrepareBalancerAndLoadQueues implements CoordinatorDuty
collectHistoricalStats(cluster, stats);
collectUsedSegmentStats(params, stats);
int numBalancerThreads = params.getCoordinatorDynamicConfig().getBalancerComputeThreads();
final int numBalancerThreads = segmentLoadingConfig.getBalancerComputeThreads();
final BalancerStrategy balancerStrategy = balancerStrategyFactory.createBalancerStrategy(numBalancerThreads);
log.info(
"Using balancer strategy [%s] with [%d] threads.",

View File

@ -49,9 +49,11 @@ public class SegmentLoadingConfig
// Compute replicationThrottleLimit with a lower bound of 100
final int throttlePercentage = 5;
final int replicationThrottleLimit = Math.max(100, numUsedSegments * throttlePercentage / 100);
final int numBalancerThreads = CoordinatorDynamicConfig.getDefaultBalancerComputeThreads();
log.info(
"Smart segment loading is enabled. Calculated replicationThrottleLimit[%,d] (%d%% of used segments[%,d]).",
replicationThrottleLimit, throttlePercentage, numUsedSegments
"Smart segment loading is enabled. Calculated replicationThrottleLimit[%,d]"
+ " (%d%% of used segments[%,d]) and numBalancerThreads[%d].",
replicationThrottleLimit, throttlePercentage, numUsedSegments, numBalancerThreads
);
return new SegmentLoadingConfig(
@ -59,7 +61,7 @@ public class SegmentLoadingConfig
replicationThrottleLimit,
60,
true,
CoordinatorDynamicConfig.getDefaultBalancerComputeThreads()
numBalancerThreads
);
} else {
// Use the configured values