Repository navigation
HDDS-16182. Extend container balancer start command with auto-config #11906
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
Open
sreejasahithi
wants to merge
3
commits into
apache:master
Choose a base branch
from
sreejasahithi:HDDS-16182
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
33004ca
HDDS-16182. Extend container balancer start command with auto-config
sreejasahithi e37fe0b
Merge remote-tracking branch 'origin/master' into HDDS-16182
adoroszlai 584b94e
Normalized container balancer recommendation sizes to GB and timeouts…
sreejasahithi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,19 +162,33 @@ private static ContainerBalancerRecommendation recommendForProfile( | |
| .setThresholdPercent(thresholdPercent); | ||
|
|
||
| try { | ||
| long moveReplicationTimeoutMillis = balancerConfig.getMoveReplicationTimeout().toMillis(); | ||
| long moveTimeoutMillis = balancerConfig.getMoveTimeout().toMillis(); | ||
| long balancingIntervalMillis = balancerConfig.getBalancingInterval().toMillis(); | ||
| long moveReplicationTimeoutMillis = request.moveReplicationTimeoutMillis != null | ||
| ? request.moveReplicationTimeoutMillis | ||
| : balancerConfig.getMoveReplicationTimeout().toMillis(); | ||
| long moveTimeoutMillis = request.moveTimeoutMillis != null | ||
| ? request.moveTimeoutMillis | ||
| : balancerConfig.getMoveTimeout().toMillis(); | ||
| long balancingIntervalMillis = request.balancingIntervalMillis != null | ||
| ? request.balancingIntervalMillis | ||
| : balancerConfig.getBalancingInterval().toMillis(); | ||
| validateMoveTimeouts(conf, moveReplicationTimeoutMillis, moveTimeoutMillis); | ||
| validateBalancingIntervalMillis(balancingIntervalMillis); | ||
|
|
||
| long configCeiling = balancerConfig.getMaxSizeToMovePerIteration(); | ||
| boolean userProvidedMaxSizeToMove = request.maxSizeToMovePerIteration != null; | ||
| long configCeiling = userProvidedMaxSizeToMove | ||
| ? request.maxSizeToMovePerIteration | ||
| : balancerConfig.getMaxSizeToMovePerIteration(); | ||
| ContainerBalancerEstimation initialEstimation = estimateForProfile( | ||
| conf, request, profile, snapshot, balancerConfig, thresholdPercent, null); | ||
| if (!initialEstimation.succeeded()) { | ||
| throw new IllegalArgumentException(initialEstimation.getFailureMessage()); | ||
| } | ||
| long recommendedMaxMove = computeRecommendedMaxSizeToMove(configCeiling, initialEstimation); | ||
| long recommendedMaxMove = userProvidedMaxSizeToMove | ||
| ? request.maxSizeToMovePerIteration | ||
| : computeRecommendedMaxSizeToMove(configCeiling, initialEstimation); | ||
| // Normalize to whole GB, the unit accepted by the start command. | ||
| long maxSizeToMoveGb = recommendedMaxMove / OzoneConsts.GB; | ||
| recommendedMaxMove = maxSizeToMoveGb * OzoneConsts.GB; | ||
|
|
||
| // Estimate with the recommended max-size-to-move so it matches the suggested command. | ||
| ContainerBalancerEstimation estimation = estimateForProfile( | ||
|
|
@@ -186,23 +200,32 @@ private static ContainerBalancerRecommendation recommendForProfile( | |
| int recommendedIterations = (int) Math.ceil( | ||
| estimation.getEstimatedIterations() * PLANNING_ITERATION_BUFFER); | ||
|
|
||
| // Normalize the remaining values to the units accepted by the start command. | ||
| long maxSizeEnteringTargetGb = estimation.getMaxSizeEnteringTarget() / OzoneConsts.GB; | ||
| long maxSizeLeavingSourceGb = estimation.getMaxSizeLeavingSource() / OzoneConsts.GB; | ||
| long moveTimeoutMinutes = Duration.ofMillis(moveTimeoutMillis).toMinutes(); | ||
| long moveReplicationTimeoutMinutes = Duration.ofMillis(moveReplicationTimeoutMillis).toMinutes(); | ||
| long balancingIntervalMinutes = Duration.ofMillis(balancingIntervalMillis).toMinutes(); | ||
|
|
||
| Map<String, String> rationale = buildRationale( | ||
| request.thresholdPercent != null, | ||
| profile, | ||
| balancerConfig, | ||
| estimation, | ||
| moveTimeoutMillis, | ||
| moveReplicationTimeoutMillis, | ||
| balancingIntervalMillis); | ||
| maxSizeEnteringTargetGb, | ||
| maxSizeLeavingSourceGb, | ||
| moveTimeoutMinutes, | ||
| moveReplicationTimeoutMinutes, | ||
| balancingIntervalMinutes); | ||
|
|
||
| return builder | ||
| .setMaxDatanodesPercentage(estimation.getMaxDatanodesPercentage()) | ||
| .setMaxSizeToMovePerIteration(recommendedMaxMove) | ||
| .setMaxSizeEnteringTarget(estimation.getMaxSizeEnteringTarget()) | ||
| .setMaxSizeLeavingSource(estimation.getMaxSizeLeavingSource()) | ||
| .setMoveTimeoutMillis(moveTimeoutMillis) | ||
| .setMoveReplicationTimeoutMillis(moveReplicationTimeoutMillis) | ||
| .setBalancingIntervalMillis(balancingIntervalMillis) | ||
| .setMaxSizeToMovePerIterationInGB(maxSizeToMoveGb) | ||
| .setMaxSizeEnteringTargetInGB(maxSizeEnteringTargetGb) | ||
| .setMaxSizeLeavingSourceInGB(maxSizeLeavingSourceGb) | ||
| .setMoveTimeoutMinutes(moveTimeoutMinutes) | ||
| .setMoveReplicationTimeoutMinutes(moveReplicationTimeoutMinutes) | ||
| .setBalancingIntervalMinutes(balancingIntervalMinutes) | ||
| .setRecommendedIterations(recommendedIterations) | ||
| .setRationale(rationale) | ||
| .setEstimation(estimation) | ||
|
|
@@ -230,9 +253,11 @@ private static Map<String, String> buildRationale( | |
| ContainerBalancerProfile profile, | ||
| ContainerBalancerConfiguration balancerConfig, | ||
| ContainerBalancerEstimation estimation, | ||
| long moveTimeoutMillis, | ||
| long moveReplicationTimeoutMillis, | ||
| long balancingIntervalMillis) { | ||
| long maxSizeEnteringTargetGb, | ||
| long maxSizeLeavingSourceGb, | ||
| long moveTimeoutMinutes, | ||
| long moveReplicationTimeoutMinutes, | ||
| long balancingIntervalMinutes) { | ||
| Map<String, String> rationale = new HashMap<>(); | ||
| rationale.put("threshold", userProvidedThreshold | ||
| ? "user override" | ||
|
|
@@ -253,15 +278,15 @@ private static Map<String, String> buildRationale( | |
| byteDesc(estimation.getMaxSizeEnteringTarget()), | ||
| byteDesc(estimation.getMaxSizeLeavingSource()))); | ||
| rationale.put("maxSizeEnteringTarget", String.format( | ||
| "profile default (%d GB)", estimation.getMaxSizeEnteringTarget() / OzoneConsts.GB)); | ||
| "profile default (%d GB)", maxSizeEnteringTargetGb)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The recommendation calculation supports user-provided overrides, but the rationale still reports configuration/profile defaults? |
||
| rationale.put("maxSizeLeavingSource", String.format( | ||
| "profile default (%d GB)", estimation.getMaxSizeLeavingSource() / OzoneConsts.GB)); | ||
| "profile default (%d GB)", maxSizeLeavingSourceGb)); | ||
| rationale.put("moveTimeout", String.format( | ||
| "configuration default (%d min)", moveTimeoutMillis / 60000)); | ||
| "configuration default (%d min)", moveTimeoutMinutes)); | ||
| rationale.put("moveReplicationTimeout", String.format( | ||
| "configuration default (%d min)", moveReplicationTimeoutMillis / 60000)); | ||
| "configuration default (%d min)", moveReplicationTimeoutMinutes)); | ||
| rationale.put("balancingInterval", String.format( | ||
| "configuration default (%d min)", balancingIntervalMillis / 60000)); | ||
| "configuration default (%d min)", balancingIntervalMinutes)); | ||
| long planningIterations = (long) Math.ceil( | ||
| estimation.getEstimatedIterations() * PLANNING_ITERATION_BUFFER); | ||
| rationale.put("iterations", String.format( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Ensure the normalized values always satisfy: