1996fanrui commented on code in PR #27783:
URL: https://github.com/apache/flink/pull/27783#discussion_r3008317692
##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/channel/RecoveredChannelStateHandler.java:
##########
@@ -90,25 +100,76 @@ public BufferWithContext<Buffer>
getBuffer(InputChannelInfo channelInfo)
return new BufferWithContext<>(wrap(buffer), buffer);
}
+ /**
+ * Buffer lifecycle in recover().
+ *
+ * <pre>
+ * Empty buffer:
+ * buffer(ref=1) → readableBytes=0, skip → finally recycles(ref=0)
+ *
+ * Non-filtering path:
+ * buffer(ref=1) → retain(ref=2) → channel owns one ref
+ * → finally recycles(ref=1), channel
keeps its ref
+ *
+ * Filtering path (success):
+ * buffer(ref=1) → filterAndRewrite → deserializer recycles when
consumed(ref=0)
+ * → finally: isRecycled=true, skip
+ *
+ * Filtering path (error before deserializer takes buffer):
+ * buffer(ref=1) → filterAndRewrite throws before setNextBuffer
+ * → finally: isRecycled=false, recycles(ref=0)
+ *
+ * Filtering path (error after deserializer takes buffer):
+ * buffer(ref=1) → deserializer recycles(ref=0) → serializeToBuffers
throws
+ * → finally: isRecycled=true, skip
Review Comment:
This is detailed Buffer lifecycle in recover().
--
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]