You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "wuhainan (via GitHub)" <gi...@apache.org> on 2026/09/16 15:45:34 UTC
[I] [Bug][Connector-V2][MySQL-CDC] Adding a MySQL table when restoring from savepoint skips snapshot and crashes on binlog events [seatunnel]
wuhainan opened a new issue, #12348:
URL: https://github.com/apache/seatunnel/issues/12348
### 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
A MySQL-CDC multi-table job was restored from a savepoint after adding a new table, `alpha_online.accounts`.
The job configuration uses `startup.mode = initial`. The new table is discovered during restore, and the JobManager logs:
```log
SnapshotSplitAssigner created with remaining tables: [alpha_online.accounts]
```
However, the TaskManager restores an existing `incremental-split-0` containing only the previously configured tables. It does not contain `alpha_online.accounts`.
No snapshot split for `alpha_online.accounts` is assigned to or executed by the TaskManager. Therefore, the target table is created but receives no historical records.
After restore, the long-running incremental split and Debezium schema history still do not include `alpha_online.accounts`. When MySQL emits a binlog event for this new table, the source task fails with:
```log
io.debezium.DebeziumException:
Encountered change event for table alpha_online.accounts whose schema isn't known to this connector
```
The failure propagates through the CDC fetcher and causes the Flink job to restart repeatedly:
```log
java.lang.RuntimeException: One or more fetchers have encountered exception
Caused by: org.apache.kafka.connect.errors.ConnectException:
An exception occurred in the change event producer. This connector will be stopped.
```
With a failure-rate restart strategy configured as 10 failures within 300 seconds, the job eventually terminates with:
```log
Recovery is suppressed by FailureRateRestartBackoffTimeStrategy
```
The issue is therefore not only that the new table does not receive its initial snapshot. Adding a table and restoring from an existing savepoint also makes the existing CDC job unavailable as soon as binlog events for the new table arrive.
## Expected behavior
When a new table is added to a CDC job restored from a savepoint/checkpoint, SeaTunnel should initialize the new table's schema, execute its initial snapshot, and include it in subsequent incremental CDC processing while preserving the existing tables' restored offsets.
## Possible fix
The restore logic should treat a newly added table as a state migration, not only add it to `SnapshotPhaseState.remainingTables`.
A possible solution is:
1. During restore, detect tables present in the current configuration but absent from the restored source state.
2. Initialize Debezium schema metadata for each new table before consuming any binlog event for that table.
3. Schedule and assign snapshot splits for new tables even when a restored reader already owns a long-running `IncrementalSplit`.
4. After the new table snapshot finishes, atomically update or recreate the incremental split so that:
- its `tableIds` includes the new table;
- it contains the new table's snapshot watermark / offset information;
- its schema and history state includes the new table.
5. Preserve the restored offsets for existing tables. The new table must start from the snapshot-consistent binlog watermark, so that neither data loss nor duplicate events are introduced.
Please add integration tests for both savepoint and checkpoint recovery:
- Start a MySQL-CDC job with table A.
- Complete at least one checkpoint/savepoint.
- Add table B to the job configuration.
- Restore from the previous state.
- Verify that B receives an initial snapshot.
- Insert/update rows in B after restore.
- Verify that B continues to receive incremental changes.
- Verify that A continues from its original restored offset without duplicate snapshots.
### SeaTunnel Version
2.3.13
### SeaTunnel Config
```conf
env {
parallelism = 1
job.mode = "STREAMING"
job.name = "mysql2tidb_au_omnibus"
checkpoint.interval = 30000
checkpoint.timeout = 600000
checkpoint.mode = "EXACTLY_ONCE"
restart-strategy = "failure-rate"
restart-strategy.failure-rate.max-failures-per-interval = 10
restart-strategy.failure-rate.failure-rate-interval = "300 s"
restart-strategy.failure-rate.delay = "10 s"
}
source {
MySQL-CDC {
hostname = "<redacted>"
port = 3306
username = "<redacted>"
password = "<redacted>"
server-id = 6333
server-time-zone = "Asia/Shanghai"
startup.mode = "initial"
database-names = ["alpha_online"]
# Existing tables were already present when the savepoint was created.
# alpha_online.accounts was added after the savepoint was created.
table-names = [
"alpha_online.sub_account_applications",
"alpha_online.sub_account_profiles",
"alpha_online.deposit_application_plans",
"alpha_online.withdrawals",
"alpha_online.deposit_notices",
"alpha_online.position_transfer_requests",
"alpha_online.deposit_applications",
"alpha_online.account_profiles",
"alpha_online.accounts"
]
}
}
sink {
# JDBC / MultiTableSink configuration omitted because it is unrelated
# to the source failure. All credentials and addresses are redacted.
}
```
### Running Command
```shell
# The job is submitted by an internal platform using Flink YARN Application mode.
# The equivalent command is:
$FLINK_HOME/bin/flink run-application \
-t yarn-application \
-c org.apache.seatunnel.core.starter.flink.SeaTunnelFlink \
/path/to/seatunnel-flink-20-starter.jar \
--config /path/to/v2.conf
```
### Error Exception
```log
java.lang.RuntimeException: One or more fetchers have encountered exception
at org.apache.seatunnel.connectors.seatunnel.common.source.reader.fetcher.SplitFetcherManager.checkErrors(SplitFetcherManager.java:147)
...
Caused by: java.lang.RuntimeException:
SplitFetcher thread 0 received unexpected exception while polling the records
...
Caused by: org.apache.kafka.connect.errors.ConnectException:
An exception occurred in the change event producer. This connector will be stopped.
...
Caused by: io.debezium.DebeziumException: Error processing binlog event
...
Caused by: io.debezium.DebeziumException:
Encountered change event for table alpha_online.accounts
whose schema isn't known to this connector
at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.informAboutUnknownTableIfRequired(MySqlStreamingChangeEventSource.java:768)
...
The source task fails repeatedly after restoring from the savepoint.
Eventually Flink terminates the job:
org.apache.flink.runtime.JobException:
Recovery is suppressed by FailureRateRestartBackoffTimeStrategy(
failuresIntervalMS=300000,
backoffTimeMS=10000,
maxFailuresPerInterval=10
)
```
### Zeta or Flink or Spark Version
flink 1.20
### Java or Scala Version
java 17
### Screenshots
_No response_
### 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][Connector-V2][MySQL-CDC] Adding a MySQL table when restoring from savepoint skips snapshot and crashes on binlog events [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #12348:
URL: https://github.com/apache/seatunnel/issues/12348#issuecomment-6217826347
Classification: A / Connector-V2 MySQL-CDC savepoint recovery schema bootstrap.
Thank you for the careful 3.0.0 reproduction. The supplied trace establishes the failure before any sink assertion is needed: the enumerator recognizes table B as snapshot work, while the restored reader starts the A-only incremental split and then fails when B's TABLE_MAP event arrives without schema history.
I rechecked the current dev source and related work. There is no merged fix or open PR covering this exact configuration-change plus restore contract. #11206 concerns a different live-discovery path and is still open with a failed Build; the earlier #12567 PR is closed. The exactly-once=false line in this reproduction is important: it means this report proves the schema-bootstrap failure, but does not yet prove checkpoint-boundary delivery semantics.
Please keep a fix focused on the state migration. It must initialize B's schema/history and snapshot-consistent watermark before the restored incremental reader can consume B events; suppressing the TABLE_MAP event or merely adding B to an incremental split would risk loss.
The acceptance test should cover both savepoint and checkpoint restore: restore A from its saved offset, add B, verify B receives exactly one initial snapshot at a defined watermark, then verify B changes are consumed while A neither re-snapshots nor loses or replays its restored stream. Include an assertion for the configuration where connector exactly-once is actually enabled, and keep the currently demonstrated non-exactly-once failure as a separate regression case if its contract differs.
--
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][Connector-V2][MySQL-CDC] Adding a MySQL table when restoring from savepoint skips snapshot and crashes on binlog events [seatunnel]
Posted by "wuhainan (via GitHub)" <gi...@apache.org>.
wuhainan commented on issue #12348:
URL: https://github.com/apache/seatunnel/issues/12348#issuecomment-6210579647
> 3\. Thank you for the complete restore trace. **Classification: A / Connector-V2 MySQL-CDC recovery state migration.**
> This is not just a missing initial snapshot. A configuration-added table must be introduced into the restored schema, snapshot, watermark, and incremental-split state as one compatible migration; otherwise the already restored reader can receive a binlog event for a table whose Debezium schema was never initialized.
> I checked the current recovery paths and the related work. `BaseChangeStreamTableSourceFactory` restores checkpoint table structures, while `IncrementalSplitAssigner.addSplits()` only restores watermarks for table IDs present in the recovered incremental split. The existing [#11206](https://github.com/apache/seatunnel/pull/11206) work addresses runtime wildcard discovery in a running job; it does not prove the distinct A -> checkpoint/savepoint -> add B to configuration -> restore contract described here, and its Build is not green. I found no open PR that covers this root cause.
> Before any implementation, please make that exact sequence a deterministic MySQL CDC E2E regression: restore A from its saved offset; verify B gets one snapshot at a defined watermark; then verify B binlog updates are accepted while A neither re-snapshots nor loses/replays its restored stream. The test must run for both checkpoint and savepoint recovery. A patch that only adds B to an `IncrementalSplit` is not sufficient unless it also establishes B schema/history and the snapshot-consistent watermark before incremental consumption. No help-wanted or assignment decision is made in this round.
@DanielLeens I reproduced the same failure with SeaTunnel **3.0.0** using a minimal two-table test on 2026-10-16. The job fails immediately after adding table B to the configuration and restoring from the savepoint; no post-restore writes are needed to trigger it.
### Environment
- SeaTunnel: **3.0.0** (`seatunnel-flink-20-starter.jar`; connector stack traces also report 3.0.0).
- Flink: **1.20.0-h0.cbu.mrs.360.r18** (Huawei MRS distribution).
- Java: **17.0.18**.
- Deployment: **Flink YARN Application**, submitted through an internal platform.
- Source: MySQL CDC; target: TiDB through JDBC / MultiTableSink.
- Parallelism: **1**.
- `startup.mode = "initial"`.
- `schema-changes.enabled = true`.
- Configured checkpoint interval/timeout: **30000 / 600000 ms**.
- The parsed configuration contains `checkpoint.mode = "EXACTLY_ONCE"`, but the CDC fetcher logs **`exactly-once: false`**. I am reporting both values rather than assuming connector exactly-once was active.
- The effective Flink restart strategy is **3 fixed-delay retries, 10000 ms apart**, despite failure-rate settings appearing in the parsed SeaTunnel config.
This is a manual **savepoint recovery** reproduction. Checkpoint recovery and an automated E2E regression have not been verified in this test.
### Minimal reproduction
1. Create both source tables before the first job starts. B exists and contains historical rows, but is initially excluded from the capture list:
```sql
CREATE DATABASE st_restore_src;
CREATE TABLE st_restore_src.table_a (
id BIGINT NOT NULL PRIMARY KEY,
val VARCHAR(100) NOT NULL
);
CREATE TABLE st_restore_src.table_b (
id BIGINT NOT NULL PRIMARY KEY,
val VARCHAR(100) NOT NULL
);
INSERT INTO st_restore_src.table_a VALUES
(1, 'a_initial_1'),
(2, 'a_initial_2');
INSERT INTO st_restore_src.table_b VALUES
(1, 'b_history_1'),
(2, 'b_history_2');
```
2. Prepare the target database/tables:
```sql
CREATE DATABASE st_restore_dst;
CREATE TABLE st_restore_dst.table_a (
id BIGINT NOT NULL PRIMARY KEY,
val VARCHAR(100) NOT NULL
);
CREATE TABLE st_restore_dst.table_b (
id BIGINT NOT NULL PRIMARY KEY,
val VARCHAR(100) NOT NULL
);
```
3. Start a streaming MySQL-CDC job with only A:
```hocon
database-names = ["st_restore_src"]
table-names = ["st_restore_src.table_a"]
table-names-config = [
{ table = "st_restore_src.table_a", primaryKeys = ["id"] }
]
startup.mode = "initial"
schema-changes.enabled = true
```
The JDBC sink uses generated upsert SQL, target database `st_restore_dst`, and `table = "${table_name}"`.
4. Wait for A's initial data to arrive. Update/insert A, verify incremental synchronization, and wait for a successful checkpoint:
```sql
UPDATE st_restore_src.table_a
SET val = 'a_before_savepoint' WHERE id = 1;
INSERT INTO st_restore_src.table_a
VALUES (3, 'a_before_savepoint_3');
```
5. Stop the job with a savepoint through the platform and retain its path. This run subsequently restores **Savepoint 10**.
6. While the job is stopped, write changes to A and B:
```sql
UPDATE st_restore_src.table_a
SET val = 'a_changed_while_stopped' WHERE id = 1;
INSERT INTO st_restore_src.table_a
VALUES (4, 'a_inserted_while_stopped');
DELETE FROM st_restore_src.table_a WHERE id = 2;
INSERT INTO st_restore_src.table_b
VALUES (3, 'b_history_while_stopped');
```
7. Add B to the same source configuration and restore from the savepoint, retaining parallelism 1 and the same runtime:
```hocon
database-names = ["st_restore_src"]
table-names = [
"st_restore_src.table_a",
"st_restore_src.table_b"
]
table-names-config = [
{ table = "st_restore_src.table_a", primaryKeys = ["id"] },
{ table = "st_restore_src.table_b", primaryKeys = ["id"] }
]
startup.mode = "initial"
schema-changes.enabled = true
```
**The job fails at step 7**, before the post-restore DML checks can be performed. B already has a binlog event from step 6, so restoring the old stream is sufficient to trigger the failure.
### Key logs
The following excerpts are from the same run (timestamps UTC+8). Internal paths/addresses are redacted; the long incremental-split line is shortened.
**1. Flink restores the savepoint:**
```text
2026-10-16 15:13:39,458 INFO CheckpointCoordinator -
Restoring job ffffffffa8039e850000000000000000 from Savepoint 10 @ 0
for ffffffffa8039e850000000000000000 located at <savepoint-path>.
```
**2. The enumerator discovers B as a pending snapshot table:**
```text
2026-10-16 15:13:39,602 INFO SnapshotSplitAssigner -
SnapshotSplitAssigner created with remaining tables: [st_restore_src.table_b]
2026-10-16 15:13:39,603 INFO SnapshotSplitAssigner -
SnapshotSplitAssigner created with remaining splits: []
2026-10-16 15:13:39,603 INFO SnapshotSplitAssigner -
SnapshotSplitAssigner created with assigned splits: []
```
**3. The reader restores only A's incremental state and history:**
```text
2026-10-16 15:13:51,335 INFO IncrementalSourceReader -
subtask 0 add splits: incremental-split-0
2026-10-16 15:13:51,481 INFO IncrementalSourceReader -
The incremental split[incremental-split-0] has 1 checkpoint table(s) for restore:
[st_restore_src.table_a].
2026-10-16 15:13:51,482 INFO IncrementalSourceReader -
The incremental split[incremental-split-0] has checkpoint history table changes for restore.
2026-10-16 15:13:51,656 INFO IncrementalSourceStreamFetcher -
Start incremental read task for incremental split:
IncrementalSplit(
tableIds=[st_restore_src.table_a],
startupOffset={transaction_id=null, ts_sec=1792134501,
file=binlog.000459, pos=665187302, server_id=1},
...
completedSnapshotSplitInfos=[],
checkpointDataType=null,
checkpointTables=[...st_restore_src.table_a...],
historyTableChanges={st_restore_src.table_a=...}
) exactly-once: false
```
There is no B snapshot-split assignment/execution in the supplied TaskManager log before the failure.
**4. B's TABLE_MAP event causes the source to fail:**
```text
2026-10-16 15:13:51,755 ERROR MySqlStreamingChangeEventSource -
Encountered change event ... eventType=TABLE_MAP ...
database='st_restore_src', table='table_b' ...
for table st_restore_src.table_b whose schema isn't known to this connector.
2026-10-16 15:13:51,755 ERROR MySqlStreamingChangeEventSource -
Error during binlog processing.
Last offset stored = {transaction_id=null, ts_sec=1792134691,
file=binlog.000459, pos=733312178,
server_id=1, event=1},
binlog reader near position = binlog.000459/733312249
Caused by: io.debezium.DebeziumException:
Encountered change event for table st_restore_src.table_b
whose schema isn't known to this connector
```
**5. Retries hit the same event; the job ultimately fails:**
```text
2026-10-16 15:14:30,443 INFO ExecutionGraph -
Job mysql2tidb_multi_table_restart_from_savepoint_test
(ffffffffa8039e850000000000000000) switched from state RUNNING to FAILING.
org.apache.flink.runtime.JobException:
Recovery is suppressed by FixedDelayRestartBackoffTimeStrategy(
maxNumberRestartAttempts=3, backoffTimeMS=10000)
2026-10-16 15:14:30,455 INFO ExecutionGraph -
Job mysql2tidb_multi_table_restart_from_savepoint_test
(ffffffffa8039e850000000000000000) switched from state FAILING to FAILED.
```
### Expected vs. observed
Expected: A continues from its saved offset, including changes made while stopped; B receives its initial snapshot and then incremental changes.
Observed: the enumerator recognizes B, but the restored reader starts the old A-only incremental split, and processing B's binlog event fails because its schema is missing. This reproduces the recovery-state inconsistency described in this issue on 3.0.0.
The supplied logs establish the source failure. I have not included target row-count/data-loss assertions or claims of duplicate-free recovery, because those have not been independently verified for this failed run.
--
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][Connector-V2][MySQL-CDC] Adding a MySQL table when restoring from savepoint skips snapshot and crashes on binlog events [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #12348:
URL: https://github.com/apache/seatunnel/issues/12348#issuecomment-5714102369
Thank you for the complete restore trace. **Classification: A / Connector-V2 MySQL-CDC recovery state migration.**
This is not just a missing initial snapshot. A configuration-added table must be introduced into the restored schema, snapshot, watermark, and incremental-split state as one compatible migration; otherwise the already restored reader can receive a binlog event for a table whose Debezium schema was never initialized.
I checked the current recovery paths and the related work. `BaseChangeStreamTableSourceFactory` restores checkpoint table structures, while `IncrementalSplitAssigner.addSplits()` only restores watermarks for table IDs present in the recovered incremental split. The existing #11206 work addresses runtime wildcard discovery in a running job; it does not prove the distinct A -> checkpoint/savepoint -> add B to configuration -> restore contract described here, and its Build is not green. I found no open PR that covers this root cause.
Before any implementation, please make that exact sequence a deterministic MySQL CDC E2E regression: restore A from its saved offset; verify B gets one snapshot at a defined watermark; then verify B binlog updates are accepted while A neither re-snapshots nor loses/replays its restored stream. The test must run for both checkpoint and savepoint recovery. A patch that only adds B to an `IncrementalSplit` is not sufficient unless it also establishes B schema/history and the snapshot-consistent watermark before incremental consumption. No help-wanted or assignment decision is made in this round.
--
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