Skip to content

[Feature][Connector-V2][Flink-CDC] Add configurable schema change behavior policies - #11162

Merged
TyrantLucifer merged 2 commits into
apache:devfrom
CloverDew:feature/add-configurable-schema-change-behavior-policies-for-cdc
Nov 26, 2026
Merged

TyrantLucifer merged 2 commits into
apache:devfrom
CloverDew:feature/add-configurable-schema-change-behavior-policies-for-cdc

Conversation

@CloverDew

Copy link
Copy Markdown
Contributor

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:

  • STRICT: Fail the job immediately when any schema change event is observed, before any sink-side mutation is attempted. For pipelines that treat the incoming schema as a fixed contract.
  • EVOLVE: Forward schema change events through the normal schema coordination path only when they are supported end-to-end. Any unsupported event type or sink-side apply failure is fatal. This is the default when schema-changes.enabled = true.
  • IGNORE: Drop schema change events before downstream schema coordination. The job continues only for event types that are safe to ignore (e.g. comment-only changes). Events that alter the runtime row layout cannot be silently ignored and will fail fast.

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:

  • Jobs with schema-changes.enabled = false (the existing default) are unaffected.
  • Jobs with schema-changes.enabled = true that do not set schema-changes.behavior will default to EVOLVE, which preserves the closest semantics to the previous behavior.

Example configuration:

env {
  # You can set engine configuration here
  parallelism = 5
  job.mode = "STREAMING"
  checkpoint.interval = 5000
  read_limit.bytes_per_second=7000000
  read_limit.rows_per_second=400
}

source {
  MySQL-CDC {
    server-id = 5652-5657
    username = "st_user_source"
    password = "mysqlpw"
    table-names = ["shop.products"]
    url = "jdbc:mysql://mysql_cdc_e2e:3306/shop"

    schema-changes.enabled = true
    schema-changes.behavior = evolve
  }
}

sink {
  jdbc {
    url = "jdbc:mysql://mysql_cdc_e2e:3306/shop"
    driver = "com.mysql.cj.jdbc.Driver"
    user = "st_user_sink"
    password = "mysqlpw"
    generate_sink_sql = true
    database = shop
    table = mysql_cdc_e2e_sink_table_with_schema_change
    primary_keys = ["id"]
  }
}

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:

  • mysqlcdc_to_mysql_with_schema_change_ignore.conf
  • mysqlcdc_to_mysql_with_schema_change_strict.conf
  • mysqlcdc_to_mysql_with_flink_schema_change_ignore.conf
  • mysqlcdc_to_mysql_with_flink_schema_change_strict.conf

Check list

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Composite AlterTableColumnsEvent is 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 EVOLVE mode 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.
  2. 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 AlterTableColumnsEvent and is rejected at the policy gate.

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_COLUMNS support check is too permissive and can green-light mixed DDL that the sink cannot actually apply.

@CloverDew
CloverDew force-pushed the feature/add-configurable-schema-change-behavior-policies-for-cdc branch from b0b1ff8 to d14c96d Compare June 24, 2026 02:59

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 / SchemaChangePolicy and wires them through the CDC source, engine, Flink translation, and sink side.
  • One-line summary: the previous Daniel blocker on composite AlterTableColumnsEvent support 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

  1. Blocking items
  • No new code-level blocker from Daniel's side.
  • Please get the latest Build green.
  1. 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.

