nikitap-sg opened a new pull request, #13134:
URL: https://github.com/apache/seatunnel/pull/13134

   ## Purpose of the pull request
   
   A mid-batch PostgreSQL disconnect fails the JDBC sink even when 
`max_retries` is already high enough to reconnect.
   
   `JdbcOutputFormat.flush` catches the `executeBatch` `SQLException` and calls 
`updateExecutor(true)`. That closes statements before it opens a new 
connection. `BufferedBatchStatementExecutor.closeStatements` then executes the 
buffer again when the failure was not recorded as a `SQLException`. Binding the 
next row hits the closed statement. The converter wraps that as JDBC-10 
(`DATA_TYPE_CAST_FAILED`, `error field:id`, cause `This statement has been 
closed`), and flush does not retry a `JdbcConnectorException`.
   
   ## What this change does
   
   - A failed `executeBatch` keeps the in-memory buffer, including when row 
binding throws a connector exception. `closeStatements` no longer binds those 
rows onto the dead statement.
   - Flush unwraps a connector exception whose cause is a lost connection or a 
closed statement and uses the existing SQLException retry path.
   - PostgreSQL's `This statement has been closed` is treated as a closed 
statement. A real data error such as SQLState `22003` is still not retried.
   
   ## Check list
   
   * [ ] If any new Jar binary package adding in your PR, please add license 
and README.md in it. Not applicable.
   * [ ] If necessary, please update the documentation to describe the new 
feature. Not applicable.
   * [ ] If you are contributing the connector code, please check that the 
following files are updated:
     1. Update `plugin-mapping.properties` and add new connector information in 
it. Not applicable.
     2. Update the pom file of `seatunnel-dist`. Not applicable.
     3. Add ci label in label-scope-conf 
(.github/workflows/labeler/label-scope-conf.yml). Not applicable.
     4. Add e2e testcase in `seatunnel-e2e`. Covered by unit tests on the flush 
retry path.
     5. Update connector `plugin_config`. Not applicable.
   * [ ] Update the release note. No `release-note.md` on `dev`.


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