You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "WXPNG (via GitHub)" <gi...@apache.org> on 2026/09/30 06:58:42 UTC
[I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
WXPNG opened a new issue, #12565:
URL: https://github.com/apache/seatunnel/issues/12565
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues.
### What happened
When a CDC job (built on connector-cdc-base, e.g. MySQL-CDC) is running in incremental mode with exactly-once, and I stop it with a savepoint, add a new table to the capture list, then restart it from the previous job id / restore from checkpoint, the pre-existing tables (already in the pure-increment phase) silently lose incremental changes.
The incremental split after restore mixes two kinds of tables: old tables that finished snapshot in a previous run, and new tables snapshotted in the current run. But the split start offset and the per-table emission filter only account for the new tables, so changes produced on the old tables between the savepoint offset and the new table's snapshot watermark are dropped.
### SeaTunnel Version
dev
### SeaTunnel Config
```conf
env {
parallelism = 1
job.mode = "STREAMING"
checkpoint.interval = 5000
}
source {
MySQL-CDC {
base-url = "jdbc:mysql://localhost:3306/test"
username = "root"
password = "xxxxxx"
table-names = ["test.t1", "test.t2"]
startup.mode = "initial"
exactly_once = true
}
}
sink {
Console {}
}
```
### Running Command
```shell
# Create replication job (jobID: 1152905286592233473)
curl -X POST "http://127.0.0.1:8080/submit-job?format=hocon" \
-H "Content-Type: text/plain" \
-d "$(cat mysql_2_xxxx.conf)"
# Stop with savepoint
curl -X POST "http://127.0.0.1:8080/stop-job" \
-H "Content-Type: application/json" \
-d '{
"jobId": 1152905286592233473,
"isStopWithSavePoint": true,
"force": false
}'
# Add t3 to table-names
# Restart with savepoint
curl -X POST "http://127.0.0.1:8080/submit-job?format=hocon&jobId= 1152905286592233473&isStartWithSavePoint=true" \
-H "Content-Type: text/plain" \
-d "$(cat mysql_2_xxxx.conf)"
```
### Error Exception
```log
No exception is thrown. The symptom is silent data loss: the incremental changes of the old tables (t1/t2) produced during the restore window are missing in the target, while the new table (t3) is synchronized normally.
```
### Zeta or Flink or Spark Version
Zeta
### Java or Scala Version
JDK 8
### Screenshots
(optional: a comparison showing that t1/t2 incremental records during the restore window are missing in the target while t3 is present)
### Are you willing to submit PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
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: commits-unsubscribe@seatunnel.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-6096823303
@WXPNG thanks for confirming that the analysis matches what you reproduced on your side — that's useful validation.
Quick status so this thread stays accurate: the fix is tracked in #12567, and its current head `e18f31cfcf` does carry the three source-level changes we asked for (table-specific restored offsets flowing through reader state, `IncrementalSplit`, reassignment and the fetcher; the MySQL restore scenario with `exactly_once` and `incremental.parallelism = 2` covering both the pre-existing and the newly added table against the sink; and a test-visible hook in the fetcher test instead of reflection). So there is a single implementation path and no parallel fix is needed here.
That said, this is not fixed in `dev` yet. #12567 is still open and merge-blocked because its GitHub `Build` check is `ACTION_REQUIRED` rather than a completed run — GitHub could not detect a workflow run for the fork head.
Remaining asks on #12567:
- Sync the branch with current `dev` (`53733a112c9e935c5d97f7f24be249caa43b4fd5` was the baseline for the original analysis).
- Make sure Actions are enabled on the fork, then push a fresh head so the Build workflow actually runs.
- Once CI has a result for that head, request another review on #12567.
I'll keep this issue open until #12567 lands in `dev`. If you have a chance to run the restore scenario from that branch against your own reproduction, a short note here on whether the old-table change after the saved offset is now delivered would be a helpful extra data point.
<!-- streview-comment:1652 -->
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-6433551133
@DanielLeens I've opened #13006 for this as a focused replacement for #12567.
The restart position after a restore stays as it is on dev, at the earliest offset of the restored splits. On top of that, the enumerator now keeps each restored table's own offset and passes it in the rebuilt incremental split. The exactly-once filter starts every old table from that offset instead of dropping it for having no snapshot info. The offset also stays in the reader checkpoint until the stream has read past it, so restoring again in the middle of the replay keeps it.
Before and after, with MySQL, `exactly_once = true`:
1. Take a savepoint.
2. Add a third table.
3. Write 20 rows to an old table, some while the job is stopped and some while the new table is being snapshotted.
4. Restore.
| | Old table in the sink |
|---|---|
| dev | 109 of 129 rows; those 20 rows never arrive |
| with #13006 | 129 of 129, and an append-only copy of the sink (no primary key) shows no row twice |
For `incremental.parallelism > 1`, unit tests cover two restored splits at different offsets regrouped into one: no missing rows, and no replay before a table's own offset. The e2e has to use a single incremental split, because restoring a MySQL savepoint with more than one is rejected. Older checkpoints still restore.
@WXPNG, rechecking your old-table/new-table row counts against #13006 would be a useful second check.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-6082089195
Thanks for linking #12567. I re-read head `e18f31cfcf` against current `dev`. The three previously requested source-level points are now present in that head: table-specific restored offsets flow through reader state, `IncrementalSplit`, reassignment and the fetcher; the MySQL restore scenario enables `exactly_once` with `incremental.parallelism = 2`, adds the second table, mutates the pre-existing table, and compares both source tables with the sink; and the fetcher test uses a test-visible hook instead of reflection. The issue therefore has one implementation path, and those earlier code-review gaps do not require a parallel fix.
This is not fixed in `dev` yet. #12567 remains open and merge-blocked, and its GitHub `Build` check is `ACTION_REQUIRED`, not a successful build: the check reports that it could not detect a workflow run for the fork head. Please sync the branch with the current `dev`, ensure Actions are enabled for the fork, and push a fresh head that causes the Build workflow to run. Once GitHub CI has a result for that head, request another review on #12567. No issue metadata was changed here.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-6460543330
Thanks @goutamadwant for opening #13006 as the focused replacement for #12567 — that is exactly the path suggested above, and your description maps onto the restart-position points carried over from the earlier review: the per-table offset is kept by the enumerator, passed through the rebuilt incremental split, honored by the exactly-once filter, and retained in the reader checkpoint until the stream has read past it, with unit coverage for both missing rows and no replay before a table's own offset when two restored splits at different offsets are regrouped. The before/after MySQL numbers (109/129 on `dev` vs 129/129 with the fix, and no duplicates in the append-only copy) are a useful end-to-end signal, and the note that the e2e is limited to a single incremental split because restoring a MySQL savepoint with more than one is rejected is a reasonable explanation for why that part is covered at unit level.
I will do the detailed review on #13006 itself rather than here. Two remaining asks so I can line it up:
1. Please make sure GitHub CI has run on the final head of #13006 and request a review there once it has a result — I have not verified the current CI state of that PR in this thread, so I am not asserting one.
2. Please point out in the PR which unit tests cover the `incremental.parallelism > 1` missing/duplicate cases, so the regrouped-splits behavior can be checked against the exact tests.
@WXPNG, as goutamadwant suggested, rechecking your original old-table/new-table row counts against #13006 would give us an independent acceptance signal on top of the numbers above. Until #13006 is merged, this issue stays open; `dev` at `4f5e3293740` still does not contain the per-table restore-offset fix.
<!-- streview-comment:2094 -->
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "WXPNG (via GitHub)" <gi...@apache.org>.
WXPNG commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-6081029990
Thanks @DanielLeens and @SEZ9 for the detailed root-cause analysis — it matches what we reproduced. And thanks @Asthenia0412 for submitting the fix in #12567. Appreciate the quick response and support from everyone.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "WXPNG (via GitHub)" <gi...@apache.org>.
WXPNG commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-6407114019
Thanks @SEZ9 and @DanielLeens for the detailed root-cause analysis, and thanks @Asthenia0412 for the fix in #12567.
Got it — I understand the issue is being tracked and the fix is in progress in #12567. Thanks everyone for the quick response and support.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-5917739950
Classification: A / CDC base restore filtering and incremental delivery.
I checked current `dev` (`53733a112c9e935c5d97f7f24be249caa43b4fd5`). `IncrementalSourceStreamFetcher.configureFilter()` rebuilds per-table high-watermark state from `completedSnapshotSplitInfos`, while an empty set applies one startup offset to every captured table. That makes the serialized incremental-split contents the decisive evidence for this report; the configuration alone cannot prove which old-table records were filtered after the table list changed.
Before a production fix or `help wanted` decision, please provide a minimal MySQL CDC regression case that captures all of the following: the exact commit, the saved `IncrementalSplit` (table IDs, startup offset, completed-snapshot split high watermarks), the table-list change, and ordered source/sink records for both an old and the newly added table across the restore window. The assertion must demonstrate an old-table change after the saved offset is lost while the new-table snapshot succeeds. This will distinguish split-state reconstruction from a connector-specific offset or sink problem and give a testable acceptance boundary.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx closed issue #12565: [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint
URL: https://github.com/apache/seatunnel/issues/12565
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-6415643253
Thanks @WXPNG for following up. I need to correct the implementation status in the earlier replies: #12567 was closed by its author on 2026-10-15 **without merging**. Current `dev` (`4f5e3293740`) does not contain that per-table restore-offset fix. I am sorry the older “fix in progress in #12567” wording could now suggest an active PR.
I also checked open #11206: it addresses wildcard discovery of tables created while a job is running and the corresponding sink registration. It does not claim to fix this savepoint → add-table → restore case, where already-streaming tables can lose changes (and where an incorrect restart position can also replay them under `exactly_once`). This issue therefore stays open; I added `cdc`, `connectors-v2`, and `help wanted` after checking the current source, recent commits, and PRs.
A contributor can revive/rebase #12567 or open a focused replacement, but please carry forward the unresolved restart-position review from that PR: prove the old table's own checkpoint offset is retained through split reconstruction, assignment, and the fetcher, and cover both missing and duplicate records with `incremental.parallelism > 1`. Run GitHub CI on the final head and link the new PR here. If you can also recheck your original old-table/new-table row counts against it, that will give us an independent end-to-end acceptance signal.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-6431969718
@WXPNG just a quick note so nothing is left ambiguous: the status is unchanged since the correction above. The earlier PR was closed without merging, and current `dev` (`4f5e3293740`) still does not contain the per-table restore-offset fix, so the savepoint → add table → restore behavior you reported remains open.
If you or someone else is able to pick this up, please link the new PR here. Once a candidate exists, re-running your original old-table/new-table row-count check against it would give us a useful end-to-end acceptance signal alongside the tests.
<!-- streview-comment:2055 -->
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-5924350503
Thanks for the detailed report. Could you share the dev commit hash you reproduced on, and the enumerator/reader logs around restore (IncrementalSplitAssigner / IncrementalSplit start offset and the completed snapshot split watermarks) so we can confirm which offset was chosen as the incremental split start? Also a minimal reproduction (e.g. insert rows into t1 while t3 is being snapshotted) with the observed missing rows would help.
Root cause to verify in connector-cdc-base: when IncrementalSplitAssigner.createIncrementalSplits builds the single incremental split after restore, the start offset is derived from the min high watermark of the *current run's* completed snapshot splits (new tables), and the per-table filtering in the incremental fetch task (skip events before each table's high watermark) does not cover old tables that were already in the streaming phase. The start offset should instead be the min of (checkpointed stream offset of the previous incremental split, new tables' low/high watermarks), and old tables should be emitted from the checkpointed stream offset without watermark filtering.
A possible fix direction: when restoring, carry the previous IncrementalSplit's startupOffset/completed-table state into the new split (e.g. keep per-table completed snapshot info for already-streaming tables with their effective 'watermark' = checkpointed stream offset), and compute the split start as the minimum across old and new tables. A unit/e2e test in connector-cdc-mysql-e2e covering 'savepoint -> add table -> restore' with concurrent writes to old tables would prevent regressions. PRs welcome; please link this issue.
<!-- streview-comment:1452 -->
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [CDC Base] Incremental sync loses data for old tables when new tables are added and job restored from checkpoint/savepoint [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12565:
URL: https://github.com/apache/seatunnel/issues/12565#issuecomment-5946894190
Thanks for the detailed report. Following up on the earlier analysis: after a savepoint restore with newly added tables, the merged incremental split's start offset and per-table watermark filter appear to be derived only from the newly snapshotted tables, so tables that were already in the pure-increment phase can lose changes between the saved offset and the new tables' snapshot high watermark.
Looking at current `dev` (`53733a112c9e935c5d97f7f24be249caa43b4fd5`), `IncrementalSourceStreamFetcher.configureFilter()` rebuilds the per-table high-watermark state from `completedSnapshotSplitInfos`, and when that set is empty a single startup offset is applied to every captured table. That means the actual serialized incremental-split contents are what will decide whether this is a split-state reconstruction bug or something connector/sink specific — the job config alone can't tell us which old-table records were filtered once the table list changed.
To move this forward, could you provide a minimal MySQL CDC regression case covering:
1. The exact commit you reproduced on.
2. The saved `IncrementalSplit` after restore: table IDs, startup offset, and the completed-snapshot split high watermarks.
3. The table-list change you applied between savepoint and restore.
4. Ordered source and sink records for one old table and the newly added table across the restore window, with an assertion showing an old-table change after the saved offset is dropped while the new-table snapshot succeeds.
With that in hand we can confirm the root cause in the split-state reconstruction and define a testable acceptance boundary for the fix.
<!-- streview-comment:1473 -->
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org