Hisoka-X commented on code in PR #7835:
URL: https://github.com/apache/seatunnel/pull/7835#discussion_r1800328289
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:
##########
@@ -238,7 +245,14 @@ public Optional<MultiTableCommitInfo> prepareCommit()
throws IOException {
.entrySet()) {
Optional<?> commit;
try {
- commit =
sinkWriterEntry.getValue().prepareCommit();
+ SinkWriter<SeaTunnelRow, ?, ?>
sinkWriter =
Review Comment:
how about change `prepareCommit` to `prepareCommit(checkpointId)`? So we can
avoid check `SupportCheckpointIdDownStream`.
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkWriter.java:
##########
@@ -64,6 +64,20 @@ default void applySchemaChange(SchemaChangeEvent event)
throws IOException {}
*/
Optional<CommitInfoT> prepareCommit() throws IOException;
+ /**
+ * prepare the commit, will be called before {@link #snapshotState(long
checkpointId)}. If you
+ * need to use 2pc, you can return the commit info in this method, and
receive the commit info
+ * in {@link SinkCommitter#commit(List)}. If this method failed (by throw
exception), **Only**
+ * Spark engine will call {@link #abortPrepare()}
+ *
+ * @param checkpointId checkpointId
+ * @return the commit info need to commit
+ * @throws IOException If fail to prepareCommit
+ */
+ default Optional<CommitInfoT> prepareCommit(long checkpointId) throws
IOException {
+ return Optional.empty();
Review Comment:
```suggestion
return prepareCommit();
```
--
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]