reswqa commented on code in PR #22960: URL: https://github.com/apache/flink/pull/22960#discussion_r1259243213
########## flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/storage/TieredStorageMemoryManagerImpl.java: ########## @@ -200,6 +201,20 @@ public int numOwnerRequestedBuffer(Object owner) { return numRequestedBuffer == null ? 0 : numRequestedBuffer.get(); } + @Override + public void transferBufferOwnership(Object oldOwner, Object newOwner, Buffer buffer) { + checkState(buffer.isBuffer(), "Only buffer supports transfer ownership."); + AtomicInteger numOldOwnerRequested = numOwnerRequestedBuffers.get(oldOwner); + if (numOldOwnerRequested == null) { + throw new RuntimeException("Failed to transfer buffer ownership for " + oldOwner); + } Review Comment: This can be replaced by `checkNotNull`. ########## flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/Buffer.java: ########## @@ -87,6 +87,13 @@ public interface Buffer { */ BufferRecycler getRecycler(); + /** + * Sets the buffer's recycler. + * + * @param bufferRecycler the new buffer recycler + */ + void setRecycler(BufferRecycler bufferRecycler); Review Comment: This is an unsafe operation, we may need add more descriptions of this method to avoid others accidentally introducing bugs. Especially for slice buffer. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org