Repository navigation
[Feature][Connector-V2][Flink-CDC] Add configurable schema change behavior policies - #11162
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for pushing this forward. I re-reviewed the latest head from the source-side schema-change resolver through the engine / Flink coordination path and into sink-side application. I found one real blocker plus one test gap that should be fixed before merge.
What this PR fixes
- User pain: Users need explicit schema-change behavior policies so CDC schema evolution can fail fast, ignore safe events, or evolve end to end in a controlled way.
- Fix approach: The PR introduces
SchemaChangeBehavior/SchemaChangePolicy, wires behavior through CDC source, engine, and Flink translation, and lets sinks validate schema-evolution support. - One-line summary: The design direction is good, but the current support check is too permissive for composite column-change events.
Runtime path I traced
CDC source parsing
-> AbstractSchemaChangeResolver batches all column changes from one DDL into one `AlterTableColumnsEvent`
Coordination path
-> Flink `SchemaOperator` validates the composite event
-> Engine `SinkFlowLifeCycle` validates the same composite event again
Policy check
-> `SchemaChangePolicy.isSupported()` returns true for `SCHEMA_CHANGE_UPDATE_COLUMNS` if the sink supports ANY one of ADD / DROP / UPDATE / RENAME / ALTER_COLUMN_COMMENT
Sink example
-> Elasticsearch only advertises `ADD_COLUMN`
-> its writer iterates sub-events and throws on non-ADD changes
Result
-> mixed DDL can pass the policy gate and only fail later inside the sink writer
Key findings
- This PR is on the normal schema-evolution path, not on a dormant edge path.
- The real risk is the composite
AlterTableColumnsEvent, not single add/drop/rename events. - The current policy check can green-light mixed DDL that the sink cannot actually apply.
Blocking items
- Composite
AlterTableColumnsEventis treated as supported when the sink supports only one sub-operation- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/schema/SchemaChangePolicy.java:85-90; seatunnel-api/src/main/java/org/apache/seatunnel/api/table/schema/event/AlterTableColumnsEvent.java:31-52; seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/schema/AbstractSchemaChangeResolver.java:110-145; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/flow/SinkFlowLifeCycle.java:305-310; seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/sink/ElasticsearchSink.java:110-112; seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/sink/ElasticsearchSinkWriter.java:135-180 - Why this is a problem: The source batches multiple column changes from one DDL into a single
AlterTableColumnsEvent, but the policy currently treats that composite event as supported if the sink supports any one column-change capability. - Risk: Mixed DDL can pass the policy gate in
EVOLVEmode and then fail later inside the sink writer. - Suggested fix: Validate composite events against the full set of sub-events, and only pass when the sink supports every sub-operation in the batch.
- Location:
- No regression test covers mixed composite column-change events against a partially supported sink
- Location:
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/task/SeaTunnelSourceCollectorSchemaChangePolicyTest.java:49-91; seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/test/java/org/apache/seatunnel/translation/flink/schema/SchemaOperatorTest.java:183-237 - Why this is a problem: Current tests cover strict/ignore and single-event behavior, but not the mixed composite-event case that exposes the policy gap.
- Risk: Without a regression test, this capability mismatch can easily reappear later.
- Suggested fix: Add at least one engine or Flink-level regression test where a partially supported sink receives a mixed
AlterTableColumnsEventand is rejected at the policy gate.
- Location:
Other review notes
- I like the overall architecture direction here. Once the composite-event capability check is tightened, this will be much easier to reason about end to end.
Compatibility and side effects
- Compatibility: The new config is backward compatible, but the capability check is currently too permissive for mixed DDL.
- Side effects: This is an architecture-level behavior risk rather than a simple performance issue: policy, coordination, and sink application can disagree on what “supported” means.
- Error handling / logging: Right now the failure is deferred to sink-application time instead of being rejected clearly at the policy gate.
- Tests: The new tests cover single-event behavior, but I did not find coverage for mixed composite column-change events against a partially supported sink.
- Docs: English and Chinese schema-evolution docs were updated and generally align with the code direction.
- CI: Some checks were still pending. The blocker above is source-level and reproducible from the current code path.
Merge verdict
- I like the overall direction, but the current
SCHEMA_CHANGE_UPDATE_COLUMNSsupport check is too permissive and can green-light mixed DDL that the sink cannot actually apply.
b0b1ff8 to
d14c96d
Compare
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the updates. I re-reviewed the latest head from the source-side schema-change resolver through the engine / Flink policy gate and into sink-side application again.
What this PR solves
- User pain: CDC schema evolution needs explicit behavior policies so source, coordination, and sink application all agree on what is supported end to end.
- Fix approach: the PR introduces
SchemaChangeBehavior/SchemaChangePolicyand wires them through the CDC source, engine, Flink translation, and sink side. - One-line summary: the previous Daniel blocker on composite
AlterTableColumnsEventsupport is fixed on the current head.
Runtime path I checked
CDC DDL parsing
-> AbstractSchemaChangeResolver
-> multiple column changes from one DDL become one AlterTableColumnsEvent
Policy gate
-> SchemaChangePolicy.isSupported() [SchemaChangePolicy.java:74-96]
-> SCHEMA_CHANGE_UPDATE_COLUMNS now requires all sub-events to be supported
Regression coverage
-> SchemaOperatorTest [SchemaOperatorTest.java:263-297]
-> SinkFlowLifeCycleSchemaChangePolicyTest [SinkFlowLifeCycleSchemaChangePolicyTest.java:85-117]
Findings
- The previous Daniel blocker on mixed composite events is closed on the current head.
- The latest tests now cover the exact partial-support case that used to slip through the policy gate.
- I do not see a reopened source-level blocker in this revision.
Tests / stability
- The new regression tests are pure in-memory policy tests and look structurally stable.
CI
- The latest Build is still red on the current head.
- From Daniel's side, the remaining gate is CI rather than a reopened source-path issue.
Merge conclusion
Conclusion: can merge after fixes
- Blocking items
- No new code-level blocker from Daniel's side.
- Please get the latest Build green.
- Suggested but non-blocking follow-up
- None from this round.
The main source-level blocker from my previous review is resolved on the current head.
d14c96d to
ccd9ca5
Compare
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update. I re-reviewed the latest head from the source-side schema-change resolver through the Flink / engine policy gate and into sink-side application again.
What changed since the last Daniel pass
- The current delta tightens
SchemaChangePolicy.isSupported()forAlterTableColumnsEventso the whole sub-event batch must be supported, not just any one sub-operation. - The latest head also adds focused regression coverage at both the engine gate and the Flink operator gate.
Runtime path I checked
CDC source DDL parsing
-> AbstractSchemaChangeResolver batches one DDL into one AlterTableColumnsEvent
Policy gate
-> SchemaChangePolicy.isSupported(...)
-> composite column-change event now requires every sub-event to be supported
Execution layers
-> SchemaOperator in Flink translation
-> SinkFlowLifeCycle in engine
-> both now reject the partial-support mixed event before writer apply
Findings
- The previous Daniel blocker on mixed composite
AlterTableColumnsEventsupport is closed on the current head. - The new regression tests in
SchemaOperatorTestandSinkFlowLifeCycleSchemaChangePolicyTestnow cover the exact partial-support case that used to slip through. - I do not see a reopened source-level blocker on the current revision.
CI
- The latest
Buildis still pending on the current head. - From Daniel's side, the remaining gate is CI completion rather than a reopened policy / runtime mismatch.
Conclusion: can merge after fixes
- Blocking items
- No new source-level blocker from Daniel's side on the current head.
- Please let the latest
Buildfinish cleanly.
- Suggested non-blocking follow-up
- None from this round.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the updates. I re-reviewed the latest head ccd9ca5c19 from source-side DDL parsing through the policy gate and into sink-side application again.
What this PR solves
- User pain: CDC schema evolution needs one consistent behavior policy end to end; otherwise source parsing, engine gating, translation, and sink application can disagree on what is actually supported.
- Fix approach: introduce
SchemaChangeBehavior/SchemaChangePolicy, wire them through source parsing, the Flink operator, the engine sink gate, and sink-side application, and add comment-event handling plus regression coverage. - One-line summary: the current head still keeps the earlier Daniel blocker closed, and I do not see a reopened source-level issue on this round.
Runtime path I checked
CDC DDL parsing
-> AbstractSchemaChangeResolver
-> schema change event normalization
Policy gate
-> SchemaChangePolicy.validateStrict / validateIgnore / validateSupported
-> Flink SchemaOperator
-> engine SinkFlowLifeCycle
Sink application
-> SupportSchemaEvolutionSinkWriter.applySchemaChange(...)
Findings
- The earlier composite
AlterTableColumnsEventpartial-support blocker remains fixed on the latest head. - The current resolver changes for comment-only DDLs and mixed comment/column DDLs do not reopen the previous policy-gate issue from Daniel's side.
- I do not see a new source-level blocker in the PR-owned files on this re-review.
Tests / stability
- The new policy tests are pure in-memory tests with no sleeps or external resources.
- The MySQL CDC E2E still uses explicit asynchronous assertions rather than fixed sleeps.
- Stability rating: Stable.
Compatibility
- No reopened API/config/default-value compatibility blocker from this round.
- The behavior-policy additions look backward compatible on the default path.
CI note
- The latest top-level
Buildis still queued, so the current head still lacks a final green integration signal. - Because this PR spans API, CDC source, engine, Flink translation, and E2E coverage, that full green build is still the remaining blocker for me.
Merge conclusion
Conclusion: can merge after fixes
- Blocking items
- Please wait for the latest
Buildto finish green.
- Suggested non-blocking follow-up
- None from this round.
From the full chain I traced, the current revision is still CI-gated rather than source-blocked.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update. I rechecked the current head ccd9ca5c19 from CDC DDL parsing through the policy gate and sink-side application again.
On my previous Daniel pass for this same revision, the only remaining blocker was the top-level Build result. That Build is now green on the unchanged head, and I do not see a reopened source-level issue on this revision.
Approving from Daniel's side.
|
Thanks for the update. I rechecked the current head against the latest
Because the PR is still behind the latest base, any CI result and merge gate signal here is mixed with upstream drift. The lowest-cost next step is to sync with the latest |
ccd9ca5 to
0f55ecd
Compare
SEZ9
left a comment
There was a problem hiding this comment.
Thanks for working on this. I re-reviewed the latest head 0f55ecd37e18 from scratch.
What this PR fixes
- User pain: With
schema-changes.enabled = true, users have no way to control what happens when a schema change event arrives — the job always attempts to evolve the sink, silently falls back to a deprecated no-op path for sinks that don't implementSupportSchemaEvolutionSinkWriter, and there is no fail-fast or drop-safely option for pipelines that treat the source schema as a fixed contract. - Fix approach: Introduce a
schema-changes.behaviorCDC source option with three policies (STRICT / EVOLVE / IGNORE) backed by a newSchemaChangeBehaviorenum, aSupportSchemaChangeBehaviorsource marker interface, and aSchemaChangePolicyutility that validates events before downstream coordination (validateStrict,validateIgnorewith anisSafeToIgnorerow-layout check,validateSupportedagainstSchemaChangeTypecapabilities);MultiTableSinkWriter.applySchemaChangenow throwsSinkWriterSchemaExceptioninstead of calling the deprecated fallback, new comment-relatedEventTypes are added, andColumn.copyWithCommentis implemented onPhysicalColumn/MetadataColumn. - One-line summary: The policy plumbing, API surface, and docs (en/zh behavior matrix) are in place and EVOLVE is a sensible default, but the removal of the deprecated sink fallback in
MultiTableSinkWriteris a silent breaking change needing a migration note, the base branch (#11025) must merge and be rebased first, and there are smaller gaps around Javadoc, the MySQL-CDC option table, and the fully-qualifiedSupportSchemaChangeBehaviorreference inSchemaChangePolicy.resolveBehavior.
Runtime chain I rechecked
CDC source reader emits SchemaChangeEvent
-> SchemaChangePolicy.resolveBehavior(source) SchemaChangePolicy.java:41 (checks instanceof SupportSchemaChangeBehavior, defaults to EVOLVE)
-> SchemaChangePolicy.validateStrict(behavior, event, jobId) SchemaChangePolicy.java:49 (STRICT: throw before downstream propagation)
-> SchemaChangePolicy.validateIgnore(behavior, event, jobId) SchemaChangePolicy.java:61 (IGNORE: isSafeToIgnore() gate on comment-only events, else fail fast)
-> SchemaChangePolicy.validateSupported(event, supportedTypes, jobId) SchemaChangePolicy.java:113 (EVOLVE: maps EventType -> SchemaChangeType incl. new SCHEMA_CHANGE_ALTER_TABLE_COMMENT / SCHEMA_CHANGE_ALTER_COLUMN_COMMENT; recurses into AlterTableColumnsEvent sub-events)
-> schema coordination path forwards event to sink
-> MultiTableSinkWriter.applySchemaChange(event) MultiTableSinkWriter.java:339
-> instanceof SupportSchemaEvolutionSinkWriter ? writer.applySchemaChange(event) MultiTableSinkWriter.java:343
-> else throw SinkWriterSchemaException(SCHEMA_EVENT_PROCESSING_FAILED) MultiTableSinkWriter.java:346 (previously fell back to deprecated SinkWriter.applySchemaChange — behavior change)
Findings
Issue 1: Removing the deprecated sink fallback in MultiTableSinkWriter is a breaking runtime behavior change that is not covered by an upgrade/migration note
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:346 - Why it matters: - Root cause: the previous code path
sinkWriterEntry.getValue().applySchemaChange(event)(the deprecated fallback for sinks that do not implementSupportSchemaEvolutionSinkWriter) was replaced with an unconditionalSinkWriterSchemaExceptionat seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:346. - Impact: any existing job running with
schema-changes.enabled = trueand a sink whose writer only implements the deprecatedapplySchemaChange(or the default no-op) will now fail at runtime after upgrading, even though the PR description states "Backward compatibility is preserved" andEVOLVE"preserves the closest semantics to the previous behavior". This affects Zeta and Flink pipelines equally because it is in the multi-table sink layer of seatunnel-api. - Fix: this change must be called out explicitly in the release notes / an upgrade section (e.g. a dedicated "Breaking changes" entry in the schema-evolution doc or the release changelog) listing which sink writers are affected and what users must do. Alternatively, keep the deprecated fallback for one more release with a WARN log and only fail under a stricter behavior, so the removal can be staged.
- Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:349 "Sink writer %s does not support schema evolution for event %s.",;docs/en/introduction/configuration/schema-evolution.md:62 | Sink does not support schema evolution | Not reached | Fail before deprecated sink fallback/default no-op handling | Not reached | - Suggested fix: Replacing the deprecated
applySchemaChangefallback with a hard failure is a user-visible breaking change: existing jobs withschema-changes.enabled = trueand a sink writer that has not migrated toSupportSchemaEvolutionSinkWriterwill now fail at runtime, contradicting the "backward compatibility is preserved" claim in the PR description. Please add an explicit breaking-change / upgrade note (release notes and the schema-evolution doc) listing affected sink writers, or keep the deprecated fallback for one more release behind a WARN log so removal can be staged. - Severity: High
Issue 2: Possible public API change in seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/schema/AbstractSchemaChangeResolver.java
- Location:
seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/schema/AbstractSchemaChangeResolver.java - Why it matters: A public/protected signature appears to be removed or changed. Verify backward compatibility for downstream connectors.
- Severity: High
Issue 3: New public API classes in seatunnel-api lack Javadoc
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SupportSchemaChangeBehavior.java:22 - Why it matters: - Root cause:
SupportSchemaChangeBehavior,SchemaChangeBehavior, andSchemaChangePolicyare new public types in the stableseatunnel-apimodule, but none of them carry class-level or method-level Javadoc; ASF headers are correctly present, but connector developers implementingSupportSchemaChangeBehaviorget no contract description. - Impact: this is public API that third-party connector authors will implement/consume; without Javadoc explaining when
getSchemaChangeBehavior()is consulted (engine side, per-event) and the exact semantics ofSTRICT/EVOLVE/IGNORE(which are carefully specified in the docs but not in code), implementations will drift from the documented behavior matrix. - Fix: add class-level Javadoc to
SupportSchemaChangeBehaviordescribing the marker-interface contract and default resolution toEVOLVE, enum-constant Javadoc onSchemaChangeBehaviormirroring the doc table, and method Javadoc on theSchemaChangePolicystatic helpers (resolveBehavior,validateStrict,validateIgnore,validateSupported). - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/schema/SchemaChangeBehavior.java:20 public enum SchemaChangeBehavior {;seatunnel-api/src/main/java/org/apache/seatunnel/api/table/schema/SchemaChangePolicy.java:29 public final class SchemaChangePolicy { - Suggested fix: Since this is new public API in
seatunnel-apithat connector authors will implement, please add class-level Javadoc describing the contract: who callsgetSchemaChangeBehavior(), when it is evaluated, and that sources not implementing this interface default toEVOLVE(perSchemaChangePolicy.resolveBehavior). The same applies toSchemaChangeBehavior(per-constant docs matching the behavior matrix in the docs) and the static helpers inSchemaChangePolicy. - Severity: Medium
Issue 4: New user-facing option schema-changes.behavior is not documented in the MySQL-CDC connector option table
- Location:
docs/en/introduction/configuration/schema-evolution.md:43 - Why it matters: - Root cause: the option is added to
SourceOptions.java(connector-cdc-base) and wired intoMySqlIncrementalSourceFactory, but the changed-files list only includesdocs/en/introduction/configuration/schema-evolution.mdand its zh counterpart — the connector reference pagedocs/en/connector-v2/source/MySQL-CDC.md(and zh version), where users look up all source options, is not updated. - Impact: users browsing the MySQL-CDC option table will not discover
schema-changes.behavior, its allowed values (strict/evolve/ignore), or its default (evolve), which undermines the discoverability of this new feature and is inconsistent with howschema-changes.enabledis documented today. - Fix: add a row for
schema-changes.behavior(type: enum, default:evolve, requiresschema-changes.enabled = true) to the options table indocs/en/connector-v2/source/MySQL-CDC.mdanddocs/zh/connector-v2/source/MySQL-CDC.md, with a link to the schema-evolution page for the behavior matrix. - Evidence:
docs/en/introduction/configuration/schema-evolution.md:87 schema-changes.behavior = evolve - Suggested fix: Nice write-up of the behavior matrix here. However, since
schema-changes.behavioris a new user-facing source option exposed viaMySqlIncrementalSourceFactory, it also needs a row in the option tables ofdocs/en/connector-v2/source/MySQL-CDC.mdanddocs/zh/connector-v2/source/MySQL-CDC.md(type, defaultevolve, dependency onschema-changes.enabled = true), with a link back to this page. Users typically look up options on the connector reference page, not the introduction docs. - Severity: Medium
Issue 5: Fully-qualified class name used inline in SchemaChangePolicy instead of an import
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/schema/SchemaChangePolicy.java:34 - Why it matters: - Root cause:
resolveBehaviorreferencesorg.apache.seatunnel.api.source.SupportSchemaChangeBehaviorwith its fully qualified name twice, while all other types in the file use regular imports; there is no name clash that would require FQN usage here. - Impact: purely readability/consistency — it deviates from the import style used everywhere else in
seatunnel-apiand makes the instanceof check harder to read. - Fix: add
import org.apache.seatunnel.api.source.SupportSchemaChangeBehavior;and use the simple name in both theinstanceofcheck and the cast. Also, the imported-but-apparently-only-conditionally-usedSchemaEvolutionException/TableIdentifierimports should be double-checked by spotless/checkstyle for unused imports. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/schema/SchemaChangePolicy.java:35 return ((org.apache.seatunnel.api.source.SupportSchemaChangeBehavior) source) - Suggested fix: Nit: please import
org.apache.seatunnel.api.source.SupportSchemaChangeBehaviorand use the simple name here instead of the fully qualified name in both theinstanceofand the cast — there's no name clash, and this keeps the file consistent with the import style used elsewhere inseatunnel-api. - Severity: Low
Issue 6: Chinese schema-evolution doc uses English section headings
- Location:
docs/zh/introduction/configuration/schema-evolution.md:43 - Why it matters: - Root cause: the newly added section in
docs/zh/introduction/configuration/schema-evolution.mdkeeps the English heading## Schema change behaviorwhile the surrounding zh document uses Chinese headings (e.g.## 启用Schema evolution功能). - Impact: minor inconsistency in the localized docs; Chinese readers navigating the table of contents will see mixed-language headings, and the zh/en heading anchors diverge from the file's established style.
- Fix: translate the heading to something like
## Schema 变更行为策略(and行为矩阵is already correctly localized below), keeping code literals likeschema-changes.behavioruntranslated. - Evidence:
docs/zh/introduction/configuration/schema-evolution.md:45 CDC Source 在配置schema-changes.enabled = true时,可以继续配置schema-changes.behavior。 - Suggested fix: Nit: the surrounding zh doc uses Chinese section headings (e.g.
## 启用Schema evolution功能), so this new heading should be localized too, e.g.## Schema 变更行为策略, while keeping option names likeschema-changes.behaviorin code form. - Severity: Low
Review conclusion
Conclusion: can merge after the blocking items are fixed
1. Blocking items
- Issue 1: Removing the deprecated sink fallback in MultiTableSinkWriter is a breaking runtime behavior change that is not covered by an upgrade/migration note
- Issue 2: Possible public API change in seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/schema/AbstractSchemaChangeResolver.java
2. Suggested (non-blocking) follow-ups
- Issue 3: New public API classes in seatunnel-api lack Javadoc
- Issue 4: New user-facing option
schema-changes.behavioris not documented in the MySQL-CDC connector option table - Issue 5: Fully-qualified class name used inline in SchemaChangePolicy instead of an import
- Issue 6: Chinese schema-evolution doc uses English section headings
Nice progress overall — once the blocking points above are addressed this should be in good shape. Happy to discuss.
0f55ecd to
1518ef5
Compare
SEZ9
left a comment
There was a problem hiding this comment.
Thanks for working on this. I re-reviewed the latest head 1518ef588a35 from scratch.
What this PR fixes
- User pain: With
schema-changes.enabled = true, users have no way to control what happens when a schema change event arrives — every event is blindly forwarded into schema coordination, and sinks that only carry the deprecated no-opSinkWriter.applySchemaChangesilently swallow the change, leaving source and sink schemas divergent with no failure signal (#11043). - Fix approach: Introduce a
schema-changes.behavioroption (STRICT / EVOLVE / IGNORE) enforced in the CDC source's schema-change resolution path before downstream coordination, addSCHEMA_CHANGE_ALTER_TABLE_COMMENT/SCHEMA_CHANGE_ALTER_COLUMN_COMMENTevent types so IGNORE can distinguish safe-to-drop metadata changes from row-layout mutations, and hardenMultiTableSinkWriterto requireSupportSchemaEvolutionSinkWriter(throwingSinkWriterSchemaExceptionwithSchemaEvolutionErrorCodeinstead of falling back to the deprecated no-op). - One-line summary: The policy plumbing, MySQL/Oracle resolver changes, docs (EN/ZH incl. incompatible-changes entries), and unit tests are in place and the design is sound, but the PR is stacked on unmerged #11025 pending rebase, and I have concerns about the un-gated removal of the deprecated sink fallback under the default EVOLVE behavior, the mid-enum insertion in
EventTypeshiftingLIFECYCLE_*ordinals, the docs not enumerating which events IGNORE actually tolerates, and missing E2E coverage for the evolve-mode fail-fast on non-evolving sinks.
Runtime chain I rechecked
MySqlSchemaChangeResolver.resolve(ddl) MySqlSchemaChangeResolver.java
-> CustomMySqlAntlrDdlParser parses DDL, classifies event incl. new comment-only types CustomMySqlAntlrDdlParser.java
-> AbstractSchemaChangeResolver applies schema-changes.behavior policy AbstractSchemaChangeResolver.java
STRICT -> throw before emitting event downstream
IGNORE -> drop event iff EventType is SCHEMA_CHANGE_ALTER_TABLE_COMMENT / SCHEMA_CHANGE_ALTER_COLUMN_COMMENT (EventType.java:25-29), else fail fast
EVOLVE -> emit SchemaChangeEvent into normal schema coordination path
-> SchemaChangeEvent propagated to sink task
-> MultiTableSinkWriter.applySchemaChange(event) MultiTableSinkWriter.java:~26-30 (imports SchemaEvolutionErrorCode, SinkWriterSchemaException)
writer instanceof SupportSchemaEvolutionSinkWriter -> writer.applySchemaChange(event)
else -> throw SinkWriterSchemaException(SchemaEvolutionErrorCode) — deprecated SinkWriter.applySchemaChange fallback no longer invoked
Findings
Issue 1: Hard removal of the deprecated SinkWriter.applySchemaChange fallback in MultiTableSinkWriter turns previously-working jobs into runtime failures after upgrade
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:30 - Why it matters: - Root cause:
MultiTableSinkWriternow throws aSinkWriterSchemaException(new imports ofSchemaEvolutionErrorCode/SinkWriterSchemaExceptionadded in this PR) whenever a schema change event reaches a writer that does not implementSupportSchemaEvolutionSinkWriter, and the deprecatedSinkWriter.applySchemaChangefallback — including its default no-op — is no longer invoked. - Impact: any existing CDC job with
schema-changes.enabled = truethat runs against a sink writer relying on the deprecated method (or the harmless no-op default) will run fine until the first DDL arrives, then fail hard at an unpredictable point mid-stream. BecauseEVOLVEis the implicit default of the newschema-changes.behavior, users get this breaking behavior without changing any config. This is a runtime break, not a compile-time one, so it will not surface until production traffic hits it. - Fix: keep a one-release deprecation window — e.g. log a WARN and fall back to the deprecated method when the writer implements it (only failing on the pure no-op default), or gate the strict behavior behind the new
schema-changes.behavioroption soevolveon legacy writers degrades gracefully. At minimum, make the thrownSinkWriterSchemaExceptionmessage name the offending sink/table and point toSupportSchemaEvolutionSinkWriterand theschema-changes.behavior = ignore/schema-changes.enabled = falsemitigations, matching the migration guide added in the docs. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:30 import org.apache.seatunnel.api.table.schema.exception.SinkWriterSchemaException;;docs/en/introduction/concepts/incompatible-changes.md:96SinkWriter.applySchemaChangefallback, including the default no-op implementation, is no longer used.;docs/en/introduction/concepts/incompatible-changes.md:95SinkWriter.applySchemaChangefallback, including the default no-op implementation, is no longer used. - Suggested fix: Dropping the deprecated
SinkWriter.applySchemaChangefallback here means every existing CDC job withschema-changes.enabled = trueagainst a legacy sink writer will now fail at runtime the first time a DDL event arrives — withevolvebeing the default, users hit this without touching their config. I'd like us to either keep a WARN-logged fallback for writers that explicitly override the deprecated method for one release, or at minimum make theSinkWriterSchemaExceptionmessage here include the sink/table identifier and the concrete migration options (SupportSchemaEvolutionSinkWriter,schema-changes.behavior = ignore, or disablingschema-changes.enabled) so operators can act without digging through the incompatible-changes doc. - Severity: High
Issue 2: Newly emitted comment-only events (ALTER_TABLE_COMMENT / ALTER_COLUMN_COMMENT) are fatal under the default EVOLVE policy when the sink cannot apply them
- Location:
docs/en/introduction/configuration/schema-evolution.md:60 - Why it matters: - Root cause: this PR starts emitting two brand-new schema change event types (
AlterTableCommentEvent,AlterColumnCommentEventviaCustomAlterTableParserListener), and the documented EVOLVE contract makes any unsupported event type fatal ("Unsupported event types ... are fatal", matrix row "Fail before sink-side apply"). - Impact: a completely benign
ALTER TABLE ... COMMENT '...'or column comment change on the source MySQL database — an operation DBAs run routinely and that does not alter the row layout — will now kill every long-running CDC job whose sink writer does not implement handling for these new event types. Existing jobs withschema-changes.enabled = trueupgrade straight into this failure mode because EVOLVE is the default. This is exactly the "happy-path-only" gap: no existing sink in the codebase implemented these event types before this PR. - Fix: comment-only events are by definition safe to ignore for row encoding; under EVOLVE they should be downgraded to a WARN + drop (or auto-routed through the same safe-ignore path used by IGNORE) when the sink does not support them, instead of failing the job. Alternatively, exclude comment event types from emission unless the user explicitly opts in via
schema-changes.include. - Evidence:
docs/en/introduction/configuration/schema-evolution.md:60 | Source emits unsupported schema change type | Fail before downstream propagation | Fail before sink-side apply | Fail unless the event is safe to ignore | - Suggested fix: With this matrix, the new comment-only events (
AlterTableCommentEvent/AlterColumnCommentEvent) become fatal under the defaultevolvepolicy for any sink that does not handle them — meaning a routineALTER TABLE ... COMMENTon the source will kill a running CDC job after upgrade. Since comment changes cannot affect the row encoding, please treat them as safe-to-ignore (WARN + drop) underevolvewhen the sink does not support them, or exclude them from emission by default. - Severity: High
Issue 3: Possible public API change in seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/schema/AbstractSchemaChangeResolver.java
- Location:
seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/schema/AbstractSchemaChangeResolver.java - Why it matters: A public/protected signature appears to be removed or changed. Verify backward compatibility for downstream connectors.
- Evidence:
seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/test/java/org/apache/seatunnel/connectors/cdc/base/schema/AbstractSchemaChangeResolverTest.java;seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/MySqlSchemaChangeResolver.java;seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/parser/CustomMySqlAntlrDdlParser.java - Severity: High
Issue 4: STRICT/IGNORE fail-fast creates an unrecoverable checkpoint-restart loop with no documented recovery path
- Location:
docs/en/introduction/configuration/schema-evolution.md:51 - Why it matters: - Root cause: the STRICT contract fails the job "as soon as a schema change event is observed", and IGNORE fails fast for non-safe events. In a streaming CDC job the offending DDL event sits at a fixed binlog position: after the engine (Zeta/Flink) restores from the last checkpoint, the exact same event is replayed and the job fails again, deterministically, forever.
- Impact: with cluster-level restart strategies enabled, users get an infinite crash loop that burns resources and floods logs; there is no way to make progress without manual intervention, and the docs added in this PR do not tell users what that intervention is (change
schema-changes.behavior, disableschema-changes.enabled, or discard state and re-snapshot). - Fix: document the recovery procedure explicitly in the new "Schema change behavior" section, and ensure the exception thrown on the STRICT/IGNORE path carries the table identifier, event type, and binlog offset so operators can decide quickly. Also verify the failure is raised before the offset for that event is committed to checkpoint state, so switching the policy and restarting actually reprocesses (or skips) the event consistently.
- Evidence:
docs/en/introduction/configuration/schema-evolution.md:53 |ignore| Consume the schema change event and drop it before downstream schema coordination and sink-side schema evolution. The job continues only for schema changes that can be safely ignored by the current row encoding; otherwise it fails fast. |;docs/en/introduction/configuration/schema-evolution.md:61 | Source emits unsupported schema change type | Fail before downstream propagation | Fail before sink-side apply | Fail unless the event is safe to ignore | - Suggested fix: A STRICT (or non-safe IGNORE) failure is deterministic on replay: after restore from the last checkpoint the same DDL event is consumed again and the job fails again, producing an endless restart loop under any restart strategy. Please add a "recovery" paragraph here explaining what the operator must do (switch
schema-changes.behavior, disableschema-changes.enabled, or reset state), and make sure the thrown exception includes the table path, event type, and source offset so the loop is diagnosable. - Severity: Medium
Issue 5: New EventType constants are inserted mid-enum, shifting the ordinals of all LIFECYCLE_ values*
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/event/EventType.java:29 - Why it matters: - Root cause:
SCHEMA_CHANGE_ALTER_TABLE_COMMENTandSCHEMA_CHANGE_ALTER_COLUMN_COMMENTare inserted afterSCHEMA_CHANGE_RENAME_TABLEand beforeLIFECYCLE_ENUMERATOR_OPEN, which changes the ordinal of every subsequent constant inorg.apache.seatunnel.api.event.EventType. - Impact: standard Java enum serialization is name-based and safe, but any ordinal-based encoding of
EventType— e.g. custom event serializers in the Zeta event-reporting path, metrics wire formats, or persisted event records read back after an upgrade — would silently mapLIFECYCLE_ENUMERATOR_OPENand later values to the wrong constant during a mixed-version rolling upgrade of cluster nodes. - Fix: append the two new constants at the end of the enum instead of inserting them mid-list; that is zero-cost here and removes the entire class of ordinal-drift bugs. If mid-list insertion is intentional for grouping, confirm that no serializer or protocol in seatunnel-engine encodes
EventTypeby ordinal and note that guarantee in a comment on the enum. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/event/EventType.java:29 SCHEMA_CHANGE_ALTER_COLUMN_COMMENT, - Suggested fix: Inserting
SCHEMA_CHANGE_ALTER_TABLE_COMMENT/SCHEMA_CHANGE_ALTER_COLUMN_COMMENTin the middle of the enum shifts the ordinals of allLIFECYCLE_*constants. Java's built-in enum serialization is name-based, but if any Zeta event-reporting serializer or persisted format encodesEventTypeby ordinal, a mixed-version cluster would decode lifecycle events as the wrong type. Please append these two constants at the end of the enum — it costs nothing and eliminates the ordinal-drift risk entirely. - Severity: Medium
Issue 6: E2E coverage exercises strict and ignore but no E2E asserts the new fail-fast path for sinks lacking SupportSchemaEvolutionSinkWriter under evolve
- Location:
docs/en/introduction/configuration/schema-evolution.md:63 - Why it matters: - Root cause: the added E2E tests (
testMysqlCDCWithSchemaChangeIgnore,testMysqlCDCWithSchemaChangeStrict, plus the Flink variants) cover the newstrict/ignorepolicies, and unit tests (SinkFlowLifeCycleSchemaChangePolicyTest,FlinkSinkWriterTest) cover writer-level behavior, but there is no end-to-end test proving that anevolve-mode job against a legacy sink writer (deprecatedapplySchemaChangeonly) fails with the newSinkWriterSchemaExceptionand a diagnosable message. - Impact: this is precisely the breaking path documented in
incompatible-changes.md; without an integration-level assertion, a future refactor could silently reintroduce the no-op fallback or degrade the error message, and the documented contract would drift from reality. - Fix: add an E2E (or at least a multi-table-sink integration test on Zeta) that wires a sink writer implementing only the deprecated method, sends one DDL through
evolvemode, and asserts the job fails withSchemaEvolutionErrorCodeand that the message names the offending sink/table. - Evidence:
docs/en/introduction/configuration/schema-evolution.md:63 | Sink does not support schema evolution | Not reached | Fail before deprecated sink fallback/default no-op handling | Not reached | - Suggested fix: This row documents the most impactful new failure mode (
evolve+ sink withoutSupportSchemaEvolutionSinkWriter→ fail before the deprecated fallback), but I don't see an E2E/integration test that asserts it — the new E2E cases coverstrictandignoreonly. Please add a test that runs a legacy sink writer (deprecatedapplySchemaChangeonly) throughevolvemode and asserts the job fails withSchemaEvolutionErrorCodeand an actionable message, so this documented contract stays enforced. - Severity: Low
Review conclusion
Conclusion: can merge after the blocking items are fixed
1. Blocking items
- Issue 1: Hard removal of the deprecated SinkWriter.applySchemaChange fallback in MultiTableSinkWriter turns previously-working jobs into runtime failures after upgrade
- Issue 2: Newly emitted comment-only events (ALTER_TABLE_COMMENT / ALTER_COLUMN_COMMENT) are fatal under the default EVOLVE policy when the sink cannot apply them
- Issue 3: Possible public API change in seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/schema/AbstractSchemaChangeResolver.java
2. Suggested (non-blocking) follow-ups
- Issue 4: STRICT/IGNORE fail-fast creates an unrecoverable checkpoint-restart loop with no documented recovery path
- Issue 5: New EventType constants are inserted mid-enum, shifting the ordinals of all LIFECYCLE_* values
- Issue 6: E2E coverage exercises
strictandignorebut no E2E asserts the new fail-fast path for sinks lacking SupportSchemaEvolutionSinkWriter underevolve
Nice progress overall — once the blocking points above are addressed this should be in good shape. Happy to discuss.
7b2d8ff to
8ad87de
Compare
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update. I re-reviewed the latest head 8ad87de9 from the CDC schema-change resolver through the Zeta and Flink policy gates and into sink-side apply.
First, one important gate update: my earlier comment said this branch needed to sync with the latest dev. That CI / merge-gate fact is now stale. I checked the current head against dev again, and the branch is now ahead with behind_by=0.
Runtime path I checked
CDC DDL reaches Debezium
-> SeaTunnelRowDebeziumDeserializeSchema.deserialize()
-> deserializeSchemaChangeRecord()
-> SchemaChangeResolver.resolve()
-> AbstractSchemaChangeResolver.resolve()
-> comment-only DDL becomes AlterTableCommentEvent / AlterColumnCommentEvent
-> column DDL is batched as AlterTableColumnsEvent
-> schemaChangeEventFilter.filter()
-> tableSchemaChangeHandler.apply()
-> collector.collect(schemaChangeEvent)
Zeta path
-> SourceSeaTunnelTask.init()
-> SchemaChangePolicy.resolveBehavior(source)
-> new SeaTunnelSourceCollector(..., schemaChangeBehavior)
-> SeaTunnelSourceCollector.collect(SchemaChangeEvent)
-> validateStrict()
-> validateIgnore()
-> IGNORE drops only safe comment-only events
-> EVOLVE updates the runtime row type and forwards the event
-> SinkFlowLifeCycle.received()
-> processSchemaChangeEvent()
-> sink must advertise schema evolution support for row-layout changes
-> SchemaChangePolicy.validateSupported()
-> writer must implement SupportSchemaEvolutionSinkWriter, or explicitly override the deprecated compatibility method
Flink path
-> SchemaOperator.processElement()
-> handleSchemaChangeDetected()
-> validateStrict / validateIgnore / validateSupported
-> checkpoint-delayed broadcast of the schema event
-> FlinkSinkWriter.handleSchemaChangeEvent()
-> validateSupported()
-> SupportSchemaEvolutionSinkWriter.applySchemaChange()
-> LocalSchemaCoordinator reports success / failure
Findings
I do not see a new source-side blocker in this version.
The previous Daniel concern around composite AlterTableColumnsEvent support remains closed: SchemaChangePolicy.isSupported() now requires every sub-event in the composite event to be supported, so a mixed ADD + DROP DDL cannot pass just because one sub-event matches the sink capability list.
I also checked the new behavior contract:
STRICTfails before downstream schema coordination or sink-side mutation.IGNOREonly drops safe comment-only events; row-layout changes still fail fast.EVOLVEkeeps the normal schema coordination path, but unsupported row-layout changes and unsupported writers now fail instead of silently inheriting the default no-op.- The docs explain the new
schema-changes.behavioroption, the behavior matrix, and the sink-writer migration note.
Test stability
The unit tests are stable from a review perspective: they are deterministic policy / operator / lifecycle tests and do not rely on sleeps, local ports, system time, or external services.
The E2E additions use Awaitility-style condition waits rather than fixed sleeps. They still live inside the existing ordered MySQL CDC E2E workflow, but I do not see a new high-risk flaky-test pattern introduced by this PR.
CI / merge gate
The remaining gate is the current Build check:
- Check run: https://github.com/apache/seatunnel/runs/90584231385
- Current state observed by Daniel:
queued - Branch relation to
dev:ahead,behind_by=0
So the previous sync-first instruction is no longer the right next step. At this point, please wait for the queued Build to finish. If it fails, please share the fresh failing lane link and I can help narrow it down from that updated signal.
Merge conclusion
Conclusion: can merge
- Blockers that must be fixed
No source-level blocker from my side on the latest head.
The only remaining gate is the queued GitHub Build check above.
- Non-blocking suggestions
No additional source changes requested.
Overall, this is a good direction: the schema-change behavior is now expressed as a source-side contract, enforced consistently in Zeta and Flink, and checked against sink capabilities before writer apply. I am comfortable with the source changes once the GitHub gate is green.
|
Thanks for your contribution for Apache SeaTunnel. To facilitate focused communication among contributors, we’ve created a brand-new dedicated #contributors channel in official Slack workspace. This channel is designed for technical discussions, feature design brainstorming, roadmap sync and direct communication with project core Contributors. Everyone who contributes code, docs, test cases or community ideas is warmly invited to join, share thoughts and collaborate together under The Apache Way. Welcome to join us😄 |
8ad87de to
b0258b8
Compare
DanielLeens
left a comment
There was a problem hiding this comment.
CI was previously the only remaining blocker; CI is now passing, so the conclusion is being changed to approve.
Re-checked live state for head a9ff9f8d2455b6ff59fbc370f41367b6d67fd662 (unchanged since my last review): the fork's Build run (32838163367) has now completed with a full green result — every job succeeded, no failures or cancellations anywhere in the run. At the time of my last review this was still pending, which was the only thing separating this PR from merge on my side.
For completeness, since @SEZ9 posted a detailed round of feedback on 2026-08-23 (Issues 1-8) between my two most recent reviews: Issue 1 (default EVOLVE turning the inherited no-op into a hard failure with no opt-out) and Issue 2 (checkpoint-replay infinite-restart-loop risk) were the two substantive concerns raised there. Both are covered by the fixes I re-verified from source in my 2026-08-25 review — the inherited-no-op case now gets a one-release WARN-and-drop compatibility window instead of a hard failure (closing Issue 1), and the sink-side unsupported-sink throw now goes through SchemaChangePolicy's NonRetryableException path so a restart correctly goes to FAILED instead of looping (closing Issue 2, alongside the pre-existing STRICT/IGNORE source-side gate protection I traced end-to-end and confirmed was already sound). SEZ9's remaining items (3-8) were explicitly logged as non-blocking follow-ups in their own review, consistent with my assessment.
Nothing else has changed since my last pass. Moving this to approved.
|
Updated this branch in e9c5231 with the current dev merge and the compatibility/coordination corrections found during the full re-review. The released CDC table-event resolver hook and upstream Flink binlog-readiness fences are preserved. Comment-only column batches follow IGNORE safely; Flink sink drops acknowledge success, while deterministic capability rejections negatively acknowledge and suppress restarts. Legacy writer callbacks remain reachable through Zeta, Flink and actual multi-table create/restore paths; explicitly advertised unsupported layout changes still fail. Restore-table metadata remains exempt from new-DDL policy gates. Regression coverage now exercises real Flink coordinator acknowledgements, downstream resolver overrides, legacy serialized task state and multi-table factory paths. The existing MySQL E2Es additionally assert the STRICT cause and unchanged sink comments after subsequent DML. Scoped Spotless and static whitespace checks passed; the final source/test patch received independent review. Remote readback confirms this head, 62 intended files, no POM delta and no merge conflict. Current-head GitHub CI is still required; this update does not establish runtime or merge readiness. |
DanielLeens
left a comment
There was a problem hiding this comment.
First, a sincere apology: in my earlier approval of this PR I accepted the "one-release compatibility window for legacy sink writers" without tracing it through MultiTableSink, which is the sink the Zeta parser wraps almost every CDC sink in. That gap existed before this head (carryover), and I should have caught it. Thanks for the continued work; I went through the full diff of head e9c52313cfba again, including the compatibility corrections pushed on top of a9ff9f8d and the dev merge. Review is by code reading only; nothing was executed locally.
What Problem Does This PR Solve?
- User pain point: with
schema-changes.enabled = truea CDC source has exactly one implicit path for DDL events; operators cannot choose to fail fast, to ignore comment-only noise, or to evolve. - Fix approach: new
schema-changes.behavior(STRICT/EVOLVEdefault /IGNORE) resolved bySchemaChangePolicyand enforced at the Zeta source collector, the FlinkSchemaOperator, and the sink side (ZetaSinkFlowLifeCycle/MultiTableSinkWriter, FlinkFlinkSinkWriter), with deterministic policy failures marked non-retryable. - One-sentence summary: adds an explicit, documented schema-change policy, but the sink-side capability gate currently breaks the promised legacy-sink compatibility window for multi-table sinks.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path (Zeta):
CDC source emits SchemaChangeEvent
-> SeaTunnelSourceCollector.collect(event) SeaTunnelSourceCollector.java:365-376
validateStrict / validateIgnore / shouldIgnore (behavior from SchemaChangePolicy.resolveBehavior(source))
-> schema coordination -> SinkFlowLifeCycle.received -> processSchemaChangeEvent
SinkFlowLifeCycle.java:890-927
if sink instanceof SupportSchemaEvolutionSink:
supports() -> isSupported? else drop (comment-only) / validateSupported -> SchemaChangePolicyException (NonRetryable)
writer instanceof SupportSchemaEvolutionSinkWriter -> apply
else deprecated override -> apply + WARN ; else inherited no-op -> WARN + drop (compat window)
-> TaskExecutionService tracker marks non-retryable -> TaskExecutionState(nonRetryable) -> JobMaster.neverNeedRestore()
Flink: SchemaOperator.handleSchemaChangeDetected applies the same policy and wraps SchemaChangePolicyException in SuppressRestartsException; FlinkSink.resolveSinkSupportedTypes hands capabilities to FlinkSinkWriter.
What is good: the policy lives in one place (SchemaChangePolicy); RestoreTableSchemaEvent is exempt from live-DDL gates; the CDC resolver hook is now backward compatible (getAndClearAlterTableEvents() delegating to the deprecated getAndClearParsedEvents()); docs in docs/en and docs/zh and the incompatible-changes entries are present.
Issue 1 (blocker, High, carryover): the sink-side gate defeats the legacy-writer compatibility window for multi-table sinks.
MultiTableSinkalways implementsSupportSchemaEvolutionSinkand itssupports()returns the first sub-sink's list, or an empty list when the first sub-sink is a legacy sink (MultiTableSink.java:433-440).MultipleTableJobConfigParser.tryGenerateMultiTableSink(:716-760) wraps every sink that implementsSupportMultiTableSink, which is the default CDC path.- In
SinkFlowLifeCycle.processSchemaChangeEvent(:890-905) the first branch is therefore always taken for such a job:isSupported(event, emptyList)is false, ADD/DROP/RENAME/MODIFY are not "safe to ignore", sovalidateSupportedthrowsSchemaChangePolicyException. The per-table null sentinel inMultiTableSinkWriter.getSupportedSchemaChangeTypes(the code that implements the compat window for multi-table) is never reached. - Result: a CDC job with a legacy sink (no
SupportSchemaEvolutionSink, or an inherited no-op writer) that ran before this PR (events silently no-op'd) now fails on the firstALTER TABLE ... ADD COLUMNwith a non-retryable error in the defaultEVOLVEmode. That contradictsincompatible-changes.mdandschema-evolution.md, which promise WARN-and-drop for one release on "Zeta multi-table" paths. The same applies to Flink:FlinkSink.resolveSinkSupportedTypessees theMultiTableSinkand passes an empty list. - The new tests (
SinkFlowLifeCycleSchemaChangePolicyTest) only use a plainPlainSink, never a realMultiTableSinkwith a legacy sub-sink, so they do not catch it. This is a code-reading finding; I did not run a job. - Fix: skip the lifecycle-level
supports()gate whensinkAction.getSink()is aMultiTableSink(the writer already validates per table with the null sentinel), or make the gate ask the sink for "advertised vs unadvertised" explicitly instead of collapsing both into an empty list. Add a Zeta and a Flink test with a realMultiTableSinkwrapping a legacy sub-sink.
Issue 2 (recommended, Medium): engine-wide task shutdown ordering changed inside a schema-policy PR. TaskExecutionService.java:1319-1336 now closes the task first and calls taskDone afterwards, and records any Throwable from close() as a task failure (previously only IOException, logged and ignored). Intent is sound (resources closed before the group completes; covered by testFailedTaskClosesBeforeTaskGroupCompletes), but a blocking close() (for example a sink holding a dead network connection) now delays group completion and therefore job failure/cancel/failover, which did not happen before. Please either split this into its own PR with an explicit bound/timeout discussion, or document why it is required here.
Issue 3 (recommended, Low): JdbcSink.supports() now advertises ALTER_TABLE_COMMENT and ALTER_COLUMN_COMMENT (JdbcSink.java:333-337), but JdbcDialect.applySchemaChange explicitly ignores comment events ("JDBC sink does not support comment sync"). The advertisement is needed so composite events containing a comment sub-event pass the all-children gate, but it makes supports() misleading. Add a comment at the declaration and a note in the docs.
1.2 Compatibility Impact
Partially incompatible. Default-config jobs with schema-changes.enabled = false are unaffected. With it enabled and the default EVOLVE: (a) legacy multi-table sinks now fail instead of no-op (Issue 1, undocumented and contradicting the docs); (b) Flink previously skipped unsupported types with a WARN and now fails (documented); (c) composite AlterTableColumnsEvent now needs every child supported (before: any). TaskExecutionState gained a field and an explicit serialVersionUID; the cluster does not support mixed versions, so this only matters for in-flight messages during an upgrade (Low).
1.3 Performance / Side-Effect Analysis
Policy checks run per DDL event only (rare). neverNeedRestore() is job-wide: one non-retryable task failure disables restore for the whole job, which is the intent for deterministic failures.
1.4 Error Handling and Logging
Policy failures are NonRetryableException, propagated through TaskGroupExecutionTracker.exception (first-failure semantics keep the non-retryable bit even after an earlier transient failure; tested). Messages include event type and table. Log levels are appropriate (WARN for drops).
2. Code Quality Assessment
2.1 Coding Standards
Generally good Javadoc on new API (SchemaChangePolicy, SupportSchemaChangeBehavior). SupportSchemaEvolutionSinkWriter.applySchemaChange now documents the idempotency requirement, which is important because DDL can be redelivered after a failure before the next checkpoint.
2.2 Test Coverage and Test Stability
Rating: Risk present. Strong unit coverage (SchemaChangePolicyTest, SeaTunnelSourceCollectorSchemaChangePolicyTest, SinkFlowLifeCycleSchemaChangePolicyTest, FlinkSinkWriterTest, SchemaOperatorTest, TaskExecutionStateTest) but the multi-table + legacy sub-sink combination in Issue 1 is untested. E2E additions (MysqlCDCWithSchemaChangeIT, MysqlCDCWithFlinkSchemaChangeIT) use Awaitility waits of 30 and 180 seconds rather than sleeps, which is fine; they depend on container timing, so I would watch them on CI (a related DDL-vs-binlog race has flaked before).
2.3 Documentation Updates
docs/en and docs/zh are both updated (schema-evolution.md, incompatible-changes.md, CDC connector option tables). The multi-table claim in these pages must be made true or corrected (Issue 1).
3. Architectural Soundness
3.1 Elegance: a Long-term solution: centralized policy plus capability matrix is the right shape. The per-layer duplication (Zeta lifecycle, MultiTableSinkWriter, FlinkSinkWriter) is the cost of the null-sentinel compatibility mechanism and is exactly where Issue 1 hides; consolidating "is this sink advertising?" into one API would remove the class of bug.
3.2 Maintainability: acceptable once Issue 1 is fixed; the one-release fallback needs a tracked removal item.
3.3 Extensibility: new event types default to "unsupported", which is the safe default.
3.4 Historical-version compatibility: see 1.2; restore events and the released CDC resolver hook are preserved.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Capability gate rejects legacy sub-sinks of MultiTableSink (Zeta and Flink), breaking the documented compat window |
SinkFlowLifeCycle.java:890-905, MultiTableSink.java:433-440, FlinkSink.resolveSinkSupportedTypes |
High (blocker) |
| 2 | Task close/taskDone ordering and close-failure semantics changed engine-wide |
TaskExecutionService.java:1319-1336 |
Medium |
| 3 | JDBC advertises comment support it does not implement | JdbcSink.java:333-337 |
Low |
| 4 | TaskExecutionState explicit serialVersionUID changes serialized identity |
TaskExecutionState.java:27 |
Low |
5. Merge Recommendation
Conclusion: Not recommended for merge
Blockers (must fix): Issue 1. CI is also not available: GitHub reports no check runs for this head, so the workflows need to be approved/run and pass on e9c52313.
Recommended fixes (non-blocking): Issues 2, 3, 4. SEZ9's earlier items 3-8 remain non-blocking follow-ups.
Overall assessment: the feature design and docs are solid and most compatibility corrections in the latest commit are good (resolver hook, restore exemption, non-retryable propagation). The remaining problem is narrow but important: the default EVOLVE path for legacy multi-table sinks regresses from silent no-op to job failure, contradicting the PR's own compatibility promise. The branch is 2 commits behind dev with no conflicts; no sync is needed unless unrelated CI failures appear.
Better alternative: keep the design, but decide "advertised vs unadvertised" once (a nullable/explicit API on the sink) and use it from Zeta, Flink and MultiTableSinkWriter.
|
Thanks for the contribution. The CI fact cited in my previous conclusion has changed; this follow-up updates that gate on the unchanged reviewed head, without issuing another full source review. Gate snapshot (2026-10-28T15:59:59+00:00), head The exact blocking stage is Build workflow-run detection: the check says no fork Build was found for this SHA. This is not an executed test failure and does not by itself prove that fork Actions is disabled. Open the fork Actions tab, enable workflows if needed, then manually run the existing Build workflow for this PR branch. If a matching run already exists, link it for a maintainer to reconcile the aggregate. No empty commit or speculative dependency change is requested. Upstream check: current dev retains the fork-run adoption workflow and its scheduled/manual status-refresh path. A base sync alone cannot enable fork Actions or supply a missing exact-head workflow run, so I am not prescribing sync as the fix for this activation gate. My previous source conclusion remains unchanged, including its independent source/documentation requests. CI is not being passed by inference, and this follow-up is not an effective approval. Comparison recorded in this scan: base |
|
Thanks for the contribution. Two things are still outstanding on this PR, neither of which has moved since the last review. CI gate. On head Source/documentation points from the previous review — these are unchanged and still need a response or a code/doc update:
Once the Build workflow is running on the current head and the items above have been addressed (or you've explained why a given one shouldn't change), I'll take another full look. |
|
Thanks @SEZ9. The existing source/documentation requests in my published review remain open on this unchanged head, including the policy/default compatibility and regression-contract questions. No committed fix is being confirmed from a discussion-only update, and I am not creating a duplicate numbered review. Separately, the current Build is a missing-fork-run action gate. Start/link the existing exact-head fork Build, enabling Actions only if disabled; a sync or dependency bump cannot itself supply that run. Checked 2026-10-29T17:15:07+00:00; head Comparison: base Daniel has READ repository permission. This is a discussion/CI clarification, not a new complete source review, an effective APPROVED event or dismissal of historical requested changes. A write-capable maintainer must perform any required final approval/dismissal. Thanks for keeping the follow-up focused. |
|
Thanks for the work on this one. Following up on the current head CI gate The Build check is still Open items from the previous review These remain unaddressed on the unchanged head, so the requested-changes state still stands. Concretely:
Discussion replies are welcome, but I'll only mark items resolved against committed changes. Once the fork Build run is linked and a new head lands with the above, I'll re-review. |
|
Thanks @SEZ9. The unchanged head does not close the existing policy/default compatibility, deterministic-failure recovery and documented filter/behavior contracts. Please preserve those source requests and provide committed fixes/contract evidence for the next complete review; an activation-only green check cannot close them. The separate Build gate is workflow-run discovery, so start/link the existing exact-head fork run and enable workflows only if disabled. A drift-only sync or dependency bump is not a remedy for that gate. Checked 2026-10-30T03:30:37.152281+00:00; head This is an unchanged-head discussion/CI clarification, not another full source review or an effective approval. Daniel has READ repository permission. |
|
Following up on the previous review — the head is still HIGH
MEDIUM
LOW
On CI: |
|
Thanks @SEZ9. I rechecked the specific F1/F2 claims against
I withdraw the stale technical blockers above; I do not have a remaining source request from that earlier list. The latest remaining gates are the actual dev merge conflict, exact-head Build workflow discovery (ACTION_REQUIRED), and effective maintainer review. Resolve the content conflict while preserving both sides, then link/start the existing fork Build on the resulting head; enable workflows only if actually disabled. No unrelated dependency patch or empty trigger commit is requested. This is a correction of the unchanged-head discussion, not a new full source review or an APPROVED event. If a historical requested-changes entry still appears in GitHub, a write-capable maintainer must handle final approval/dismissal separately; Daniel has READ permission. Checked 2026-11-01T12:13:27.637340+00:00; unchanged head |
e9c5231 to
38cfdbc
Compare
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for continuing this contribution to Apache SeaTunnel! I re-reviewed the complete latest head, including the revised Flink-only scope. Sorry for missing the Flink 2.0 test initialization problem in my earlier review; Issue 5 below is an explicit correction to that earlier coverage gap, not a claim that your latest commit introduced it. The previous blanket Zeta-policy/restart objection does not apply to this head. The retained wrapper concern and the test setup correction are collected together here.
What problem does this PR solve?
User pain: CDC users need an explicit decision when live DDL arrives rather than an implicit attempt to evolve every sink.
Approach: Add STRICT/EVOLVE/IGNORE, enforce them in the Flink schema operator, preserve restoration metadata, and distinguish advertised capabilities from legacy writers.
One sentence and example: A fixed-schema Flink pipeline can reject ADD COLUMN before sink coordination, while IGNORE permits comment-only DDL and continues delivering rows; IGNORE deliberately rejects ADD COLUMN rather than decoding changed rows against an old schema.
1. Code changes
1.1 Core logic
Complete runtime path:
CDC factory OptionRule -> IncrementalSource reads schema-changes.behavior
-> deserializer applies include/exclude -> resolver completes table/column events
-> Flink SchemaOperator: restoration bypass; STRICT rejection / safe IGNORE drop / EVOLVE source capability gate
-> existing checkpoint/deferred-schema coordination -> schema control row
-> FlinkSink.createWriter or restoreWriter resolves sink capabilities
-> FlinkSinkWriter outer capability gate -> modern writer / explicit deprecated override / warned no-op
-> MultiTableSinkWriter queued barrier and per-table dispatch capability gate -> child writer
-> following data rows and checkpoint state continue through the existing Flink protocol
Zeta: no new behavior-policy gate in this head; existing engine schema evolution remains, as the new bilingual documentation explicitly states. Spark evolution remains unsupported.
Key findings and correctness:
- This is a real live-DDL policy feature, reached on ordinary Flink CDC schema changes. It is not a general new Zeta policy implementation: the current documentation explicitly narrows that contract. The PR description still lists removed Zeta tests and should be refreshed.
- Restoration events bypass new-DDL policy and empty capability lists; comment-only batches require every child to be safe, and mixed ADD/DROP events require every child capability. Those corrections close the earlier composite/replay concerns.
- The per-table null sentinel correctly preserves an unadvertised legacy child when the MultiTable writer is called directly, but the real Flink factory/restore path still rejects it at the outer wrapper first (retained Issue 1). The new factory test calls the MultiTable writer directly and therefore misses this gate.
- Deterministic Flink policy rejection becomes SuppressRestartsException; ordinary sink apply errors retain table/job context. Removing the Zeta NonRetryableException marker is consistent with removing Zeta policy enforcement, rather than evidence of an active Zeta restart loop.
- Existing DDL delivery/checkpoint ordering still requires idempotent external apply after recovery. This change does not establish exactly-once external DDL by itself.
Before:
public interface SupportSchemaEvolutionSinkWriter {
/**
* apply schema change to third party data receiver.
*
* @param event
* @throws IOException
*/
void applySchemaChange(SchemaChangeEvent event) throws IOException;
After:
public interface SupportSchemaEvolutionSinkWriter {
/**
* Applies a schema change to a third-party data receiver.
*
* <p>Implementations must be idempotent. A completed external schema mutation can be delivered
* again when a task fails before the checkpoint that follows the mutation is completed.
*
* @param event schema change to apply
* @throws IOException when the schema change cannot be applied
*/
void applySchemaChange(SchemaChangeEvent event) throws IOException;
1.2 Compatibility
Partially compatible by explicit design. Existing option names and schema-changes.enabled=false remain unchanged; enabled jobs default to EVOLVE. New enum/marker interfaces are additive, with no new dependency or wire serializer. Both deprecated override and inherited no-op are retained for one release where the sink is unadvertised; explicit-empty capabilities reject layout changes. The outer-wrapper regression in Issue 1 prevents that promise for a real Flink path. Bilingual incompatible-change entries explain next-release fallback removal, migration to an idempotent SupportSchemaEvolutionSinkWriter, disabling evolution or filtering events. IGNORE is not a safe migration for row-layout DDL. Zeta ignores the new policy in this head.
1.3 Performance and side effects
Policy checks run per DDL, not per data row. Composite validation walks the event children; capability maps are built per writer/create/restore. Deprecated override detection uses reflection per schema event, not a row hot loop. There is no new network service or data-buffer allocation; existing multi-table queues/checkpoint buffering retain their resource and locking contracts. Fatal policy handling avoids deterministic Flink restart/replay loops. External DDL must remain idempotent; sink apply exceptions are not proof that external mutation was rolled back.
1.4 Errors, logging, and findings
Issue 1: Preserve the legacy sentinel through the real Flink multi-table wrapper
- Location:
seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/sink/FlinkSink.java:100. - Description and risk: Retained Issue 1, narrowed to the actual supported Flink path: AbstractSinkExecuteProcessor.tryGenerateMultiTableSink:238-250 wraps a sink implementing SupportMultiTableSink in MultiTableSink. That wrapper always implements SupportSchemaEvolutionSink, and MultiTableSink.supports:434-439 returns an empty list if its first child does not advertise that trait. Both FlinkSink resolvers convert the wrapper result into an explicit empty list. FlinkSinkWriter validates that list before dispatching into MultiTableSinkWriter. Consequently ADD COLUMN fails before the child legacy override/no-op compatibility branch, although getSupportedSchemaChangeTypesByTable correctly stored null for the child. The same obstruction applies after restore. This is the same wrapper/legacy distinction discussed in @SEZ9's earlier F1, with the real Flink construction path as additional evidence; it is not a blanket request to reject all legacy sinks.
- Best improvement: Preserve the unadvertised/advertised distinction through the outer multi-table wrapper, or delegate capability decisions to the table-aware dispatch layer without weakening explicit-empty rejection. Add create and restore regressions through actual FlinkSink -> MultiTableSink -> legacy child, including the explicit-empty modern control.
- Responsibility and trade-off: The affected component owns this behavior. Keep the smallest complete correction there; a wider engine or connector redesign is not justified by this diff.
- Severity: High; blocking: true.
- Previously raised by another reviewer: No, unless explicitly attributed above.
Issue 5: Provide a non-null Flink 2.0 writer initialization context in the new tests
- Location:
seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-20/src/test/java/org/apache/seatunnel/translation/flink/sink/FlinkSinkWriterTest.java:159. - Description and risk: Every helper-created writer passes null as WriterInitContext; the two capability-specific constructors also pass null at lines 117 and 143. The production constructor immediately calls initContext.getRestoredCheckpointId() at FlinkSinkWriter.java:91. Thus these tests throw NullPointerException during construction, including before assertThrows in the failure tests; they do not validate policy rejection, legacy compatibility, or sink apply errors. This is deterministic source evidence, not a claimed local test execution.
- Best improvement: Mock or implement WriterInitContext with getRestoredCheckpointId returning OptionalLong.empty() (or a restored checkpoint value) and pass it to every constructor. Keep the production non-null lifecycle contract and exercise both initial and restored checkpoint numbering.
- Responsibility and trade-off: The affected component owns this behavior. Keep the smallest complete correction there; a wider engine or connector redesign is not justified by this diff.
- Severity: High; blocking: true.
- Previously raised by another reviewer: No, unless explicitly attributed above.
Issue 4: Document the new capability resolution boundary
- Location:
seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/sink/FlinkSink.java:100. - Description and risk: Carryover from earlier optional Issue 4: the new resolveSinkSupportedTypes methods and MultiTableSink capability-map helpers encode the important distinction between null legacy capabilities, explicit empty capabilities, and missing-table rejection. Inline notes help, but the new core methods do not document their caller/restore contract.
- Best improvement: Add concise method documentation covering the sentinel, wrapper handling and initial/restore use; keep this focused on the capability boundary.
- Responsibility and trade-off: The affected component owns this behavior. Keep the smallest complete correction there; a wider engine or connector redesign is not justified by this diff.
- Severity: Medium; blocking: false.
- Previously raised by another reviewer: No, unless explicitly attributed above.
I reconciled @SEZ9's earlier change requests (reviews 4772265401 and 4784820603) and later COMMENTED review 5002226852. I agree that capability routing and deterministic failure matter, but the old blanket legacy-no-op and active-Zeta-restart objections do not describe this head: the compatibility window and Flink-only scope are now explicit. Source-side composite/replay checks and resolver-hook compatibility have targeted coverage. Issue 1 relates to the earlier wrapper/legacy discussion and supplies the missing real Flink construction/restore evidence; there is no independent maintainer approval that overrides these current blockers.
2. Code quality
2.1 Conventions
Reviewed all changed files for license, imports, naming, core-method and state-field comments. See the numbered findings for the required changes.
2.2 Test coverage and stability
Stability rating: Risk present. API policy, resolver-hook compatibility, multi-table factory create/restore, option parsing, and both Flink sink paths are covered by source tests. The Flink 2.0 tests cannot reach their assertions as written (Issue 5). The API factory regression does not construct a real FlinkSink and misses Issue 1. The E2E adds real source binlog-readiness polling and checks row 114 after the final comment before checking the unchanged sink comment, which is stronger than container-up/log-only acceptance. The new IGNORE test discards its asynchronous execution future; retaining it and surfacing early failure would improve diagnostics, and cleanup remains dependent on the container harness. Stability rating is Risk present for this asynchronous diagnostic weakness, not a claim of a demonstrated timing failure. Unit policy assertions are otherwise deterministic, without new sleep-based correctness proof. No local tests were run.
2.3 Documentation
English and Chinese connector options, schema-evolution behavior matrices and incompatible-change notes are present and consistent about Flink-only enforcement, safe comments, filtering before policy, restoration and replay idempotence. The new opening restoration paragraph in docs/zh is still English and should be translated. Refresh the PR description: it still claims Zeta tests and configuration files removed from the current diff. JDBC intentionally accepts comment events as no-ops, so documenting unchanged sink comments is appropriate.
3. Architecture
3.1 Change location
The affected component owns this behavior. Keep the smallest complete correction there; a wider engine or connector redesign is not justified by this diff.
3.2 Maintainability
Keep the behavior, lifecycle ownership, and failure contract together. The affected component owns this behavior. Keep the smallest complete correction there; a wider engine or connector redesign is not justified by this diff.
3.3 Extensibility
Prefer the existing component boundary and tests over unrelated shared abstractions.
3.4 Upgrade impact
Partially compatible by explicit design. Existing option names and schema-changes.enabled=false remain unchanged; enabled jobs default to EVOLVE. New enum/marker interfaces are additive, with no new dependency or wire serializer. Both deprecated override and inherited no-op are retained for one release where the sink is unadvertised; explicit-empty capabilities reject layout changes. The outer-wrapper regression in Issue 1 prevents that promise for a real Flink path. Bilingual incompatible-change entries explain next-release fallback removal, migration to an idempotent SupportSchemaEvolutionSinkWriter, disabling evolution or filtering events. IGNORE is not a safe migration for row-layout DDL. Zeta ignores the new policy in this head.
4. Findings summary
Completeness check: All changed files and affected entry/failure paths were reviewed; configuration/serialization compatibility, test failure capability and stability, documentation/examples, change ownership, and current CI/conflict/review gates are covered above. No unreviewed source scope is claimed complete.
| # | Finding | Location | Severity |
|---|---|---|---|
| 1 | Preserve the legacy sentinel through the real Flink multi-table wrapper | seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/sink/FlinkSink.java:100 |
High |
| 5 | Provide a non-null Flink 2.0 writer initialization context in the new tests | seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-20/src/test/java/org/apache/seatunnel/translation/flink/sink/FlinkSinkWriterTest.java:159 |
High |
| 4 | Document the new capability resolution boundary | seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/sink/FlinkSink.java:100 |
Medium |
5. Merge recommendation
Merge after fixes
Blocking items: Issues 1, 5. Current-head CI and write-capable maintainer review remain independent requirements.
Non-blocking suggestions: Issue 4: Document the new capability resolution boundary
Overall: the approach addresses a real path, but the listed blockers must be closed. Daniel has READ permission, so this COMMENT cannot dismiss historical requested changes or satisfy a write-capable maintainer approval gate.
CI and repository state: no check reported in the Apache rollup; Build: queued. GitHub reports BLOCKED / REVIEW_REQUIRED.
Verification: Reviewed all changed files and the referenced call sites at 38cfdbcaed1e6ce984a1a7a8a24eeb3b504b47a6 against merge base 8323d5f1947a9f77b94897675066f2acd9a4058a. git diff --check passed. I did not build, run tests, or execute SeaTunnel locally.
Review time: 2026-11-24T07:27:05.362444-05:00
Local evidence: git fetch obtained head 38cfdbcaed1e6ce984a1a7a8a24eeb3b504b47a6; git merge-base returned 8323d5f1947a9f77b94897675066f2acd9a4058a; git diff --stat reports 46 files changed, 2201 insertions(+), 147 deletions(-). git show and source searches were used for the entry points above. No local build, unit test, E2E, Docker run or service startup was executed.
38cfdbc to
016ce80
Compare
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update and for fixing the Flink 2.0 test initialization! I re-read the complete latest diff and the source-to-sink construction/restore paths. Previous Issue 5 is closed; the independent outer multi-table wrapper blocker in Issue 1 remains. The details below keep those two conclusions separate.
What problem does this PR solve?
User pain: Flink CDC pipelines need an explicit contract when live DDL appears, rather than accidental silent drops.
Approach: add strict/evolve/ignore, validate before Flink coordination, distinguish advertised sink capabilities from legacy writers, and preserve a one-release deprecated callback/no-op window.
In one sentence: make Flink DDL handling predictable. Example: a comment can be dropped in ignore mode while ADD COLUMN fails terminally instead of continuing with incompatible row layouts.
1. Code changes
1.1 Core logic
Complete runtime path:
CDC factory OptionRule -> IncrementalSource behavior (default EVOLVE)
-> Debezium resolver -> include/exclude filter -> produced-schema update -> schema event row
-> Flink SchemaOperator (enabled only) -> STRICT / safe IGNORE / EVOLVE source-capability gate
-> persisted RestoreTableSchemaEvent bypasses new-DDL policy -> existing checkpoint-coordinated downstream delivery
-> AbstractSinkExecuteProcessor.tryGenerateMultiTableSink -> MultiTableSink when supported
-> FlinkSink.create/restore -> resolveSinkSupportedTypes -> FlinkSinkWriter capability validation
-> MultiTableSinkWriter table/replica dispatch -> per-table capability validation -> modern apply or legacy callback/no-op warning
-> deterministic policy exception -> SuppressRestartsException; external apply failure -> contextual sink error
Key findings and correctness:
- This head enforces the new behavior in Flink; it does not add a Zeta lifecycle policy gate. The docs explicitly say Zeta ignores the option and Spark does not support evolution. The shared MultiTableSinkWriter does change capability/legacy dispatch, including for callers outside Flink.
- RestoreTableSchemaEvent represents previously accepted metadata and bypasses strict/ignore/live-capability rejection. Composite comment batches are droppable only when every child is safe; mixed layout events require every child capability.
- Resolver compatibility is retained through both the released table-event hook and deprecated column-event hook; MySQL/Oracle use the broader hook. Normal CDC deserialization filters before changing the produced schema or invoking policy.
- Flink policy rejections suppress restart; external DDL delivery is still replayable after a failed following checkpoint, so idempotence remains the sink contract. This PR documents that requirement rather than proving exactly-once external DDL.
- The prior null WriterInitContext defect (Issue 5) is closed: every new Flink 2.0 writer construction now calls createInitContext(), which returns OptionalLong.empty(). That does not close the separate outer-wrapper Issue 1.
Before: Flink constructed its writer without a sink capability argument.
After:
return new FlinkSinkWriter<>(
sink.createWriter(stContext), 1, stContext, resolveSinkSupportedTypes());The resolver treats every SupportSchemaEvolutionSink wrapper as advertised, which loses the child legacy distinction before dispatch.
1.2 Compatibility
Partially compatible by explicit design: additive option/enum/source marker, EVOLVE default, enabled=false unchanged, no new dependency or wire serializer. Unadvertised writers retain deprecated overrides/no-ops for one release, while explicit empty modern capabilities reject layout changes. Issue 1 still violates that promise through the real Flink wrapper. Both migration documents explain next-release fallback removal and idempotent modern writers; IGNORE is not a migration for layout DDL. Zeta does not enforce the new policy in this head.
1.3 Performance and side effects
Policy checks and reflective deprecated-override detection run per DDL rather than per data row. Composite validation walks children and the capability maps are built on create/restore. No new row buffer or network service is added; existing checkpoint/queue resource ownership remains. Avoid a global reflection cache that retains plugin classloaders without a measured need.
1.4 Errors, logging, and findings
Issue 1: Preserve the legacy sentinel through the real Flink multi-table wrapper
- Location:
seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/sink/FlinkSink.java:100. - Description and risk: Retained Issue 1, related to @SEZ9's earlier F1 capability/legacy discussion. AbstractSinkExecuteProcessor.java:238-250 constructs MultiTableSink for supported multi-table sinks. That wrapper always advertises SupportSchemaEvolutionSink and returns empty from supports():434-439 when the first child is legacy. Both FlinkSink variants convert that into explicit empty capabilities, so FlinkSinkWriter rejects ADD COLUMN before the table-aware writer can use its present-null legacy fallback. This affects initial creation and restoration; the promised compatibility window is unreachable on this real construction path.
- Best improvement: Preserve unadvertised versus explicitly-empty capabilities through the outer wrapper, or delegate that decision to the table-aware dispatch layer. Test actual FlinkSink -> MultiTableSink -> legacy child create and restore, with a modern explicit-empty control.
- Responsibility and trade-off: The affected component owns this behavior. Keep the smallest complete correction there; a wider engine or connector redesign is not justified by this diff.
- Severity: High; blocking: true.
- Previously raised by another reviewer: No, unless explicitly attributed above.
Issue 4: Document the capability resolution boundary
- Location:
seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/sink/FlinkSink.java:100. - Description and risk: Carryover optional Issue 4: the new resolver and MultiTableSink capability-map helpers encode null legacy, explicit-empty modern and missing-table rejection semantics but lack a method contract describing their caller/restore boundary.
- Best improvement: Document those sentinels and the create/restore contract alongside the focused wrapper fix.
- Responsibility and trade-off: The affected component owns this behavior. Keep the smallest complete correction there; a wider engine or connector redesign is not justified by this diff.
- Severity: Medium; blocking: false.
- Previously raised by another reviewer: No, unless explicitly attributed above.
Community reconciliation: I reviewed @SEZ9's CHANGES_REQUESTED reviews 4772265401/4784820603, later COMMENTED review 5002226852 and follow-ups. The old blanket legacy-no-op rejection and active-Zeta-restart claims do not describe this head: the compatibility window and Flink-only scope are explicit. Inherited public overrides are found by Class.getMethod; arbitrary decorator unwrapping and cached reflection are not claimed. Filter precedence, comment-only IGNORE and external-DDL replay requirements are documented. Issue 1 overlaps the earlier capability discussion but supplies the actual outer Flink construction/restore evidence; it is retained rather than a newly invented blocker. No independent maintainer approval supersedes it.
2. Code quality
2.1 Conventions
Reviewed all changed files for license, imports, naming, core-method and state-field comments. See the numbered findings for the required changes.
2.2 Test coverage and stability
Stability rating: Risk present. Read every changed API/resolver/option/JDBC/Flink test and both MySQL E2E configurations. API factory create/restore preserves the child null sentinel but still does not build the real Flink outer wrapper. The Flink 2.0 constructor regression is fixed. STRICT E2E waits for a real binlog reader and checks the policy cause; IGNORE checks post-DDL row 114 before unchanged sink comments, rather than accepting a log alone. Unit assertions are deterministic and mocked contexts are explicit. The retained asynchronous IGNORE execution future is discarded, so early job failures become timeout diagnostics and the fixture relies on container teardown; retain/inspect it in a follow-up. No local execution was performed. Current-head fork Build 45395457314 is queued in the collected snapshot; a run URL is not a pass.
2.3 Documentation
Read all EN/ZH connector options, schema-evolution matrices and incompatible-change entries. They state filtering first, Flink-only enforcement, safe comments, restore metadata and replay idempotence. The opening restoration paragraph in docs/zh remains English (retained localization suggestion). Refresh the PR description if it still advertises removed Zeta tests. Workflow timeout increases are limited to existing lanes, not proof of new coverage.
3. Architecture
3.1 Change location
The affected component owns this behavior. Keep the smallest complete correction there; a wider engine or connector redesign is not justified by this diff.
3.2 Maintainability
Keep the behavior, lifecycle ownership, and failure contract together. The affected component owns this behavior. Keep the smallest complete correction there; a wider engine or connector redesign is not justified by this diff.
3.3 Extensibility
Prefer the existing component boundary and tests over unrelated shared abstractions.
3.4 Upgrade impact
Partially compatible by explicit design: additive option/enum/source marker, EVOLVE default, enabled=false unchanged, no new dependency or wire serializer. Unadvertised writers retain deprecated overrides/no-ops for one release, while explicit empty modern capabilities reject layout changes. Issue 1 still violates that promise through the real Flink wrapper. Both migration documents explain next-release fallback removal and idempotent modern writers; IGNORE is not a migration for layout DDL. Zeta does not enforce the new policy in this head.
4. Findings summary
Completeness check: All changed files and affected entry/failure paths were reviewed; configuration/serialization compatibility, test failure capability and stability, documentation/examples, change ownership, and current CI/conflict/review gates are covered above. No unreviewed source scope is claimed complete.
| # | Finding | Location | Severity |
|---|---|---|---|
| 1 | Preserve the legacy sentinel through the real Flink multi-table wrapper | seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/sink/FlinkSink.java:100 |
High |
| 4 | Document the capability resolution boundary | seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/sink/FlinkSink.java:100 |
Medium |
5. Merge recommendation
Merge after fixes
Blocking items: Issues 1. Current-head CI and write-capable maintainer review remain independent requirements.
Non-blocking suggestions: Issue 4: Document the capability resolution boundary
Overall: the approach addresses a real path, but the listed blockers must be closed. Daniel has READ permission, so this COMMENT cannot dismiss historical requested changes or satisfy a write-capable maintainer approval gate.
CI and repository state: no check reported in the Apache rollup; Build: queued. GitHub reports BLOCKED / REVIEW_REQUIRED.
Verification: Reviewed all changed files and the referenced call sites at 016ce808b2705c9e216781445fe18cbb4e1c55c9 against merge base 8323d5f1947a9f77b94897675066f2acd9a4058a. git diff --check passed. I did not build, run tests, or execute SeaTunnel locally.
Review time: 2026-11-24T12:04:57.396885-05:00
Local evidence: git fetch obtained head 016ce808b2705c9e216781445fe18cbb4e1c55c9; git merge-base returned 8323d5f1947a9f77b94897675066f2acd9a4058a; git diff --stat reports 47 files changed, 2215 insertions(+), 150 deletions(-). git show and source searches were used for the entry points above. No local build, unit test, E2E, Docker run or service startup was executed.
|
Thanks for the update. Following up only on the earlier review points, based on the latest re-review of the diff: Looks addressed, please confirm
Still open
Once the wrapper blocker and the legacy no-op question are settled, the rest are doc confirmations. |
a92daca to
2551dda
Compare
Purpose of this pull request
Close: #11043
Since the current branch is based on #11025, please wait for that PR to be merged; I will perform a rebase after it is merged to maintain a clean commit history and avoid conflicts.
Please begin the review starting from commit f80539d.
This PR introduces a new schema-changes.behavior option with three explicit, well-defined policies:
Does this PR introduce any user-facing change?
Yes.
A new CDC source option schema-changes.behavior is introduced. It accepts STRICT, EVOLVE, or IGNORE.
Backward compatibility is preserved:
Example configuration:
How was this patch tested?
Unit tests added or updated: SchemaChangePolicyTest, SeaTunnelSourceCollectorSchemaChangePolicyTest, SinkFlowLifeCycleSchemaChangePolicyTest, SchemaOperatorTest, FlinkSinkWriterTest
E2E tests added:
MysqlCDCWithSchemaChangeIT.testMysqlCDCWithSchemaChangeIgnore, MysqlCDCWithSchemaChangeIT.testMysqlCDCWithSchemaChangeStrict.
MysqlCDCWithFlinkSchemaChangeIT.testMysqlCDCWithFlinkSchemaChangeIgnore, MysqlCDCWithFlinkSchemaChangeIT.testMysqlCDCWithFlinkSchemaChangeStrict
conf files added:
Check list
New License Guide
incompatible-changes.mdto describe the incompatibility caused by this PR.