spuru9 opened a new pull request, #4630: URL: https://github.com/apache/flink-cdc/pull/4630
## What is the purpose of this pull request? Fixes [FLINK-41604](https://issues.apache.org/jira/browse/FLINK-41604). The Db2 incremental source stores `event_serial_no` in its offset as a string (`LsnOffset`), but Debezium's `Db2OffsetContext.Loader` casts it to `Long`. Restoring from a checkpoint or savepoint taken after a change event was read therefore fails with `ClassCastException: String cannot be cast to Long` at `Db2OffsetContext.java:152`, and the job keeps restarting. Offsets saved before any change was read carry no `event_serial_no`, which is why the snapshot and the first start work. FLINK-36086 fixed the same mismatch for SQL Server with a patched `SqlServerOffsetContext`; this does the same for Db2. ## Brief change log - Copy `io.debezium.connector.db2.Db2OffsetContext` from Debezium 1.9.8.Final into `flink-connector-db2-cdc`; its loader accepts `event_serial_no` as a string (parsed), a `Long`, or absent (0). Offsets saved by current releases restore once this ships. - Add `LsnOffsetTest`, which loads an `LsnOffset` built by Flink CDC through the Db2 loader. --- ## Verifying this change This change added tests and can be verified as follows: - Added `LsnOffsetTest`: `testLoadOffsetWithEventSerialNo` fails without the fix with the `ClassCastException` above and passes with it; `testLoadOffsetWithoutEventSerialNo` covers offsets without the key. - Manually tested with Apache Flink's official `flink:1.20.3-java17` image, the `flink-sql-connector-db2-cdc` jar built from this branch plus `com.ibm.db2:jcc:11.5.9.0` in `lib/`, and `icr.io/db2_community/db2:11.5.9.0` with ASN Capture set up by this repository's `db2_server` scripts: after reading an insert, an update and a delete, stopping with a savepoint and resuming, the job prints the changes made while it was stopped. With the released 3.5.0 jar the same steps end in the restart loop. ## Documentation - Does this pull request introduce a new feature? no - If yes, how is the feature documented? not applicable --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: Claude Code (Claude Opus 5.5) -- 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]
