pnowojski commented on a change in pull request #13499:
URL: https://github.com/apache/flink/pull/13499#discussion_r497411137
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java
##########
@@ -296,6 +296,11 @@ private MemorySegment requestMemorySegment(int
targetChannel) {
synchronized (availableMemorySegments) {
returnExcessMemorySegments();
+ // target channel over quota; do not return a segment
Review comment:
Shouldn't this commit change some tests?
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java
##########
@@ -327,23 +358,83 @@ private MemorySegment requestMemorySegment() {
return requestMemorySegment(UNKNOWN_CHANNEL);
}
- @Nullable
- private MemorySegment requestMemorySegmentFromGlobal() {
+ private boolean requestMemorySegmentFromGlobal() {
+ assert Thread.holdsLock(availableMemorySegments);
+
+ if (isRequestedSizeReached()) {
+ return false;
+ }
+
+ MemorySegment segment =
networkBufferPool.requestMemorySegment();
+ if (segment != null) {
+ availableMemorySegments.add(segment);
+ numberOfRequestedMemorySegments++;
+ return true;
+ }
+ return false;
+ }
+
+ private boolean isRequestedSizeReached() {
+ return numberOfRequestedMemorySegments >= currentPoolSize;
+ }
Review comment:
nit: there are still two places doing `numberOfRequestedMemorySegments >
currentPoolSize`, but I guess they are off by one in the comparison and can not
be easily migrated to `isRequestedSizeReached()`?
----------------------------------------------------------------
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]