DanielLeens commented on issue #13407: URL: https://github.com/apache/seatunnel/issues/13407#issuecomment-7100573595
Classification: F / Connector-V2 JDBC conditional-update correctness contract. Thanks for the concrete stale-repair scenario. I checked current `dev` at `ef9c7ee2586c97115ecc0baf6d928cba4f46d6d9`. `generate_sink_sql` currently has no conditional-update option. Dialects with a native upsert use `getUpsertStatement`, while the fallback path first checks key existence and then prepares separate insert and update statements. Appending a predicate only to the generic update statement would therefore neither cover all dialect paths nor distinguish a row that is absent from one whose conditional update affected zero rows; under concurrent writers, that distinction is correctness-critical. I found no matching open or merged PR for `update_condition_sql`. Please settle a narrow, dialect-aware contract before an implementation PR: 1. Define the supported first dialect/path and the exact generated SQL. The condition language must unambiguously distinguish incoming values from target-column references, including quoted identifiers and composite keys. Do not treat an arbitrary raw fragment as a portable JDBC expression or interpolate row data into SQL. 2. Define the atomic outcome for a missing row, a false or NULL condition, and a concurrent insert/update. A zero-row conditional update must not be mistaken for absence and followed by an insert that overwrites or races with another writer. State the transaction/isolation assumptions and retry behavior. 3. Preserve existing behavior when the option is absent, and state its interaction with native dialect upserts, `enable_upsert`, changed primary keys, duplicate or out-of-order rows in one batch, row-level error handling, and exactly-once or retry paths. 4. Provide container-backed regression evidence for the selected dialect: a missing key inserts; a newer stored value survives an older replay; false and NULL conditions leave the stored row unchanged; a composite-key case; duplicate/out-of-order records in a batch; and a concurrent-writer or equivalent atomicity case. Add matching English and Chinese configuration documentation only after the option contract is agreed. Please post that contract and a small SQL/prototype result here first. We can then decide whether the first patch belongs in a single dialect-specific path or needs a separately designed cross-dialect abstraction. No assignment or label change is implied by this review. -- 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]
