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


##########
hadoop-hdds/common/src/main/resources/ozone-default.xml:
##########
@@ -984,6 +984,17 @@
     by the no of metadata volumes reported per dn.
   </description>
   </property>
+  <property>
+  <name>ozone.scm.datanode.chained.pipeline.limit</name>
+  <value>2</value>

Review Comment:
   - ozone.scm.ec.pipeline.minimum  (default 5): The lowest the cap can be, for 
each EC replication config                                                  
   - ozone.scm.ec.pipeline.per.volume.factor (default 1.0): Scales the 
volume-based cap. 0 turns it off.
   
   Please see if we can use the EC style conf.  It is more flexible.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -1761,9 +1765,18 @@ public int totalHealthyVolumeCount() {
    */
   @Override
   public int pipelineLimit(DatanodeDetails dn) {
+    return pipelineLimit(dn, datanodePipelineLimit);
+  }
+
+  @Override
+  public int pipelineLimit(DatanodeDetails dn, ReplicationType type) {
+    return pipelineLimit(dn, type == ReplicationType.CHAINED ? 
datanodeChainedPipelineLimit : datanodePipelineLimit);
+  }
+
+  private int pipelineLimit(DatanodeDetails dn, int configuredLimit) {
     try {
-      if (datanodePipelineLimit > 0) {
-        return datanodePipelineLimit;
+      if (configuredLimit > 0) {
+        return configuredLimit;

Review Comment:
   - Let's just remove the single parameter method.
   - Since we want to use ec style conf.  Let's use separated method to do the 
calculation.
   ```java
     @Override
     public int pipelineLimit(DatanodeDetails dn, ReplicationType type) {
       if (type == ReplicationType.RATIS) {
         return pipelineLimitRatis(dn);
       } else if (type == ReplicationType.CHAINED) {
         return pipelineLimitChained(dn);
       }
       return 0;
     }
   
     private int pipelineLimitChained(DatanodeDetails dn) {
       // Use ec style conf
     }
   
     private int pipelineLimitRatis(DatanodeDetails dn) {
       try {
         if (datanodePipelineLimit > 0) {
           return datanodePipelineLimit;
         } else if (nodeStateManager.getNode(dn).getHealthyVolumeCount() > 0) {
           return numPipelinesPerMetadataVolume *
               nodeStateManager.getNode(dn).getMetaDataVolumeCount();
         }
       } catch (NodeNotFoundException e) {
         LOG.warn("Cannot generate NodeStat, datanode {} not found.",
             dn);
       }
       return 0;
     }
   ```



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelinePlacementPolicyFactory.java:
##########
@@ -36,9 +37,22 @@ private PipelinePlacementPolicyFactory() {
 
   public static PlacementPolicy getPolicy(NodeManager nodeManager,
       PipelineStateManager stateManager, ConfigurationSource conf) {
+    return getPolicy(nodeManager, stateManager, conf, ReplicationType.RATIS);

Review Comment:
   Remove it.  This is also only used in tests.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelinePlacementPolicy.java:
##########
@@ -73,18 +76,33 @@ public final class PipelinePlacementPolicy extends 
SCMCommonPlacementPolicy {
   public PipelinePlacementPolicy(final NodeManager nodeManager,
                                  final PipelineStateManager stateManager,
                                  final ConfigurationSource conf) {
+    this(nodeManager, stateManager, conf, ReplicationType.RATIS);
+  }

Review Comment:
   This is only used in test.  Remove it and pass ReplicationType.RATIS in the 
tests.
   
   <img width="576" height="203" alt="image" 
src="https://github.com/user-attachments/assets/83e24b3e-dcb0-4f4c-8aec-94b04a4ab3a4";
 />



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