nzw921rx commented on code in PR #13060:
URL: https://github.com/apache/seatunnel/pull/13060#discussion_r4585979148


##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkWriter.java:
##########
@@ -105,6 +105,19 @@ interface Context extends Serializable {
         /** @return The index of this subtask. */
         int getIndexOfSubtask();
 
+        /**
+         * Returns the logical writer index retained across task attempts. 
Transactional sinks may
+         * use it to fence an abandoned attempt without changing the external 
identifiers of sinks
+         * that depend on {@link #getIndexOfSubtask()}.
+         *
+         * <p>On Spark this is the partition ID, while {@code 
getIndexOfSubtask()} retains the
+         * historical task-attempt ID. The stable index can be reused across 
streaming epochs; it
+         * must not be used alone as a unique identifier for a completed batch.
+         */
+        default int getStableSubtaskIndex() {
+            return getIndexOfSubtask();
+        }

Review Comment:
   I understand his involvement in every shard calculation
   



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