szetszwo commented on code in PR #10000:
URL: https://github.com/apache/ozone/pull/10000#discussion_r3132909987


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -225,6 +241,40 @@ private void unregisterMXBean() {
     }
   }
 
+  @Override
+  public PendingContainerTracker getPendingContainerTracker() {
+    return pendingContainerTracker;
+  }
+
+  /**
+   * Effective space check aligned with container allocation: per-disk slot 
model minus
+   * SCM pending allocations.
+   */
+  @Override
+  public boolean hasSpaceForNewContainerAllocation(DatanodeDetails node) {
+    Objects.requireNonNull(node, "node==null");
+    try {
+      DatanodeInfo datanodeInfo = getDatanodeInfo(node);
+      if (datanodeInfo == null) {
+        LOG.warn("DatanodeInfo not found for node {}", node.getUuidString());
+        return false;
+      }
+      return 
pendingContainerTracker.hasEffectiveAllocatableSpaceForNewContainer(
+          node, datanodeInfo);

Review Comment:
   We should remove the DatanodeDetails parameter from 
hasEffectiveAllocatableSpaceForNewContainer(..) since datanodeInfo already has 
all the information.



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfig.java:
##########
@@ -138,10 +138,31 @@ public class ScmConfig extends ReconfigurableConfig {
   )
   private int transactionToDNsCommitMapLimit = 5000000;
 
+  @Config(key = "hdds.scm.container.pending.allocation.roll.interval",

Review Comment:
   The other `ozone.scm.container.*` confs are in ScmConfigKeys.  Let's move 
this new conf to ScmConfigKeys.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerReportHandler.java:
##########
@@ -175,6 +176,17 @@ public void onMessage(final ContainerReportFromDatanode 
reportFromDatanode,
           if (!alreadyInDn) {
             // This is a new Container not in the nodeManager -> dn map yet
             getNodeManager().addContainer(datanodeDetails, cid);
+            
+            // Remove from pending tracker when container is added to DN
+            // This container was just confirmed for the first time on this DN
+            // No need to remove on subsequent reports (it's already been 
removed)
+            if (container != null) {
+              PendingContainerTracker tracker =
+                  getNodeManager().getPendingContainerTracker();
+              if (tracker != null) {

Review Comment:
   tracker seems never null.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to