reswqa commented on code in PR #22381:
URL: https://github.com/apache/flink/pull/22381#discussion_r1164944912


##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java:
##########
@@ -671,13 +675,20 @@ public void setNumBuffers(int numBuffers) {
 
             currentPoolSize = Math.min(numBuffers, maxNumberOfMemorySegments);
 
-            // reset overdraft buffers
+            // If pool size increases, try to convert overdraft buffer to 
ordinary buffer.
             while (numberOfRequestedOverdraftMemorySegments > 0
                     && numberOfRequestedMemorySegments < currentPoolSize) {
                 numberOfRequestedOverdraftMemorySegments--;
                 numberOfRequestedMemorySegments++;
             }
 
+            // If pool size decreases, try to convert ordinary buffer to 
overdraft buffer.
+            while (numberOfRequestedMemorySegments > currentPoolSize
+                    && numberOfRequestedOverdraftMemorySegments < 
maxOverdraftBuffersPerGate) {
+                numberOfRequestedMemorySegments--;
+                numberOfRequestedOverdraftMemorySegments++;
+            }

Review Comment:
   > From the discussion of 
[FLINK-31610](https://issues.apache.org/jira/browse/FLINK-31610), this 
restriction(numberOfRequestedOverdraftMemorySegments <= 
maxOverdraftBuffersPerGate) will be broken in 
[FLINK-31764](https://issues.apache.org/jira/browse/FLINK-31764), right?
   
   Yep, you are absolutely right.
   
   > If so, I prefer 
[FLINK-31764](https://issues.apache.org/jira/browse/FLINK-31764) only refactor 
the code, not change the overdraft strategy or behavior, and we change the 
strategy in this PR, WDYT?
   
   Change the semantic/behavior in this PR also make sense to me. Let's update 
FLINK-31764 to only simply remove the redundant field.



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

Reply via email to