nzw921rx commented on PR #10609:
URL: https://github.com/apache/seatunnel/pull/10609#issuecomment-4119421781
> `JdbcExactlyOnceSinkWriter` also uses `JdbcOutputFormat`, and its
`prepareCommit()` process involves the prepare/commit of XA transactions. If
the scheduled flush thread triggers `flush()` during the execution of
`prepareCommit()`, it may lead to:
>
> 1. Data is flushed to the current XA transaction, but the data volume
statistics of `prepareCommit` are inconsistent.
> 2. Although `flush()` is synchronized and will not be executed
concurrently, the scheduled flush may be triggered in the gap between
`prepareCurrentTx()` and `beginTx()`, and the transaction status is uncertain
at this time.
>
> **Potential risks**: Under the exactly-once semantics, scheduled flush may
break the boundary consistency of XA transactions.
>
> **Improvement suggestions**:
>
> * `batch_interval_ms` should be disabled when `is_exactly_once = true`, or
at least a warning log should be given.
> * Add a check for exactly-once mode in `createAndStartScheduledFlush()`.
Add the following verification and print warn log
```
if (jdbcConnectionConfig.isExactlyOnce()) {
LOG.warn(
"JDBC periodic flush automatically disabled,
exactly-once mode enabled, batch_interval_ms={}",
batchIntervalMs);
return null;
}
```
--
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]