sodonnel commented on code in PR #4767:
URL: https://github.com/apache/ozone/pull/4767#discussion_r1204631952


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/PipelineChoosePolicy.java:
##########
@@ -30,8 +30,18 @@ public interface PipelineChoosePolicy {
    * Given an initial list of pipelines, return one of the pipelines.
    *
    * @param pipelineList list of pipelines.
-   * @return one of the pipelines.
+   * @return one of the pipelines or null if no pipeline can be selected.
    */
   Pipeline choosePipeline(List<Pipeline> pipelineList,
       PipelineRequestInformation pri);
+
+  /**
+   * Given a list of pipelines, return the index of the chosen pipeline.
+   * @param pipelineList List of pipelines
+   * @param pri          PipelineRequestInformation
+   * @return Index in the list of the chosen pipeline, or -1 if no pipeline
+   *         could be selected.
+   */
+  int choosePipelineIndex(List<Pipeline> pipelineList,
+      PipelineRequestInformation pri);

Review Comment:
   I find it very unlikely that anyone has an implementation of the pipeline 
choosing policy. Whats the alternative to never being able to change this?
   
   The healthy policy isn't good IMO, as it mutates the array it is passed. 
That could have some strange side effect, if for example the caller was using 
an iterator over the array or something.
   
   I wonder if we could fix he Healthy policy somehow to avoid making it throw 
on the exception.



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