You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "Sephiroth1024 (via GitHub)" <gi...@apache.org> on 2026/02/06 08:35:38 UTC

[I] [Bug] [Zeta] the retry mechanism may have a serious bug [seatunnel]

Sephiroth1024 opened a new issue, #10461:
URL: https://github.com/apache/seatunnel/issues/10461

   ### 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
   
   Pre agreements:
   - Take MySQL as an example.
   - When we submit a job, seatunnel will query the current table structures in the target database and store them in `AbstractDebeziumDeserializationSchema#tableChangesStructMap`.
   Refer to it as `tableChangesStructMap`.
   - To be simplified, assume that the worker will perform the checkpoint(actually the master does).
   - Assume that there is a database and it has two tables, tb1 and tb2.
   
   1. Now we submit a job.
   
   <img width="544" height="572" alt="Image" src="https://github.com/user-attachments/assets/00d7b2bf-7787-404c-8d15-569525f1b02d" />
   
   2. Then a new table called tb3 is created.
   
   <img width="560" height="188" alt="Image" src="https://github.com/user-attachments/assets/31751204-d68d-4e36-9f13-b408bd370622" />
   
   3. Perform a checkpoint.
   
   <img width="1032" height="186" alt="Image" src="https://github.com/user-attachments/assets/83ece3ba-b838-4f5f-a475-66a4b20117d1" />
   
   4. The task failed for some reason and master will retry. And something is wrong because the master's `tableChangesStructMap` is an old version (the only time when master build `tableChangesStructMap` is when the job is submitted).
   
   <img width="542" height="406" alt="Image" src="https://github.com/user-attachments/assets/fc18adb3-7433-4e09-8936-9f75ce6e77de" />
   
   5. Perform a checkpoint. And the wrong table structures will be stored in the checkpoint file forever.
   
   <img width="1026" height="174" alt="Image" src="https://github.com/user-attachments/assets/d1374ee5-75ab-44e1-8d61-56b3195ee922" />
   
   
   It may cause some exceptions like `Can't obtain schema for table xxx`.
   
   It can also cause some debezium's exceptions like `Data row is smaller than a column index`. When the debezium starts, it will recover it's `DatabaseSchema`  from `DatabaseHistory`. The seatunnel's implementation is `EmbeddedDatabaseHistory`, and it will recover from the latest checkpoint.
   
   What kind of exceptions it may cause depends on what kind of DDL statements the database executes.
   
   ### SeaTunnel Version
   
   2.3.12
   
   ### SeaTunnel Config
   
   ```conf
   //
   ```
   
   ### Running Command
   
   ```shell
   //
   ```
   
   ### Error Exception
   
   ```log
   //
   ```
   
   ### Zeta or Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   _No response_
   
   ### 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] [Zeta] the retry mechanism may have a serious bug [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo closed issue #10461: [Bug] [Zeta] the retry mechanism may have a serious bug
URL: https://github.com/apache/seatunnel/issues/10461


-- 
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] [Zeta] the retry mechanism may have a serious bug [seatunnel]

