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_r408728931
 
 

 ##########
 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:
   Ok I see. We can not block the shared executor for unspecified long time. 
This method would have to be rewritten in a such way, that once buffers are not 
available, it exits, and re-enqueuing action is done once more buffers are 
ready.
   
   If we spawned our custom thread for unspilling, we could block it however we 
want, but in that case we would also need a mechanism to wake it up once more 
buffers are ready, instead of sleeping for fixed amount of time.

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

Reply via email to