sokui commented on code in PR #3186:
URL: https://github.com/apache/ozone/pull/3186#discussion_r887302274


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/WritableRatisContainerProvider.java:
##########
@@ -124,7 +120,27 @@ public ContainerInfo getContainer(final long size,
         } catch (SCMException se) {
           LOG.warn("Pipeline creation failed for repConfig {} " +
               "Datanodes may be used up.", repConfig, se);
-          break;
+          LOG.info("Try to see if any pipeline is in ALLOCATED state, " +
+                  "and then will wait for it to be OPEN");
+          List<Pipeline> allocatedPipelines = findPipelinesByState(repConfig,
+                  excludeList,
+                  Pipeline.PipelineState.ALLOCATED);
+          if (!allocatedPipelines.isEmpty()) {
+            // wait until the oldest allocated pipeline is ready
+            Pipeline oldestAllocatedPipeline =
+                    allocatedPipelines
+                            .stream()
+                            .min(Comparator
+                                    .comparing(p -> p.getCreationTimestamp()))
+                            .get();
+            try {
+              pipelineManager
+                      .waitPipelineReady(oldestAllocatedPipeline.getId(), 0);

Review Comment:
   In the original code, we are already waiting for a new pipeline to be OPEN 
when there is no available pipelines: 
https://github.com/apache/ozone/pull/3186/files/db20d845ecbefcc8afcd34f3eae2af33624e6242#diff-3e9fb680afc24d9b9903384951f5313a6bfc20130ae807d6450d5dcc476537a0R118.
 
   
   Here is similar, when there is not available pipelines and some of them are 
already in ALLOCATED, we wait. It should wait less time than the above case. 
Both of these cases are very rare. So in my opinion it should be OK.
   
   > But if we do wait, it would be better to wait for any of the allocated 
pipelines to open, not just a specific one.
   
   I agree. I actually pick up the ALLOCATED pipeline with the oldest creation 
timestamp, which should be potential the fastest one to be OPEN. If we want to 
wait for the true fastest one, we need more code to deal with it. I can take a 
look into this



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