ashishkumar50 commented on code in PR #10928:
URL: https://github.com/apache/ozone/pull/10928#discussion_r3840969972


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/PendingContainerTracker.java:
##########
@@ -79,11 +81,11 @@ public class PendingContainerTracker {
 
   /**
    * Two-window bucket for a single DataNode.
-   * Contains current and previous window sets, plus last roll timestamp.
+   * Contains current and previous window maps, plus last roll timestamp.
    */
   public static class TwoWindowBucket {
-    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<>();

Review 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
   ```



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMCommonPlacementPolicy.java:
##########
@@ -323,37 +320,15 @@ public static boolean hasEnoughSpace(DatanodeDetails 
datanodeDetails,
 
     DatanodeInfo datanodeInfo = (DatanodeInfo) datanodeDetails;
 
-    // Data-space check: use PendingContainerTracker slot availability.
-    // This accounts for both current disk usage and in-flight allocations.
+    // Data-space check: use PendingContainerTracker availability.
+    // This accounts for current disk usage, storage type and in-flight 
allocations.
     // Always slot-based (maxContainerSize unit).
-    if (!nodeManager.hasAvailableSpace(datanodeInfo)) {
+    if (!nodeManager.hasAvailableSpace(
+        datanodeInfo, dataSizeRequired, storageType)) {

Review Comment:
   `dataSizeRequired` is not required.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineManagerImpl.java:
##########
@@ -703,6 +704,7 @@ private boolean isOpenWithUnregisteredNodes(Pipeline 
pipeline) {
 
   @Override
   public boolean checkSpaceAndRecordAllocation(Pipeline pipeline, ContainerID 
containerID) {
+    StorageType storageType = getStorageTypeForPendingAllocation(pipeline);

Review Comment:
   What does it mean here `getStorageTypeForPendingAllocation` ? It just give 
storageType for pipeline, if so we can just rename `getStorageType(pipeline)`.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -1510,7 +1518,7 @@ public boolean test(DatanodeInfo dn) {
      * {@link PendingContainerTracker}) and sufficient Ratis metadata volume 
space.
      */
     private boolean hasEnoughSpaceForNode(DatanodeInfo dn) {
-      if (!tracker.hasAvailableSpace(dn)) {
+      if (!tracker.hasAvailableSpace(dn, 0, null)) {

Review Comment:
   No need to pass 0 here.



-- 
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