wgzhao opened a new pull request, #13459:
URL: https://github.com/apache/seatunnel/pull/13459
<!-- Thank you for contributing to SeaTunnel! -->
### Purpose of this pull request
Yes, I am contributing this change to Apache SeaTunnel.
Fixes #13458.
When a JDBC sink batch fails, the exception only contained the column name
returned by the database driver (for example, MySQL's `Incorrect string value
... for column 'follower_name' at row 156`). Neither the database nor the table
was included, so a multi-table job could not tell which sink table failed.
This change derives the `database.table` identifier from the sink
configuration in `JdbcOutputFormatBuilder` and passes it to `JdbcOutputFormat`.
Flush, commit and flush-retry failures now append `for table
<database>.<table>` to the exception message. When the sink has no resolved
table (for example, a custom SQL sink without table options), the identifier is
null and the previous messages are unchanged.
The scope is limited to JDBC connector internals: no configuration option,
public API, SPI contract or engine code is changed.
### Does this PR introduce _any_ user-facing change?
Yes. The exception message for JDBC sink flush/commit failures now contains
the target table, for example:
- Before: `... - Writing records to JDBC failed.`
- After: `... - JDBC batch flush failed for table sink_db.t1.`
The underlying driver message (column, row, SQL state) is unchanged and
remains in the cause chain. There is no configuration or compatibility change.
### How was this patch tested?
- `./mvnw -pl seatunnel-connectors-v2/connector-jdbc spotless:apply`
- `./mvnw -pl seatunnel-connectors-v2/connector-jdbc -am -DskipTests install`
- Targeted unit tests: `JdbcOutputFormatTest`,
`JdbcOutputFormatBuilderTest`, `JdbcSinkWriterTest`,
`JdbcOutputFormatBatchCommitTest`, `JdbcOutputFormatReconnectTest`,
`JdbcOutputFormatReconnectSafetyTest` — 63 tests passed.
The full connector-jdbc test suite was not completed locally because several
dialect tests start Docker containers whose images could not be pulled in this
environment. No new E2E case was added: this change only adds text to an
exception message, and the existing JDBC E2E suites assert data results rather
than error text. A MySQL multi-table failure IT can be added if maintainers
prefer; it would need a new scenario that deliberately makes the sink batch
fail.
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License
Notice according
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
— N/A, no new binary package.
* [ ] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
— N/A, no option or behavior change beyond the error text.
* [ ] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
— N/A, backward compatible.
* [ ] If you are contributing the connector code, please check that the
following files are updated:
— N/A, this modifies an existing connector and adds no new connector.
--
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]