DanielLeens commented on code in PR #11103:
URL: https://github.com/apache/seatunnel/pull/11103#discussion_r3435127011


##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/CanalJsonWriteStrategy.java:
##########
@@ -98,7 +98,7 @@ public void write(@NonNull SeaTunnelRow seaTunnelRow) {
     }
 
     @Override
-    public void finishAndCloseFile() {
+    public synchronized void finishAndCloseFile() {

Review Comment:
   Thanks both. I rechecked the unchanged head against the actual runtime path 
before replying here.
   
   I do agree the API-boundary discussion is important at the multi-table 
exchange layer, but that is not the race this PR is fixing. On the current file 
sink path, `BaseFileSinkWriter.write()`, `prepareCommit()`, and 
`snapshotState()` all call the same `WriteStrategy` instance directly 
(`seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/BaseFileSinkWriter.java:182-203`).
 That single-writer path exists even when `MultiTableSinkWriter` is not 
involved at all.
   
   So the synchronization added here is serializing access to one writer 
instance's shared state (`FSDataOutputStream`, `beingWrittenFile`, 
commit/snapshot state) inside the file connector itself. Separately, the 
broader multi-table API layer already does its own queue-drain + lock 
coordination around `snapshotState()` / `prepareCommit()` in 
`seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:467-559`.
   
   Because of that, I still see this PR as a local file-writer correctness fix, 
not as the place to redesign the generic routing/checkpoint contract. If we 
want a wider API-level guarantee across other multi-table sinks, I think that 
belongs in a follow-up around the common sink runtime rather than blocking this 
unchanged file-sink patch.
   
   Since there is still no new commit after `2101a32`, I am keeping this as a 
reply-only clarification rather than reopening a full review on the same code 
version.



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