reswqa commented on code in PR #20371:
URL: https://github.com/apache/flink/pull/20371#discussion_r930877011
##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/HsSubpartitionMemoryDataManager.java:
##########
@@ -384,19 +389,23 @@ private void
trimHeadingReleasedBuffers(Deque<HsBufferContext> bufferQueue) {
}
@GuardedBy("subpartitionLock")
- private void releaseBuffer(int bufferIndex) {
- HsBufferContext bufferContext =
checkNotNull(bufferIndexToContexts.remove(bufferIndex));
- bufferContext.release();
+ private boolean releaseBuffer(int bufferIndex) {
+ HsBufferContext bufferContext =
bufferIndexToContexts.remove(bufferIndex);
+ if (bufferContext == null || !bufferContext.release()) {
+ return false;
+ }
// remove released buffers from head lazy.
trimHeadingReleasedBuffers(allBuffers);
+ return true;
}
@GuardedBy("subpartitionLock")
- private HsBufferContext startSpillingBuffer(
- int bufferIndex, CompletableFuture<Void> spillFuture) {
- HsBufferContext bufferContext =
checkNotNull(bufferIndexToContexts.get(bufferIndex));
- bufferContext.startSpilling(spillFuture);
- return bufferContext;
+ private boolean startSpillingBuffer(int bufferIndex,
CompletableFuture<Void> spillFuture) {
Review Comment:
good idea.
--
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]