wsry opened a new pull request #11351: [FLINK-16404][runtime] Solve the 
potential deadlock problem when reducing exclusive buffers to zero
URL: https://github.com/apache/flink/pull/11351
 
 
   ## What is the purpose of the change
   One motivation of this issue is for reducing the in-flight data in the case 
of back pressure to speed up checkpoint. The current default exclusive buffers 
per channel is 2. If we reduce it to 0 and increase somewhat floating buffers 
for compensation, it might cause deadlock problem because all the floating 
buffers might be requested away by some blocked input channels and never 
recycled until barrier alignment.
   
   In order to solve above deadlock concern, we can make some logic changes on 
both sender and receiver sides.
   
   Sender side: it should revoke previous received credit after sending 
checkpoint barrier, that means it would not send any following buffers until 
receiving new credits.
   Receiver side: after processing the barrier from one channel and setting it 
blocked, it should release the available floating buffers for this blocked 
channel, and restore requesting floating buffers until barrier alignment. That 
means the receiver would only announce new credits to sender side after barrier 
alignment.
   Another possible benefit to do so is that the floating buffers might be more 
properly made use of before barrier alignment. We can further verify the 
performance concern via existing micro-benchmark.
   
   ## Brief change log
   
     - Downstream always allocate buffers based on the backlog of upstream.
     - Upstream blocks output after after sending a checkpoint barrier and at 
the same time clear the remaining credit.
     - Downstream frees all allocated buffers (credit) and never read data from 
the corresponding channels until the checkpoint completes or is canceled.
     - After checkpoint completes or is canceled, downstream resume consumption 
from upstream.
   
   
   ## Verifying this change
   The change is verified by both existing tests and new added tests.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** 
/ don't know)
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (**yes** / no / 
don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / **no**)
     - If yes, how is the feature documented? (**not applicable** / docs / 
JavaDocs / not documented)
   

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