pnowojski commented on a change in pull request #11687: 
[FLINK-16536][network][checkpointing] Implement InputChannel state recovery for 
unaligned checkpoint
URL: https://github.com/apache/flink/pull/11687#discussion_r409415021
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java
 ##########
 @@ -149,6 +149,47 @@ void assignExclusiveSegments() throws IOException {
                }
        }
 
+       @Override
+       public void initializeState(ChannelStateReader reader) throws 
IOException, InterruptedException {
+               numRequiredBuffers = initialCredit + 
inputGate.getBufferPool().getMaxNumberOfMemorySegments();
+               unannouncedCredit.set(initialCredit);
+
+               while (true) {
+                       Buffer buffer;
+                       synchronized (bufferQueue) {
+                               buffer = bufferQueue.takeBuffer();
+                               if (buffer == null) {
+                                       if (isReleased()) {
+                                               return;
+                                       }
+
+                                       if (!isWaitingForFloatingBuffers) {
+                                               buffer = 
inputGate.getBufferPool().requestBuffer();
+                                               if (buffer == null) {
+                                                       
inputGate.getBufferProvider().addBufferListener(this);
+                                                       
isWaitingForFloatingBuffers = true;
+                                               }
+                                       }
+                               }
+                       }
+
+                       if (buffer == null) {
+                               wait(10);
 
 Review comment:
   Oh, I missed that we are already using a separate thread pool. In that case 
we don't need the not blocking option now.
   
   It would be still good to get rid of timed wait in favour of some 
notifications though.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to