HDDS-15024. Track pending containers in SCM to prevent Datanode over-allocation#10073
Merged
rakeshadr merged 8 commits intoapache:masterfrom Apr 17, 2026
Merged
HDDS-15024. Track pending containers in SCM to prevent Datanode over-allocation#10073rakeshadr merged 8 commits intoapache:masterfrom
rakeshadr merged 8 commits intoapache:masterfrom
Conversation
…iner over-allocation per DataNode.
szetszwo
reviewed
Apr 13, 2026
Contributor
There was a problem hiding this comment.
@ashishkumar50 , thanks a lot for splitting the PR
- For simplicity, let's don't remove buckets. The number of datanodes is small (~10k). We just keep all of them in the map.
- Then, the map becomes very simple. Let's create a class.
- Always roll before return.
class DatanodeBuckets {
private final ConcurrentHashMap<DatanodeID, TwoWindowBucket> map = new ConcurrentHashMap<>();
TwoWindowBucket get(DatanodeID id) {
final TwoWindowBucket bucket = map.compute(id, (k, b) -> b != null ? b : new TwoWindowBucket(rollIntervalMs));
bucket.rollIfNeeded();
return bucket;
}
TwoWindowBucket get(DatanodeDetails dn) {
return map.get(dn.getID());
}
}| long usableSpace = VolumeUsage.getUsableSpace(report); | ||
| long containersOnThisDisk = usableSpace / containerSize; | ||
| effectiveAllocatableSpace += containersOnThisDisk * containerSize; | ||
| if (effectiveAllocatableSpace - pendingAllocationBytes >= containerSize) { |
Contributor
There was a problem hiding this comment.
Just use:
if (usableSpace - pendingBytes >= containerSize) {
Contributor
Author
|
@szetszwo thanks for the review, handled the comments. |
szetszwo
reviewed
Apr 14, 2026
Contributor
There was a problem hiding this comment.
@ashishkumar50 , thanks for the update! The change looks mostly good.
- All the synchronized (bucket) should be removed.
- Are there legitimate cases to pass null to the methods and ignore it? If yes, please add a comment describing the cases. Otherwise, please replace the null check with
Objects.requireNonNull(..).
We usually useObjects.requireNonNull(..)to detect bugs. If we ignore and return, it hides the bug and may lead to more serious problem such as data loss.
szetszwo
approved these changes
Apr 14, 2026
Contributor
szetszwo
left a comment
There was a problem hiding this comment.
@ashishkumar50 , thanks for the quick update!
+1 the change looks good.
rakeshadr
reviewed
Apr 15, 2026
rakeshadr
approved these changes
Apr 15, 2026
Contributor
rakeshadr
left a comment
There was a problem hiding this comment.
Thanks @ashishkumar50 for the continuous efforts. Added two log improvements, please take care.
+1 LGTM
rakeshadr
approved these changes
Apr 16, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
Introduce PendingContainerTracker in SCM to track container allocations that are issued but not yet fully realized on DataNodes.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15024
How was this patch tested?
Unit test