You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "xichen01 (via GitHub)" <gi...@apache.org> on 2026/06/22 10:19:53 UTC

[PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

xichen01 opened a new pull request, #10573:
URL: https://github.com/apache/ozone/pull/10573

   ## What changes were proposed in this pull request?
   SCM Pipeline Add `supportedStorageTier` Field
   
   - Set `supportedStorageTier` for Pipeline when the Pipeline be created
   - Pipeline can support zero or more different types of `StorageTier`, depending on the Volume `StorageType` of the Datanodes that make up the Pipeline.  
     - For example, if the three Datanodes of a 3 replica Pipeline have SSD and DISK `StorageType` Volumes, then the Pipeline `supportedStorageTier` is `StorageTier.SSD` and `StorageTier.DISK`
   - The `supportedStorageTier` by the Pipeline is not fixed. This field will be set when the Pipeline is created and will be updated in the `PipelineReportHandler` and `NodeReportHandler`. 
      - When the `StorageType` of the Volume of the Datanode in the Pipeline changes (for example, the Datanode configuration is manually modified), the `supportedStorageTier` of the Pipeline will also change
   
   
   ---
   FYI:
   - Releated doc and discuss: https://github.com/apache/ozone/pull/6989
   - A preview version for the full "Ozone Storage Policy"  feature: https://github.com/ivandika3/ozone/tree/refs/heads/backport-storage-policy-storage-class
   
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-15409
   
   
   ## How was this patch tested?
   unit test


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3490890577


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java:
##########
@@ -170,6 +178,32 @@ public DatanodeID getSuggestedLeaderId() {
     return suggestedLeaderId;
   }
 
+  /**
+   * Return the Pipeline supported StorageTier.
+   *
+   * @return Supported StorageTier
+   */
+  public List<StorageTier> getSupportedStorageTier() {
+    lock.readLock().lock();
+    try {
+      return supportedStorageTier;
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Set the storageTier supported by the pipeline.
+   */
+  public void setSupportedStorageTier(List<StorageTier> supportedStorageTier) {

Review Comment:
   > Pipeline has not yet been marked as https://github.com/immutable, and there are some other variables that are mutable.
   
   Thanks @xichen01 for the update. Regarding lines 98–111, although Pipeline is not currently marked as immutable, the Javadoc suggests it is intended to be. Introducing a lock inside the Pipeline object to make a mutable field thread-safe is an anti-pattern we should avoid here.
   
   Here is why an Immutable approach is fundamentally better than RRWL (ReentrantReadWriteLock):
   1. Read Impact: Every readLock.lock() call still requires a CAS (Compare-And-Swap) operation to update the lock status. Under heavy concurrent reads, this forces multiple threads to constantly sync for the same memory address (lock state), introducing unnecessary overhead. An immutable design provides a true zero-cost read, which is critical for SCM's read-heavy workload.
   
   2. Write Impact: Modifying the supported storage tier is an extremely rare operation in the pipeline lifecycle. Creating a new Pipeline instance via the Builder pattern to update this field is a very lightweight operation.
   



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "xichen01 (via GitHub)" <gi...@apache.org>.
xichen01 commented on PR #10573:
URL: https://github.com/apache/ozone/pull/10573#issuecomment-4951023578

   > > What does "pipeline engagement aware of StorageTier" mean?
   > 
   > @xichen01 I am referring to the recent internal patch that ensures TestAllocateContainerWithStorageTier does not fail by including `StorageType` in `PipelinePlacementPolicy#currentRatisThreePipelineCount` (among other things). At the current state if the number of pipelines for DISK is already hitting the limit, we cannot allocate a new SSD pipeline since both of them share the same limit.
   
   Updated


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "xichen01 (via GitHub)" <gi...@apache.org>.
xichen01 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3471976135


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -722,6 +724,49 @@ public void processNodeReport(DatanodeDetails datanodeDetails,
     }
   }
 
+  private void updateSupportedStorageTier(DatanodeInfo datanodeInfo) {
+    if (scmContext.getScm() == null) {
+      LOG.debug("Skip the updating of Pipeline supported StorageTier for Recon");
+      return;
+    }
+
+    PipelineManager pipelineManager = scmContext.getScm().getPipelineManager();
+    if (pipelineManager == null) {
+      LOG.debug("Skip the updating of Pipeline supported StorageTier for Recon");
+      return;
+    }
+
+    Set<PipelineID> pipelines = nodeStateManager.getPipelineByDnID(
+        datanodeInfo.getID());
+    for (PipelineID pipelineId : pipelines) {
+      try {
+        Pipeline pipeline = pipelineManager.getPipeline(pipelineId);
+        Set<StorageTier> currentTiers =
+            pipeline.getSupportedStorageTier() != null
+                ? new HashSet<>(pipeline.getSupportedStorageTier())
+                : Collections.emptySet();
+        List<StorageTier> newSupportedTiers =
+            NodeUtils.getDatanodesStorageTypes(pipeline.getNodes(), this);
+        Set<StorageTier> newSupportedTierSet =
+            new HashSet<>(newSupportedTiers);
+        if (!currentTiers.equals(newSupportedTierSet)) {
+          pipeline.setSupportedStorageTier(newSupportedTiers);
+          LOG.info("Updated supported storage tiers for Pipeline ID {} from {} "
+                  + "to {} by Datanode {}",
+              pipeline.getId(), currentTiers, newSupportedTierSet,
+              datanodeInfo.getID());
+        }

Review Comment:
   If the storage type of a DN's volume changes, the `NodeReportHandler` can process `StorageTier` more quickly, and it is also more semantically appropriate.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -722,6 +724,49 @@ public void processNodeReport(DatanodeDetails datanodeDetails,
     }
   }
 
+  private void updateSupportedStorageTier(DatanodeInfo datanodeInfo) {
+    if (scmContext.getScm() == null) {
+      LOG.debug("Skip the updating of Pipeline supported StorageTier for Recon");
+      return;
+    }
+
+    PipelineManager pipelineManager = scmContext.getScm().getPipelineManager();
+    if (pipelineManager == null) {
+      LOG.debug("Skip the updating of Pipeline supported StorageTier for Recon");
+      return;
+    }
+
+    Set<PipelineID> pipelines = nodeStateManager.getPipelineByDnID(
+        datanodeInfo.getID());
+    for (PipelineID pipelineId : pipelines) {
+      try {
+        Pipeline pipeline = pipelineManager.getPipeline(pipelineId);
+        Set<StorageTier> currentTiers =
+            pipeline.getSupportedStorageTier() != null
+                ? new HashSet<>(pipeline.getSupportedStorageTier())
+                : Collections.emptySet();
+        List<StorageTier> newSupportedTiers =
+            NodeUtils.getDatanodesStorageTypes(pipeline.getNodes(), this);
+        Set<StorageTier> newSupportedTierSet =
+            new HashSet<>(newSupportedTiers);
+        if (!currentTiers.equals(newSupportedTierSet)) {
+          pipeline.setSupportedStorageTier(newSupportedTiers);
+          LOG.info("Updated supported storage tiers for Pipeline ID {} from {} "
+                  + "to {} by Datanode {}",
+              pipeline.getId(), currentTiers, newSupportedTierSet,
+              datanodeInfo.getID());
+        }
+      } catch (PipelineNotFoundException e) {
+        LOG.debug("Reported Datanode {} pipeline {} is not found",

Review Comment:
   updated.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -722,6 +724,49 @@ public void processNodeReport(DatanodeDetails datanodeDetails,
     }
   }
 
+  private void updateSupportedStorageTier(DatanodeInfo datanodeInfo) {
+    if (scmContext.getScm() == null) {

Review Comment:
   `scmContext.getScm() == null` this results in one less level of indentation and does not skip the `ReconStorageContainerManagerFacade`, so I think we can keep it this way.



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java:
##########
@@ -170,6 +178,32 @@ public DatanodeID getSuggestedLeaderId() {
     return suggestedLeaderId;
   }
 
+  /**
+   * Return the Pipeline supported StorageTier.
+   *
+   * @return Supported StorageTier
+   */
+  public List<StorageTier> getSupportedStorageTier() {
+    lock.readLock().lock();
+    try {
+      return supportedStorageTier;
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Set the storageTier supported by the pipeline.
+   */
+  public void setSupportedStorageTier(List<StorageTier> supportedStorageTier) {

Review Comment:
   Pipeline has not yet been marked as @Immutable, and there are some other variables that are mutable. Furthermore, if you want to make `supportedStorageTier` immutable, you'll need to implement the interface that the `PipelineUpdate` method calls for in `PipelineManager`.
   
   So I think we can temporarily update `supportedStorageTier` directly using `set`.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "greenwich (via GitHub)" <gi...@apache.org>.
greenwich commented on PR #10573:
URL: https://github.com/apache/ozone/pull/10573#issuecomment-4796862182

   LGTM


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3510879837


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java:
##########
@@ -170,6 +178,32 @@ public DatanodeID getSuggestedLeaderId() {
     return suggestedLeaderId;
   }
 
+  /**
+   * Return the Pipeline supported StorageTier.
+   *
+   * @return Supported StorageTier
+   */
+  public List<StorageTier> getSupportedStorageTier() {
+    lock.readLock().lock();
+    try {
+      return supportedStorageTier;
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Set the storageTier supported by the pipeline.
+   */
+  public void setSupportedStorageTier(List<StorageTier> supportedStorageTier) {

Review Comment:
   @xichen01 let's remove this `setSupportedStorageTier` and also the `updateStorageTier` logic in the node report since as we discovered the updating storage tiers from the node and pipeline report will cause issues. 
   
   Also one pipeline should only own ONE StorageTier and it should be immutable for its lifetime. If a set of 3 datanodes have multiple storage volumes (e.g. SSD and HDD), two pipelines will be created one HDD pipeline and one SSD pipeline.
   
   Also you can migrate the test of the fix to this patch as well to simulate the issue we found.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on PR #10573:
URL: https://github.com/apache/ozone/pull/10573#issuecomment-4890901278

   Please also add the logic to make pipeline engagement aware of StorageTier.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3490890577


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java:
##########
@@ -170,6 +178,32 @@ public DatanodeID getSuggestedLeaderId() {
     return suggestedLeaderId;
   }
 
+  /**
+   * Return the Pipeline supported StorageTier.
+   *
+   * @return Supported StorageTier
+   */
+  public List<StorageTier> getSupportedStorageTier() {
+    lock.readLock().lock();
+    try {
+      return supportedStorageTier;
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Set the storageTier supported by the pipeline.
+   */
+  public void setSupportedStorageTier(List<StorageTier> supportedStorageTier) {

Review Comment:
   > Pipeline has not yet been marked as https://github.com/immutable, and there are some other variables that are mutable.
   
   Regarding lines 98–111, although Pipeline is not currently marked as immutable, the Javadoc suggests it is intended to be.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3510879837


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java:
##########
@@ -170,6 +178,32 @@ public DatanodeID getSuggestedLeaderId() {
     return suggestedLeaderId;
   }
 
+  /**
+   * Return the Pipeline supported StorageTier.
+   *
+   * @return Supported StorageTier
+   */
+  public List<StorageTier> getSupportedStorageTier() {
+    lock.readLock().lock();
+    try {
+      return supportedStorageTier;
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Set the storageTier supported by the pipeline.
+   */
+  public void setSupportedStorageTier(List<StorageTier> supportedStorageTier) {

Review Comment:
   @xichen01 let's remove this `setSupportedStorageTier` and also the `updateStorageTier` logic in the node report since as we discovered the updating storage tiers from the node and pipeline report will cause issues. 
   
   One pipeline should only own StorageTier.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "xichen01 (via GitHub)" <gi...@apache.org>.
xichen01 commented on PR #10573:
URL: https://github.com/apache/ozone/pull/10573#issuecomment-4886688548

   If a Pipeline is created with a `supportedStorageTier` that includes multiple tiers, such as DISK and SSD, the SCM will treat this Pipeline as writable from both tiers when selecting a Pipeline for write requests to a specific storage tier.
   
   However, in reality, it's possible that a storage tier, such as SSD, may be full.
   
   If a Pipeline has only one `supportedStorageTier`, and the Pipeline is closed after being full, that storage tier's Pipeline will not be recreated.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "xichen01 (via GitHub)" <gi...@apache.org>.
xichen01 commented on PR #10573:
URL: https://github.com/apache/ozone/pull/10573#issuecomment-4767262183

   @amaliujia @greenwich @chungen0126 @ivandika3 @peterxcli Please help to review


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3510926676


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineReportHandler.java:
##########
@@ -139,6 +146,28 @@ protected void processPipelineReport(PipelineReport report,
     }
   }
 
+  private void updateSupportedStorageTiers(Pipeline pipeline) {
+    try {
+      Set<StorageTier> currentSupportedTiers =
+          pipeline.getSupportedStorageTier() != null
+              ? new HashSet<>(pipeline.getSupportedStorageTier())
+              : Collections.emptySet();
+
+      Set<StorageTier> newSupportedTiers =
+          new HashSet<>(NodeUtils.getDatanodesStorageTypes(pipeline.getNodes(),
+              scmContext.getScm().getScmNodeManager()));
+
+      if (!currentSupportedTiers.equals(newSupportedTiers)) {
+        pipeline.setSupportedStorageTier(new ArrayList<>(newSupportedTiers));
+        LOGGER.info("Updated supported storage tiers for Pipeline ID {} from {} to {}",
+            pipeline.getId(), currentSupportedTiers, newSupportedTiers);
+      }
+    } catch (Exception e) {
+      LOGGER.warn("Failed to update supported storage tiers for Pipeline ID {} due to: {}",
+          pipeline.getId(), e.getMessage(), e);
+    }
+  }

Review Comment:
   Please remove this



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java:
##########
@@ -188,13 +190,20 @@ public synchronized Pipeline create(RatisReplicationConfig replicationConfig,
 
     DatanodeDetails suggestedLeader = leaderChoosePolicy.chooseLeader(dns);
 
+    List<StorageTier> storageTiers = NodeUtils.getDatanodesStorageTypes(dns, getNodeManager());
+    if (!storageTiers.contains(storageTier)) {
+      throw new SCMException(String.format("Cannot create pipeline for StorageTier %s replicationConfig: %s",
+              storageTier, replicationConfig), SCMException.ResultCodes.FAILED_TO_FIND_SUITABLE_NODE);
+    }

Review Comment:
   Don't set based on `NodeUtils.getdatanodeStorageTypes`, set a singleton tier.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -722,6 +724,49 @@ public void processNodeReport(DatanodeDetails datanodeDetails,
     }
   }
 
+  private void updateSupportedStorageTier(DatanodeInfo datanodeInfo) {

Review Comment:
   Remove this.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SimplePipelineProvider.java:
##########
@@ -73,33 +76,47 @@ public Pipeline create(StandaloneReplicationConfig replicationConfig,
     }
 
     Collections.shuffle(dns);
+    List<StorageTier> storageTiers = NodeUtils.getDatanodesStorageTypes(dns, getNodeManager());
+    if (!storageTiers.contains(storageTier)) {
+      throw new SCMException(String.format("Cannot create pipeline for StorageTier %s replicationConfig: %s",
+          storageTier, replicationConfig), SCMException.ResultCodes.FAILED_TO_FIND_SUITABLE_NODE);
+    }

Review Comment:
   Same here, set singleton storage tier.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/ECPipelineProvider.java:
##########
@@ -135,17 +143,19 @@ public Pipeline createForRead(
 
     dns.sort(Comparator.comparing(nodeStatusMap::get, CREATE_FOR_READ_COMPARATOR));
 
-    return createPipelineInternal(replicationConfig, dns, map);
+    // Read Pipelines do not require storage tiers, so the calculation of storage tiers can be omitted.
+    return createPipelineInternal(replicationConfig, dns, map, new ArrayList<>());
   }
 
   private Pipeline createPipelineInternal(ECReplicationConfig repConfig,
-      List<DatanodeDetails> dns, Map<DatanodeDetails, Integer> indexes) {
+      List<DatanodeDetails> dns, Map<DatanodeDetails, Integer> indexes, List<StorageTier> storageTiers) {
     return Pipeline.newBuilder()
         .setId(PipelineID.randomId())
         .setState(Pipeline.PipelineState.ALLOCATED)
         .setReplicationConfig(repConfig)
         .setNodes(dns)
         .setReplicaIndexes(indexes)
+        .setSupportedStorageTier(storageTiers)

Review Comment:
   Make this singleton



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "xichen01 (via GitHub)" <gi...@apache.org>.
xichen01 commented on PR #10573:
URL: https://github.com/apache/ozone/pull/10573#issuecomment-4914232898

   > Thanks @xichen01 for the update. Please also add the logic to make pipeline engagement aware of StorageTier.
   
   What does "pipeline engagement aware of StorageTier" mean? 
   
   Perhaps it refers to the need for subsequent commits to be compatible?


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on PR #10573:
URL: https://github.com/apache/ozone/pull/10573#issuecomment-4920886573

   > What does "pipeline engagement aware of StorageTier" mean?
   
   @xichen01 I am referring to the recent internal patch that ensures TestAllocateContainerWithStorageTier does not fail by including `StorageType` in `PipelinePlacementPolicy#currentRatisThreePipelineCount` (among other things).


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3510879837


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java:
##########
@@ -170,6 +178,32 @@ public DatanodeID getSuggestedLeaderId() {
     return suggestedLeaderId;
   }
 
+  /**
+   * Return the Pipeline supported StorageTier.
+   *
+   * @return Supported StorageTier
+   */
+  public List<StorageTier> getSupportedStorageTier() {
+    lock.readLock().lock();
+    try {
+      return supportedStorageTier;
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Set the storageTier supported by the pipeline.
+   */
+  public void setSupportedStorageTier(List<StorageTier> supportedStorageTier) {

Review Comment:
   @xichen01 let's remove this `setSupportedStorageTier` and also the `updateStorageTier` logic in the node report since as we discovered the updating storage tiers from the node and pipeline report will cause issues. 
   
   One pipeline should only own ONE StorageTier and it should be immutable for its lifetime. If a set of 3 datanodes have multiple storage volumes (e.g. SSD and HDD), two pipelines will be created one HDD pipeline and one SSD pipeline.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3510879837


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java:
##########
@@ -170,6 +178,32 @@ public DatanodeID getSuggestedLeaderId() {
     return suggestedLeaderId;
   }
 
+  /**
+   * Return the Pipeline supported StorageTier.
+   *
+   * @return Supported StorageTier
+   */
+  public List<StorageTier> getSupportedStorageTier() {
+    lock.readLock().lock();
+    try {
+      return supportedStorageTier;
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Set the storageTier supported by the pipeline.
+   */
+  public void setSupportedStorageTier(List<StorageTier> supportedStorageTier) {

Review Comment:
   @xichen01 let's remove this `setSupportedStorageTier` and also the `updateStorageTier` logic in the node report since as we discovered the updating storage tiers from the node and pipeline report will cause issues. 
   
   One pipeline should only own ONE StorageTier and it should be immutable for its lifetime.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3490890577


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java:
##########
@@ -170,6 +178,32 @@ public DatanodeID getSuggestedLeaderId() {
     return suggestedLeaderId;
   }
 
+  /**
+   * Return the Pipeline supported StorageTier.
+   *
+   * @return Supported StorageTier
+   */
+  public List<StorageTier> getSupportedStorageTier() {
+    lock.readLock().lock();
+    try {
+      return supportedStorageTier;
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Set the storageTier supported by the pipeline.
+   */
+  public void setSupportedStorageTier(List<StorageTier> supportedStorageTier) {

Review Comment:
   > Pipeline has not yet been marked as https://github.com/immutable, and there are some other variables that are mutable.
   
   Thanks @xichen01 for the update. Regarding lines 98–111, although Pipeline is not currently marked as immutable, the Javadoc suggests it is intended to be. Introducing a lock inside the Pipeline object to make a mutable field thread-safe is an anti-pattern we should avoid 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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3451850771


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java:
##########
@@ -170,6 +178,32 @@ public DatanodeID getSuggestedLeaderId() {
     return suggestedLeaderId;
   }
 
+  /**
+   * Return the Pipeline supported StorageTier.
+   *
+   * @return Supported StorageTier
+   */
+  public List<StorageTier> getSupportedStorageTier() {
+    lock.readLock().lock();
+    try {
+      return supportedStorageTier;
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Set the storageTier supported by the pipeline.
+   */
+  public void setSupportedStorageTier(List<StorageTier> supportedStorageTier) {

Review Comment:
   Using setSupportedStorageTier here breaks the immutable design of the Pipeline class. A better approach would be to follow the existing pattern of copyWithNodesInOrder to update the pipeline's state.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -722,6 +724,49 @@ public void processNodeReport(DatanodeDetails datanodeDetails,
     }
   }
 
+  private void updateSupportedStorageTier(DatanodeInfo datanodeInfo) {
+    if (scmContext.getScm() == null) {

Review Comment:
   Would it be better to use `instanceof`?
   
   ```suggestion
       if (scmContext.getScm() instanceof StorageContainerManager) {
   ```



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -722,6 +724,49 @@ public void processNodeReport(DatanodeDetails datanodeDetails,
     }
   }
 
+  private void updateSupportedStorageTier(DatanodeInfo datanodeInfo) {
+    if (scmContext.getScm() == null) {
+      LOG.debug("Skip the updating of Pipeline supported StorageTier for Recon");
+      return;
+    }
+
+    PipelineManager pipelineManager = scmContext.getScm().getPipelineManager();
+    if (pipelineManager == null) {
+      LOG.debug("Skip the updating of Pipeline supported StorageTier for Recon");
+      return;
+    }
+
+    Set<PipelineID> pipelines = nodeStateManager.getPipelineByDnID(
+        datanodeInfo.getID());
+    for (PipelineID pipelineId : pipelines) {
+      try {
+        Pipeline pipeline = pipelineManager.getPipeline(pipelineId);
+        Set<StorageTier> currentTiers =
+            pipeline.getSupportedStorageTier() != null
+                ? new HashSet<>(pipeline.getSupportedStorageTier())
+                : Collections.emptySet();
+        List<StorageTier> newSupportedTiers =
+            NodeUtils.getDatanodesStorageTypes(pipeline.getNodes(), this);
+        Set<StorageTier> newSupportedTierSet =
+            new HashSet<>(newSupportedTiers);
+        if (!currentTiers.equals(newSupportedTierSet)) {
+          pipeline.setSupportedStorageTier(newSupportedTiers);
+          LOG.info("Updated supported storage tiers for Pipeline ID {} from {} "
+                  + "to {} by Datanode {}",
+              pipeline.getId(), currentTiers, newSupportedTierSet,
+              datanodeInfo.getID());
+        }
+      } catch (PipelineNotFoundException e) {
+        LOG.debug("Reported Datanode {} pipeline {} is not found",

Review Comment:
   Would it be better to use the warn log level here?



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -722,6 +724,49 @@ public void processNodeReport(DatanodeDetails datanodeDetails,
     }
   }
 
+  private void updateSupportedStorageTier(DatanodeInfo datanodeInfo) {
+    if (scmContext.getScm() == null) {
+      LOG.debug("Skip the updating of Pipeline supported StorageTier for Recon");
+      return;
+    }
+
+    PipelineManager pipelineManager = scmContext.getScm().getPipelineManager();
+    if (pipelineManager == null) {
+      LOG.debug("Skip the updating of Pipeline supported StorageTier for Recon");
+      return;
+    }
+
+    Set<PipelineID> pipelines = nodeStateManager.getPipelineByDnID(
+        datanodeInfo.getID());
+    for (PipelineID pipelineId : pipelines) {
+      try {
+        Pipeline pipeline = pipelineManager.getPipeline(pipelineId);
+        Set<StorageTier> currentTiers =
+            pipeline.getSupportedStorageTier() != null
+                ? new HashSet<>(pipeline.getSupportedStorageTier())
+                : Collections.emptySet();
+        List<StorageTier> newSupportedTiers =
+            NodeUtils.getDatanodesStorageTypes(pipeline.getNodes(), this);
+        Set<StorageTier> newSupportedTierSet =
+            new HashSet<>(newSupportedTiers);
+        if (!currentTiers.equals(newSupportedTierSet)) {
+          pipeline.setSupportedStorageTier(newSupportedTiers);
+          LOG.info("Updated supported storage tiers for Pipeline ID {} from {} "
+                  + "to {} by Datanode {}",
+              pipeline.getId(), currentTiers, newSupportedTierSet,
+              datanodeInfo.getID());
+        }

Review Comment:
   I'm not sure if we should update the pipeline when processing node report. My understanding is that pipeline updates should be scoped exclusively to `PipelineReportHandler`



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on PR #10573:
URL: https://github.com/apache/ozone/pull/10573#issuecomment-4953615046

   Thanks @xichen01 for the patch and @chungen0126 @greenwich for the reviews.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 merged PR #10573:
URL: https://github.com/apache/ozone/pull/10573


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15409. SCM Pipeline Add SupportedStorageTier Field [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10573:
URL: https://github.com/apache/ozone/pull/10573#discussion_r3510879837


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java:
##########
@@ -170,6 +178,32 @@ public DatanodeID getSuggestedLeaderId() {
     return suggestedLeaderId;
   }
 
+  /**
+   * Return the Pipeline supported StorageTier.
+   *
+   * @return Supported StorageTier
+   */
+  public List<StorageTier> getSupportedStorageTier() {
+    lock.readLock().lock();
+    try {
+      return supportedStorageTier;
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Set the storageTier supported by the pipeline.
+   */
+  public void setSupportedStorageTier(List<StorageTier> supportedStorageTier) {

Review Comment:
   @xichen01 let's remove this `setSupportedStorageTier` and also the `updateStorageTier` logic in the node report since as we discovered the updating storage tiers from the node and pipeline report will cause issues. 
   
   Also one pipeline should only own ONE StorageTier and it should be immutable for its lifetime. If a set of 3 datanodes have multiple storage volumes (e.g. SSD and HDD), two pipelines will be created one HDD pipeline and one SSD pipeline.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org