velo opened a new pull request, #279:
URL: https://github.com/apache/flink-connector-jdbc/pull/279

   ## What is the purpose of the change
   
   Since FLINK-38180 (Flink 2.2), an exception thrown while cleaning up a 
failed task is fatal and shuts down the TaskManager. `JdbcOutputFormat#close` 
flushes the buffer and rethrows, so a database outage turns a task failure into 
a TaskManager exit.
   
   A refused reconnect is also not retried: `flush()` leaves the retry loop on 
the first refusal, whatever `sink.max-retries` is, and leaves the statements 
null, so the flush in `close()` fails with a `NullPointerException`.
   
   ## Brief change log
   
   - `JdbcOutputFormat#flush`: rebuild the statement executor at the start of 
each retry, so a refused reconnect counts as a failed attempt and is retried 
with the existing backoff.
   - `JdbcOutputFormat#updateExecutor`: connect before closing the old 
statements, so a refused reconnect never leaves them null.
   - `JdbcOutputFormat#close`: release statements and the connection without 
flushing or rethrowing. Records still buffered belong to a failed or cancelled 
task and are replayed from the last checkpoint.
   - `GenericJdbcSinkFunction#finish`: flush, so bounded jobs write their last 
batch.
   - `JdbcWriter#close`: don't rethrow the stored flush failure in exactly-once 
mode.
   
   ## Verifying this change
   
   - `JdbcOutputFormatRowTest`: a refused reconnect is retried and the rows are 
written; `close()` does not throw after refused reconnects or after a failed 
background flush.
   - `JdbcOutputFormatTest`: `close()` does not throw after a failed flush; 
tests that relied on `close()` flushing now flush explicitly.
   - Existing ITCases in the core and Postgres modules pass, covering the 
`finish()` flush in bounded jobs.
   
   ## Does this pull request potentially affect one of the following parts
   
   - Public API: no (`JdbcOutputFormat` and `GenericJdbcSinkFunction` are 
`@Internal`)
   - Behavior: `close()` no longer writes buffered records; callers flush on a 
normal end.
   
   Generated-by: Claude
   


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