@CloverDew
CloverDew force-pushed the feature/add-configurable-schema-change-behavior-policies-for-cdc branch from d14c96d to ccd9ca5 Compare June 25, 2026 22:28

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() for AlterTableColumnsEvent so 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 AlterTableColumnsEvent support is closed on the current head.
  • The new regression tests in SchemaOperatorTest and SinkFlowLifeCycleSchemaChangePolicyTest now 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 Build is 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

  1. Blocking items
  • No new source-level blocker from Daniel's side on the current head.
  • Please let the latest Build finish cleanly.
  1. Suggested non-blocking follow-up
  • None from this round.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AlterTableColumnsEvent partial-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 Build is 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

  1. Blocking items
  • Please wait for the latest Build to finish green.
  1. 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 DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks for the update. I rechecked the current head against the latest dev, and this branch is still behind upstream.

  • base branch: dev
  • head SHA: ccd9ca5c19599dbab4c44913efbcece8ae3fd4c8
  • compare status: diverged
  • ahead_by: 13
  • behind_by: 24
  • mergeable_state: unknown
  • CI / merge gate snapshot: pending

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 dev and rerun CI first. If anything still fails after the sync, I'm happy to take another look on top of the updated head.

@CloverDew
CloverDew force-pushed the feature/add-configurable-schema-change-behavior-policies-for-cdc branch from ccd9ca5 to 0f55ecd Compare July 24, 2026 02:40