Posted by "DanielCarter-stack (via GitHub)" <gi...@apache.org>.
DanielCarter-stack commented on issue #10461:
URL: https://github.com/apache/seatunnel/issues/10461#issuecomment-3859117935

   <!-- code-pr-reviewer -->
   Thanks for reporting this potential bug. The analysis suggests a real issue: when a Zeta CDC job restores from checkpoint after DDL changes occurred during execution, the master node's `tableChangesStructMap` in `AbstractDebeziumDeserializationSchema` may retain stale schema data, while workers have the updated map. This can cause `Can't obtain schema for table xxx` or `Data row is smaller than a column index` errors.
   
   **Key evidence:**
   - `tableChangesStructMap` is final and only initialized in constructor (`AbstractDebeziumDeserializationSchema.java:48-58`)
   - Workers dynamically add new schemas via `deserialize()` but master doesn't process data streams
   - Checkpoint stores worker's `historyTableChanges` (`IncrementalSourceReader.java:267-282`) but `restoreCheckpointProducedType` doesn't restore this map (`SeaTunnelRowDebeziumDeserializeSchema.java:295-324`)
   
   **To help verify:**
   1. Are you using Zeta engine with `exactly_once=true`?
   2. Did the DDL change occur between checkpoints before failure?
   3. Can you share the full exception stack trace?
   
   This would be a valuable contribution if confirmed. A possible fix could involve restoring `tableChangesStructMap` in the checkpoint recovery logic.


-- 
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] [Zeta] the retry mechanism may have a serious bug [seatunnel]

Posted by "nielifeng (via GitHub)" <gi...@apache.org>.
nielifeng commented on issue #10461:
URL: https://github.com/apache/seatunnel/issues/10461#issuecomment-5020733613

   I reproduced this issue on Zeta with a MySQL CDC streaming job and real Worker failures.
   
   Environment:
   
   - SeaTunnel `3.0.0-SNAPSHOT`, commit `46d2f3909f7e97f8f516c8fba68d12df471d7718`
   - MySQL 8.0.46
   - 3 Masters, 2 Workers, fixed slots
   - `MySQL-CDC -> Console` and `MySQL-CDC -> JDBC MySQL` were both tested
   
   Reproduction sequence:
   
   1. Start from a four-column table: `id, name, score, updated_at`.
   2. Start the CDC job and wait for normal checkpoints.
   3. Execute `ADD COLUMN email VARCHAR(128) AFTER name`.
   4. Confirm both schema-change-before and schema-change-after checkpoints complete.
   5. Kill the Worker running the source task.
   6. Insert a row containing the new `email` column after recovery.
   
   With the original code, the retry split contained five-column `checkpointTables` and nonempty `historyTableChanges`, but the reader skipped restoring them because `checkpointDataType` was null. The restored reader continued with the old four-column schema. After another retry, Debezium failed with conversion errors such as `Failed to properly convert data value`, followed by `Error during binlog processing` and `Producer failure`.
   
   There is also a second layer to the bug: restoring only the Debezium deserializer/table history is not sufficient. In that version, the first five-column row after recovery failed with:
   
   ```text
   java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4
   at SeaTunnelRowType.getFieldType
   at SeaTunnelRow.getBytesSize
   at SeaTunnelSourceCollector.collect
   ```
   
   The deserializer had correctly restored five columns, but `SeaTunnelSourceCollector` and the sink writer were still initialized from the original four-column DAG schema.
   
   The complete fix I validated does the following:
   
   1. Restore nonempty `checkpointTables` and `historyTableChanges` independently of the deprecated `checkpointDataType` field.
   2. Replace the stale Debezium history map with checkpoint history.
   3. Before the first restored data record, emit a dedicated runtime schema-restore event carrying the full checkpoint `CatalogTable`.
   4. Update source/sink runtime row types from that event.
   5. For JDBC sinks, rebuild the writer using the restored schema without applying physical DDL again.
   
   Real validation results:
   
   - Console path: two consecutive Worker failures and recoveries.
   - Both post-recovery rows retained their `email` values.
   - Final checkpoint counts before manual stop: triggered 139, completed 139, failed 0, restored 2.
   - JDBC MySQL path: target `ADD COLUMN` executed exactly once before failure.
   - On recovery JDBC logged that it restored runtime schema without applying physical DDL; no duplicate-column error occurred.
   - JDBC final checkpoint counts before manual stop: triggered 66, completed 66, failed 0, restored 1.
   - No `ArrayIndexOutOfBoundsException`, Debezium conversion error, `Producer failure`, or binlog processing error in either fixed run.
   - Full `connector-cdc-base` test suite: 66 tests passed.
   
   I have a source patch and can prepare a PR with the focused tests and the two real-test scenarios above.
   


-- 
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] [Zeta] the retry mechanism may have a serious bug [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10461:
URL: https://github.com/apache/seatunnel/issues/10461#issuecomment-5022488737

   The new Zeta failover reproduction confirms that this is a real CDC recovery bug, not only a theoretical stale-map risk.
   
   The evidence now isolates two separate restore gaps:
   
   1. nonempty `checkpointTables` and `historyTableChanges` can be skipped when the deprecated `checkpointDataType` field is null
   2. restoring Debezium history alone is insufficient because the source collector and downstream runtime writers can still retain the original DAG row type
   
   PR #11503 now covers this exact end-to-end path: restore checkpoint schema/history, propagate a dedicated runtime schema-restore event, and rebuild schema-aware sink state without applying the physical DDL a second time. The PR is open and mergeable; its current-head Build is still queued, so this issue should remain open through review and failover validation.
   
   Thank you for turning the report into a reproducible two-layer diagnosis and a focused fix.


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