TanYuxin-tyx commented on code in PR #22652:
URL: https://github.com/apache/flink/pull/22652#discussion_r1214031417


##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/tier/TierProducerAgent.java:
##########
@@ -35,9 +41,21 @@ public interface TierProducerAgent {
      */
     boolean tryStartNewSegment(TieredStorageSubpartitionId subpartitionId, int 
segmentId);
 
-    /** Writes the finished {@link Buffer} to the consumer. */
-    boolean write(TieredStorageSubpartitionId subpartitionId, Buffer 
finishedBuffer)
-            throws IOException;
+    /**
+     * Writes the finished {@link Buffer} to the consumer.
+     *
+     * <p>Note that the tier must ensure that the buffer is written 
successfully without any
+     * exceptions, in order to guarantee that the buffer will be recycled. If 
this method throws an
+     * exception in the subsequent modifications, the caller should make sure 
that the buffer is
+     * recycled finally.

Review Comment:
   Fixed.



##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/tier/TierProducerAgent.java:
##########
@@ -21,9 +21,15 @@
 import org.apache.flink.runtime.io.network.buffer.Buffer;
 import 
org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageSubpartitionId;
 
-import java.io.IOException;
-
-/** The producer-side agent of a Tier. */
+/**
+ * The producer-side agent of a Tier.
+ *
+ * <p>Note that when writing a buffer to a tier, the {@link TierProducerAgent} 
should first call
+ * {@code tryStartNewSegment} to start a new segment. The agent can then 
continue writing the buffer
+ * to the tier as long as the return value of {@code write} is true. If the 
return value of {@code
+ * write} is false, it indicates that the current segment can no longer store 
the buffer, and the
+ * agent should try to start a new segment before writing the buffer.
+ */
 public interface TierProducerAgent {

Review Comment:
   Fixed.



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