@SEZ9 SEZ9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 implement SupportSchemaEvolutionSinkWriter, 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.behavior CDC source option with three policies (STRICT / EVOLVE / IGNORE) backed by a new SchemaChangeBehavior enum, a SupportSchemaChangeBehavior source marker interface, and a SchemaChangePolicy utility that validates events before downstream coordination (validateStrict, validateIgnore with an isSafeToIgnore row-layout check, validateSupported against SchemaChangeType capabilities); MultiTableSinkWriter.applySchemaChange now throws SinkWriterSchemaException instead of calling the deprecated fallback, new comment-related EventTypes are added, and Column.copyWithComment is implemented on PhysicalColumn/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 MultiTableSinkWriter is 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-qualified SupportSchemaChangeBehavior reference in SchemaChangePolicy.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 implement SupportSchemaEvolutionSinkWriter) was replaced with an unconditional SinkWriterSchemaException at seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:346.
  • Impact: any existing job running with schema-changes.enabled = true and a sink whose writer only implements the deprecated applySchemaChange (or the default no-op) will now fail at runtime after upgrading, even though the PR description states "Backward compatibility is preserved" and EVOLVE "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 applySchemaChange fallback with a hard failure is a user-visible breaking change: existing jobs with schema-changes.enabled = true and a sink writer that has not migrated to SupportSchemaEvolutionSinkWriter will 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, and SchemaChangePolicy are new public types in the stable seatunnel-api module, but none of them carry class-level or method-level Javadoc; ASF headers are correctly present, but connector developers implementing SupportSchemaChangeBehavior get 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 of STRICT/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 SupportSchemaChangeBehavior describing the marker-interface contract and default resolution to EVOLVE, enum-constant Javadoc on SchemaChangeBehavior mirroring the doc table, and method Javadoc on the SchemaChangePolicy static 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-api that connector authors will implement, please add class-level Javadoc describing the contract: who calls getSchemaChangeBehavior(), when it is evaluated, and that sources not implementing this interface default to EVOLVE (per SchemaChangePolicy.resolveBehavior). The same applies to SchemaChangeBehavior (per-constant docs matching the behavior matrix in the docs) and the static helpers in SchemaChangePolicy.
  • 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 into MySqlIncrementalSourceFactory, but the changed-files list only includes docs/en/introduction/configuration/schema-evolution.md and its zh counterpart — the connector reference page docs/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 how schema-changes.enabled is documented today.
  • Fix: add a row for schema-changes.behavior (type: enum, default: evolve, requires schema-changes.enabled = true) to the options table in docs/en/connector-v2/source/MySQL-CDC.md and docs/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.behavior is a new user-facing source option exposed via MySqlIncrementalSourceFactory, it also needs a row in the option tables of docs/en/connector-v2/source/MySQL-CDC.md and docs/zh/connector-v2/source/MySQL-CDC.md (type, default evolve, dependency on schema-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: resolveBehavior references org.apache.seatunnel.api.source.SupportSchemaChangeBehavior with 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-api and makes the instanceof check harder to read.
  • Fix: add import org.apache.seatunnel.api.source.SupportSchemaChangeBehavior; and use the simple name in both the instanceof check and the cast. Also, the imported-but-apparently-only-conditionally-used SchemaEvolutionException/TableIdentifier imports 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.SupportSchemaChangeBehavior and use the simple name here instead of the fully qualified name in both the instanceof and the cast — there's no name clash, and this keeps the file consistent with the import style used elsewhere in seatunnel-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.md keeps the English heading ## Schema change behavior while 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 like schema-changes.behavior untranslated.
  • 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 like schema-changes.behavior in 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.behavior is 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.

@github-actions github-actions Bot removed the reviewed label Jul 24, 2026
DanielLeens

This comment was marked as outdated.

DanielLeens

This comment was marked as outdated.

@CloverDew
CloverDew force-pushed the feature/add-configurable-schema-change-behavior-policies-for-cdc branch from 0f55ecd to 1518ef5 Compare July 27, 2026 02:30
SEZ9
SEZ9 previously requested changes Jul 27, 2026

@SEZ9 SEZ9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-op SinkWriter.applySchemaChange silently swallow the change, leaving source and sink schemas divergent with no failure signal (#11043).
  • Fix approach: Introduce a schema-changes.behavior option (STRICT / EVOLVE / IGNORE) enforced in the CDC source's schema-change resolution path before downstream coordination, add SCHEMA_CHANGE_ALTER_TABLE_COMMENT / SCHEMA_CHANGE_ALTER_COLUMN_COMMENT event types so IGNORE can distinguish safe-to-drop metadata changes from row-layout mutations, and harden MultiTableSinkWriter to require SupportSchemaEvolutionSinkWriter (throwing SinkWriterSchemaException with SchemaEvolutionErrorCode instead 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 EventType shifting LIFECYCLE_* 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: MultiTableSinkWriter now throws a SinkWriterSchemaException (new imports of SchemaEvolutionErrorCode/SinkWriterSchemaException added in this PR) whenever a schema change event reaches a writer that does not implement SupportSchemaEvolutionSinkWriter, and the deprecated SinkWriter.applySchemaChange fallback — including its default no-op — is no longer invoked.
  • Impact: any existing CDC job with schema-changes.enabled = true that 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. Because EVOLVE is the implicit default of the new schema-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.behavior option so evolve on legacy writers degrades gracefully. At minimum, make the thrown SinkWriterSchemaException message name the offending sink/table and point to SupportSchemaEvolutionSinkWriter and the schema-changes.behavior = ignore / schema-changes.enabled = false mitigations, 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:96 SinkWriter.applySchemaChange fallback, including the default no-op implementation, is no longer used.; docs/en/introduction/concepts/incompatible-changes.md:95 SinkWriter.applySchemaChange fallback, including the default no-op implementation, is no longer used.
  • Suggested fix: Dropping the deprecated SinkWriter.applySchemaChange fallback here means every existing CDC job with schema-changes.enabled = true against a legacy sink writer will now fail at runtime the first time a DDL event arrives — with evolve being 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 the SinkWriterSchemaException message here include the sink/table identifier and the concrete migration options (SupportSchemaEvolutionSinkWriter, schema-changes.behavior = ignore, or disabling schema-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, AlterColumnCommentEvent via CustomAlterTableParserListener), 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 with schema-changes.enabled = true upgrade 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 default evolve policy for any sink that does not handle them — meaning a routine ALTER TABLE ... COMMENT on 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) under evolve when 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, disable schema-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, disable schema-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_COMMENT and SCHEMA_CHANGE_ALTER_COLUMN_COMMENT are inserted after SCHEMA_CHANGE_RENAME_TABLE and before LIFECYCLE_ENUMERATOR_OPEN, which changes the ordinal of every subsequent constant in org.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 map LIFECYCLE_ENUMERATOR_OPEN and 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 EventType by 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_COMMENT in the middle of the enum shifts the ordinals of all LIFECYCLE_* constants. Java's built-in enum serialization is name-based, but if any Zeta event-reporting serializer or persisted format encodes EventType by 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 new strict/ignore policies, and unit tests (SinkFlowLifeCycleSchemaChangePolicyTest, FlinkSinkWriterTest) cover writer-level behavior, but there is no end-to-end test proving that an evolve-mode job against a legacy sink writer (deprecated applySchemaChange only) fails with the new SinkWriterSchemaException and 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 evolve mode, and asserts the job fails with SchemaEvolutionErrorCode and 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 without SupportSchemaEvolutionSinkWriter → fail before the deprecated fallback), but I don't see an E2E/integration test that asserts it — the new E2E cases cover strict and ignore only. Please add a test that runs a legacy sink writer (deprecated applySchemaChange only) through evolve mode and asserts the job fails with SchemaEvolutionErrorCode and 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 strict and ignore but no E2E asserts the new fail-fast path for sinks lacking SupportSchemaEvolutionSinkWriter under evolve

Nice progress overall — once the blocking points above are addressed this should be in good shape. Happy to discuss.

DanielLeens

This comment was marked as outdated.

@CloverDew
CloverDew force-pushed the feature/add-configurable-schema-change-behavior-policies-for-cdc branch 3 times, most recently from 7b2d8ff to 8ad87de Compare July 29, 2026 12:30

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • STRICT fails before downstream schema coordination or sink-side mutation.
  • IGNORE only drops safe comment-only events; row-layout changes still fail fast.
  • EVOLVE keeps 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.behavior option, 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:

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

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

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

@DanielLeens

Copy link
Copy Markdown
Contributor

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.
Slack workspace link: https://s.apache.org/seatunnel-slack

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😄

@CloverDew
CloverDew force-pushed the feature/add-configurable-schema-change-behavior-policies-for-cdc branch from 8ad87de to b0258b8 Compare August 3, 2026 09:15

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@davidzollo

Copy link
Copy Markdown
Contributor

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 DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = true a 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 / EVOLVE default / IGNORE) resolved by SchemaChangePolicy and enforced at the Zeta source collector, the Flink SchemaOperator, and the sink side (Zeta SinkFlowLifeCycle / MultiTableSinkWriter, Flink FlinkSinkWriter), 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.

  • MultiTableSink always implements SupportSchemaEvolutionSink and its supports() 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 implements SupportMultiTableSink, 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", so validateSupported throws SchemaChangePolicyException. The per-table null sentinel in MultiTableSinkWriter.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 first ALTER TABLE ... ADD COLUMN with a non-retryable error in the default EVOLVE mode. That contradicts incompatible-changes.md and schema-evolution.md, which promise WARN-and-drop for one release on "Zeta multi-table" paths. The same applies to Flink: FlinkSink.resolveSinkSupportedTypes sees the MultiTableSink and passes an empty list.
  • The new tests (SinkFlowLifeCycleSchemaChangePolicyTest) only use a plain PlainSink, never a real MultiTableSink with 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 when sinkAction.getSink() is a MultiTableSink (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 real MultiTableSink wrapping 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.

@DanielLeens

Copy link
Copy Markdown
Contributor

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 e9c52313cfba2a64b713f743be95e80a00794072: Build is ACTION_REQUIRED.

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 dev, diverged, ahead 12 / behind 48, no merge conflict. Branch drift is metadata here and is not an additional sync request.

@SEZ9

SEZ9 commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

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 e9c52313cfba2a64b713f743be95e80a00794072 the Build check is ACTION_REQUIRED because no fork Build run was found for that SHA. This is not a test failure, and I'm not asking for an empty commit, a dependency bump, or a base sync. Please open the Actions tab on your fork, enable workflows if they are disabled, and manually trigger the existing Build workflow for this branch. If a matching run already exists, link it here so we can reconcile the aggregate status. I won't pass CI by inference.

Source/documentation points from the previous review — these are unchanged and still need a response or a code/doc update:

  • HIGH – EVOLVE default vs. compatibility claim. With schema-changes.enabled = true, a sink writer that still inherits the deprecated no-op will now fail where it previously ran. Please either change the default so existing jobs keep running, or drop the "backward compatibility is preserved" wording and document this as a real behavior change in docs/en/introduction/concepts/incompatible-changes.md.
  • HIGH – restart loop on deterministic failure. strict/ignore (and evolve on an unsupported event) fail deterministically, so checkpoint-restore will replay the same event and fail again indefinitely. Please describe how the engine terminates the job rather than leaving operators to detect the loop, and reflect that in docs/en/introduction/configuration/schema-evolution.md.
  • MEDIUM – "explicitly overrides the deprecated method" detection. Please confirm the reflection walk covers the full class hierarchy (inherited overrides), is cached, and works for wrapped/decorated writers. A pointer to the relevant code or a unit test would be enough.
  • MEDIUM – behavior × include/exclude. Both docs/en/connectors/source/MySQL-CDC.md and the new "Schema change behavior" section leave undefined what happens to an event that is filtered out by include/exclude: is it dropped before the behavior policy applies, or does strict still fail on it? Please state this explicitly in both places.
  • MEDIUM – ignore ≈ strict. For every evolution-supported event type the two policies behave the same; please say so directly in the docs so users don't pick ignore expecting it to skip events.
  • LOW – deprecation window. Please add a target removal version for the deprecated applySchemaChange path, and align the incompatible-changes entry with the PR description.
  • LOW – behavior set while enabled = false. This is currently silently ignored; a config-time validation error or at least a warning log would help.

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.

@DanielLeens

Copy link
Copy Markdown
Contributor

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 e9c52313cfba2a64b713f743be95e80a00794072. Signal pull request update = SUCCESS; Build = ACTION_REQUIRED

Comparison: base dev, head e9c52313cfba2a64b713f743be95e80a00794072, diverged, ahead 12 / behind 60; GitHub mergeable state blocked. Behind/diverged alone is recorded metadata and does not add a sync request.

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.

@SEZ9

SEZ9 commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the work on this one. Following up on the current head e9c52313cfba2a64b713f743be95e80a00794072:

CI gate

The Build check is still ACTION_REQUIRED because no fork Build run was found for this SHA, while Signal pull request update is SUCCESS. This is an activation gap, not a test failure. Please open the Actions tab on your fork, enable workflows if they are disabled, and manually run the existing Build workflow for this branch. If a run for this exact head already exists, drop the link here and we'll reconcile it. No empty commit, dependency bump or base sync is needed for this — none of those can supply the missing run.

Open items from the previous review

These remain unaddressed on the unchanged head, so the requested-changes state still stands. Concretely:

  1. EVOLVE default vs. deprecated no-op writers (F1, HIGH) — With schema-changes.enabled = true, a sink whose writer still inherits the deprecated no-op applySchemaChange now fails where it previously ran. Either keep the legacy behavior as the default for such writers, or drop the "backward compatibility is preserved" wording and document this as the breaking change it is in docs/en/introduction/concepts/incompatible-changes.md. Please state which direction you're taking.
  2. Fail-fast restart loop (F2, HIGH) — Deterministic failures under strict/ignore (and evolve on unsupported events) will re-trigger on every checkpoint restore. Please describe how the job terminates rather than looping, or make the failure terminal, instead of leaving that to operators in docs/en/introduction/configuration/schema-evolution.md.
  3. Override detection (F3) — Please confirm the reflection check walks the full class hierarchy, is cached, and behaves correctly for wrapped/decorated writers. A short note or test pointer is fine.
  4. behavior × include/exclude (F4, F6) — Both MySQL-CDC.md and schema-evolution.md need a sentence on whether filtering is applied before the behavior policy (i.e. does a filtered-out event still fail under strict?).
  5. ignore ≡ strict for supported events (F5) — Please say this explicitly in the docs so users don't assume ignore is a lenient mode.
  6. Deprecation window (F7) — Add a target removal version for the deprecated applySchemaChange, and align the incompatible-changes entry with the PR description.
  7. behavior set while enabled = false (F8) — Add a config-time validation error or at least a warning rather than silently ignoring the option.

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.

@DanielLeens

Copy link
Copy Markdown
Contributor

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 e9c52313cfba2a64b713f743be95e80a00794072. Signal pull request update=SUCCESS; Build=ACTION_REQUIRED. Base dev, diverged, ahead 12/behind 63; merge blocked.

This is an unchanged-head discussion/CI clarification, not another full source review or an effective approval. Daniel has READ repository permission.

@SEZ9

SEZ9 commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Following up on the previous review — the head is still e9c52313cfba2a64b713f743be95e80a00794072, so the earlier points remain open. Nothing here is new scope; this is just a consolidated list of what I still need to see committed before the next full pass:

HIGH

  • F1 – EVOLVE default vs. deprecated no-op writers. Existing schema-changes.enabled = true jobs whose sink writer still inherits the deprecated no-op will now fail instead of running. Either keep a compatibility default for those writers or drop the "backward compatibility is preserved" wording and document the behavior change plainly in docs/en/introduction/concepts/incompatible-changes.md. Please state which option you're taking.
  • F2 – Deterministic fail-fast → restart loop. With strict/ignore (and evolve on unsupported events) the job will hit the same event after every checkpoint restore. I'd like to see the engine fail terminally (or at least a documented, bounded behavior) rather than docs/en/introduction/configuration/schema-evolution.md telling operators to manage the loop.

MEDIUM

  • F3 – Override detection. Please confirm (ideally with a test) that the "explicitly overrides the deprecated method" check walks the class hierarchy, handles wrapped/decorated writers, and caches the result.
  • F4 / F6 – behavior × include/exclude. Define the interaction once (is filtering applied before the policy? does an excluded event ever trigger strict failure?) and reference it from both docs/en/connectors/source/MySQL-CDC.md and the schema-evolution doc.
  • F5 – ignore ≡ strict for supported events. Say this explicitly in the docs so users don't pick ignore expecting a softer mode.

LOW

  • F7 – Removal timeline for the deprecated applySchemaChange path, and reconcile the incompatible-changes entry with the PR description.
  • F8 – schema-changes.behavior with enabled = false. A config-time warning or validation error is enough.

On CI: Signal pull request update (run 40166998382 / job 121480690360) is SUCCESS, but Build (121486382851) is ACTION_REQUIRED — please trigger/link the fork Build for this exact head so we have a real result to review against. Once the fixes above land in a new commit I'll do the next complete review. Thanks!

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks @SEZ9. I rechecked the specific F1/F2 claims against e9c52313cfba2a64b713f743be95e80a00794072, and I need to correct my earlier follow-up: it repeated stale source blockers. Sorry for that; no new commit is being credited with these existing protections.

  • F1: MultiTableSink.java:441-454 deliberately preserves null for an unadvertised legacy sink, while a modern sink's explicit null capability result becomes an empty list. MultiTableSinkWriter.java:556-595,605-614 preserves that distinction: unadvertised deprecated callbacks/no-ops retain the warning-based compatibility window. SinkFlowLifeCycle.java:890-927 has the same legacy fallback. The earlier claim that this head always hard-fails inherited legacy no-ops was incorrect.
  • F2: SchemaChangePolicyException implements NonRetryableException, and JobMaster.java:1347-1350 calls neverNeedRestore before propagating the task state. The guide at schema-evolution.md:184-187 also describes Zeta non-retryable and Flink SuppressRestartsException handling. The stale claim that this revision merely tells operators to manage an endless restart loop should not remain a blocker.
  • F3: SchemaChangePolicy.java:133-142 uses Class.getMethod, so inherited public overrides are considered. It does not unwrap arbitrary decorators or cache reflection results; those are not functionality I am claiming exists. Keep wrapper behavior explicit and treat caching as measured optional hardening rather than adding a classloader-retaining global cache.
  • F4/F6: SeaTunnelRowDebeziumDeserializeSchema.java:159 filters the schema event before downstream policy. The guide at :154-156 says excluded events never reach policy; the MySQL guide documents include then exclude precedence.
  • F5/F7/F8: the guide distinguishes comment-only IGNORE from row-layout failure, documents the one-release legacy window/removal in the next release, and says behavior has no effect when enabled=false. A warning for an inactive option remains optional; no new implementation is being requested here.

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 e9c52313cfba2a64b713f743be95e80a00794072, base dev; compare diverged, ahead 12 / behind 76; merge dirty / DIRTY; review decision REVIEW_REQUIRED. Behind/diverged is recorded independently and does not itself request a sync. Daniel has READ repository permission.

@CloverDew
CloverDew force-pushed the feature/add-configurable-schema-change-behavior-policies-for-cdc branch from e9c5231 to 38cfdbc Compare November 24, 2026 07:41
@CloverDew CloverDew changed the title [Feature][Connector-V2][CDC] Add configurable schema change behavior policies [Feature][Connector-V2][Flink-CDC] Add configurable schema change behavior policies Nov 24, 2026

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

@CloverDew
CloverDew force-pushed the feature/add-configurable-schema-change-behavior-policies-for-cdc branch from 38cfdbc to 016ce80 Compare November 24, 2026 12:38

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

@SEZ9

SEZ9 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

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

  • Restart loop: deterministic policy failures are now described as raising SuppressRestartsException, with external apply failures reported as a contextual sink error. Please confirm this covers strict, ignore, and evolve on unsupported events, and that the schema-evolution doc no longer leaves it to operators to break the loop.
  • ignore vs strict: the described behavior is that a comment change can be dropped in ignore while ADD COLUMN fails terminally. Please confirm the docs state explicitly which events ignore drops and that layout-changing events fail just as in strict.
  • Deprecation timeline: the re-review describes a one-release window for the deprecated callback/no-op. Please confirm that the incompatible-changes entry states this for applySchemaChange, and that it no longer conflicts with the "backward compatibility is preserved" wording.

Still open

  • Wrapped writers: the outer multi-table wrapper blocker is reported as still remaining. How is the "explicitly overrides the deprecated method" detection resolved when the writer sits behind that wrapper? Does the check walk the class hierarchy for inherited overrides, and is the result cached?
  • Existing jobs under the EVOLVE default: the path now ends in "modern apply or legacy callback/no-op warning". Does an existing schema-changes.enabled = true job whose sink writer inherits the deprecated no-op keep running with a warning, or does it still fail? The MultiTableSinkWriter dispatch change is also noted as affecting callers outside Flink, so please confirm the behavior there too and make the incompatible-changes entry match.
  • behavior with include/exclude: the described path applies the include/exclude filter before the behavior gate. Please state that ordering in both the MySQL-CDC page and the "Schema change behavior" section, so it is clear a filtered-out event never reaches strict/ignore/evolve.
  • schema-changes.behavior with schema-changes.enabled = false: the gate is described as active only when enabled. Is there now config-time validation or a warning for this combination, or is the option still silently ignored?

Once the wrapper blocker and the legacy no-op question are settled, the rest are doc confirmations.

@CloverDew
CloverDew force-pushed the feature/add-configurable-schema-change-behavior-policies-for-cdc branch from a92daca to 2551dda Compare November 25, 2026 13:36
@github-actions github-actions Bot added CI&CD and removed Zeta labels Nov 26, 2026

@TyrantLucifer TyrantLucifer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TyrantLucifer
TyrantLucifer added this pull request to the merge queue Nov 26, 2026
Merged via the queue into apache:dev with commit 2afc039 Nov 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature][Connector-V2][CDC] Add configurable schema change behavior policies

5 participants