lokeshj1703 commented on a change in pull request #1469: HDDS-2034. Async RATIS 
pipeline creation and destroy through heartbea…
URL: https://github.com/apache/hadoop/pull/1469#discussion_r329055495
 
 

 ##########
 File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java
 ##########
 @@ -188,6 +208,15 @@ public AllocatedBlock allocateBlock(final long size, 
ReplicationType type,
           // TODO: #CLUTIL Remove creation logic when all replication types and
           // factors are handled by pipeline creator
           pipeline = pipelineManager.createPipeline(type, factor);
+          // wait until pipeline is ready
+          long current = System.currentTimeMillis();
+          while (!pipeline.isOpen() && System.currentTimeMillis() <
+              (current + pipelineCreateWaitTimeout)) {
+            try {
+              Thread.sleep(1000);
+            } catch (InterruptedException e) {
+            }
+          }
 
 Review comment:
   I think we also need to handle the case where no OPEN pipelines are there 
but pipelines are present in ALLOCATED state.
   I think it would be better idea to make the call return 
CompletableFuture\<AllocatedBlock\> and complete this future or throw an 
exception on timeout. I think it would be better than using a while loop. The 
futures can be completed on OPEN_PIPELINE event.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to