HDDS-16045. Make PendingContainerTracker StorageType aware - #10928
HDDS-16045. Make PendingContainerTracker StorageType aware#10928F64116045 wants to merge 639 commits into
Conversation
…NodeLimit#testMetrics (apache#10659)
…guredIncludeContainers (apache#10660)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rationResultException (apache#10667)
…out retry or failover. (apache#10479)
…ng limit selector (apache#10677).
…+ AGENTS.md) (apache#10483) Co-authored-by: Siyao Meng <50227127+smengcl@users.noreply.github.com>
…he#10584) Co-authored-by: Doroszlai, Attila <adoroszlai@apache.org>
Generated-by: Codex (GPT-5.3-Codex, GPT-5.4), Claude Code (Opus 4.8)
…ith the checkpoint index (apache#10943) Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
xichen01
left a comment
There was a problem hiding this comment.
@F64116045 Thanks for you patch, left some comments
| /** | ||
| * Add container to current window. | ||
| */ | ||
| synchronized boolean add(ContainerID containerID) { |
There was a problem hiding this comment.
this old method can be removed.
There was a problem hiding this comment.
Removed the untyped add(...) method. Thanks.
| } | ||
|
|
||
| @Override | ||
| public void recordPendingAllocationForDatanode(DatanodeID datanodeID, ContainerID containerID) { |
There was a problem hiding this comment.
This can be removed too, make that recordPendingAllocationForDatanode must pass a storageType
There was a problem hiding this comment.
Removed the untyped recordPendingAllocationForDatanode(...); callers now pass StorageType. Thanks.
| @@ -189,6 +190,14 @@ default int getAllNodeCount() { | |||
| */ | |||
| boolean hasSpaceForNewContainerAllocation(DatanodeID datanodeID); | |||
There was a problem hiding this comment.
To prevent callers from forgetting to pass the storageType parameter, we should retain only the hasSpaceForNewContainerAllocation method that includes storageType.
There was a problem hiding this comment.
Removed the untyped space-check API so callers need to pass StorageType.
| } | ||
|
|
||
| containerStateManager.addContainer(containerInfoBuilder.build()); | ||
| pipelineManager.recordPendingAllocation(pipeline, containerID); |
There was a problem hiding this comment.
allocateContainer can be executed in parallel;
pipelineManager.hasEnoughSpace and pipelineManager.recordPendingAllocation are not protected by locks. In some cases, a DN may be allocated too many containers.
There was a problem hiding this comment.
Addressed by adapting the atomic checkSpaceAndRecordAllocation(...) flow after updating from the latest HDDS-11233 branch. Thanks.
|
Added HDDS-16116 for rebasing HDDS-11233 feature branch with master. Keep hold till rebase finished. |
|
@F64116045 I updated the shared feature branch HDDS-11233 on apache/ozone master to bring it up to date with master. The branch now = the original feature commits (unchanged SHAs) with a single Merge 'upstream/master' commit on top. New tip: 8decb32. Kindly do merge of this feature branch to your PR branch and resolve the conflicts. |
…nding-container-storage-type # Conflicts: # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeManager.java # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/PendingContainerTracker.java # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineManagerImpl.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestPendingContainerTracker.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/MockPipelineManager.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelineManagerImpl.java
|
@devmadhuu Thanks for helping with the feature branch update. I noticed HDDS-11233 is now back at ed07a4b, while this PR already merged 8decb32, so the diff became very large. Should I wait for HDDS-11233 to be updated again, or rework this PR on the current base? |
Apologies for this confusion. Yes I rebased and force pushed the HDDS-11233 , but we need to follow the merge process instead of rebase for feature branches and raise PRs and follow the normal PR process. So I reverted the earlier forced push and now raised this PR #10983 |
@F64116045 #10983 is merged. |
…nding-container-storage-type # Conflicts: # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMCommonPlacementPolicy.java # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/invoker/ContainerStateManagerInvoker.java # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeManager.java # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/PendingContainerTracker.java # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/ECPipelineProvider.java # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineManagerImpl.java # hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SimplePipelineProvider.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestSCMCommonPlacementPolicy.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/SimpleMockNodeManager.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/TestContainerPlacementFactory.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/TestSCMContainerPlacementCapacity.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/TestSCMContainerPlacementRackAware.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/TestSCMContainerPlacementRackScatter.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/TestSCMContainerPlacementRandom.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestPendingContainerTracker.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/MockPipelineManager.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelineManagerImpl.java # hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelinePlacementFactory.java
|
Following the discussion in apache/ozone#10983, I also moved the data-space check from Previously, Now |
|
Thanks everyone for the guidance. Since the diff became larger after syncing the feature branch and addressing the review comments, I wanted to summarize the current patch to make review easier. The main changes are:
Most of the remaining test changes are mechanical updates for the new method signatures. The main behavioral tests are in:
I ran the targeted SCM tests locally and will keep an eye on CI, thanks. |
devmadhuu
left a comment
There was a problem hiding this comment.
Thanks @F64116045 for addressing the review comments and rebase with latest upstream feature branch.. Just few nits. Please check.
@ashishkumar50 request you also to kindly re-review after merge master with latest upstream feature branch.
| DatanodeInfo dnInfo = getNode(op.getTarget().getID()); | ||
| if (dnInfo != null) { | ||
| recordAllocationForDatanode(dnInfo, containerID); | ||
| recordAllocationForDatanode(dnInfo, containerID, StorageType.DEFAULT); |
There was a problem hiding this comment.
This sending StorageType.DEFAULT may not be correct as every incoming req from RM / balancer will account for space under DISK tier. Can we pass the real tier based on containerInfo from the caller of this: org.apache.hadoop.hdds.scm.container.replication.ReplicationManager#adjustPendingOpsAndMetrics
There was a problem hiding this comment.
Thanks for catching. I missed that path. Fixed.
It now carries the type from containerInfo instead of defaulting in opAdded. Added a small SSD test too.
| if (storageTier == null || storageTier == StorageTier.EMPTY) { | ||
| return null; | ||
| } | ||
| return storageTier.getUniformStorageType(); |
There was a problem hiding this comment.
Though once pipeline gets created with a specific tier at pipeline creation time, but here using primary storage type only and no fallback for space pending allocation is okay ? for SSD tier, this returns ONLY "SSD" Just a doubt.. @ivandika3 @xichen01
There was a problem hiding this comment.
Thanks for raising this.
The existing pipeline selection path also maps the tier through storageTier.getUniformStorageType() in RatisPipelineProvider and PipelineProvider and there is no fallback, so I think it is acceptable here?
(If fallback should be handled differently, I’m happy to update it, thanks.)
ashishkumar50
left a comment
There was a problem hiding this comment.
@F64116045 Thanks for the update, please find comments inline:
| // Always slot-based (maxContainerSize unit). | ||
| if (!nodeManager.hasAvailableSpace(datanodeInfo)) { | ||
| if (!nodeManager.hasAvailableSpace( | ||
| datanodeInfo, dataSizeRequired, storageType)) { |
There was a problem hiding this comment.
dataSizeRequired is not required.
| private Set<ContainerID> currentWindow = new HashSet<>(); | ||
| private Set<ContainerID> previousWindow = new HashSet<>(); | ||
| private Map<ContainerID, StorageType> currentWindow = new HashMap<>(); | ||
| private Map<ContainerID, StorageType> previousWindow = new HashMap<>(); |
There was a problem hiding this comment.
Instead of doing like this, storing each container and its storageType. Instead we can make TwoWindowBucket as storageType for each datanode.
DataNode1:
├── DISK -> TwoWindowBucket
└── SSD -> TwoWindowBucket
DataNode2:
├── DISK -> TwoWindowBucket
└── SSD -> TwoWindowBucket
| */ | ||
| private boolean hasEnoughSpaceForNode(DatanodeInfo dn) { | ||
| if (!tracker.hasAvailableSpace(dn)) { | ||
| if (!tracker.hasAvailableSpace(dn, 0, null)) { |
There was a problem hiding this comment.
No need to pass 0 here.
|
|
||
| @Override | ||
| public boolean checkSpaceAndRecordAllocation(Pipeline pipeline, ContainerID containerID) { | ||
| StorageType storageType = getStorageTypeForPendingAllocation(pipeline); |
There was a problem hiding this comment.
What does it mean here getStorageTypeForPendingAllocation ? It just give storageType for pipeline, if so we can just rename getStorageType(pipeline).
What changes were proposed in this pull request?
PendingContainerTracker currently accounts pending container allocations at the datanode level. With storage policy support, pending allocations should be counted only against the StorageType they target. For example, a pending DISK allocation should not reduce the available space calculated for SSD or ARCHIVE allocations.
This PR makes PendingContainerTracker store the StorageType for each pending container allocation. It adds StorageType-aware APIs in PendingContainerTracker and NodeManager, while keeping the existing untyped APIs and behavior for callers that do not have storage tier information.
PipelineManager derives the StorageType from the pipeline StorageTier and passes it to NodeManager when checking space and recording pending allocations.
The tests cover StorageType-specific pending counts, StorageType-specific space checks, the existing untyped behavior, and propagation from StorageTier.DISK to StorageType.DISK.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16045
How was this patch tested?
mvn -B --no-transfer-progress -pl hadoop-hdds/server-scm -am -Dtest=TestPendingContainerTracker test -DskipShade -DskipRecon -DskipDocsCI: https://github.com/F64116045/ozone/actions/runs/30770518425