Repository navigation
Conversation
…e/schema-evolution # Conflicts: # seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java # seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java # seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/test/java/org/apache/seatunnel/translation/flink/schema/SchemaOperatorTest.java
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: The existing writer-local schema evolution path (and the
LocalSchemaCoordinatorused to synchronize it) applies external DDL independently from every parallel Flink sink subtask/sibling sub-writer, and the synchronization mechanism is a JVM-process-local static singleton — which cannot actually coordinate subtasks that run in different TaskManager JVMs in a real cluster. - Fix approach: Split "apply the external DDL" (once, via a dedicated parallelism-1 operator) from "refresh writer-local state" (broadcast to every parallel sink writer), and replace the ack-based local coordinator with a pure Flink checkpoint-barrier-driven two-round gate on the source side (
SchemaOperator): buffered post-DDL rows are only released after a second checkpoint confirms every downstream operator, including the DDL-applying operator and every sink writer's refresh, has processed the schema-change control record. - One-sentence summary: Replaces a broken cross-JVM "local" coordinator with correct checkpoint-barrier-based coordination, and adds an opt-in SPI (
SupportCoordinatedSchemaEvolutionSink/SchemaChangeApplier/SupportSchemaRefreshSinkWriter) so JDBC/MultiTable sinks execute DDL exactly once instead of once per parallel writer.
1. Code Change Review
1.1 Core Logic Analysis
Source side (SchemaOperator.java): replaces the old LocalSchemaCoordinator.requestSchemaChange(...) ack-wait with a two-phase checkpoint gate: dispatchNextPendingSchemaChange emits the control record and records schemaChangeDispatchedCheckpointId; only on a later completed checkpoint does completeNextPendingSchemaChange drain the buffered rows. I traced the full runtime path: because Flink requires an operator to have processed every record preceding a checkpoint barrier on all of its input channels before it may forward that barrier, the second completed checkpoint after dispatch guarantees the control record has already been consumed by ExternalSchemaChangeOperator (parallelism 1, so the external DDL — a blocking call — has finished) and by every parallel SchemaRefreshBarrierOperator/sink-writer instance, before any buffered post-DDL row re-enters the stream. This is architecturally sound and is a real fix, not a workaround — the old LocalSchemaCoordinator (JVM-local weak-reference singleton, per its own Javadoc "Local coordinator ... only manages temporary communication") could never have worked correctly across TaskManager process boundaries in a distributed cluster.
Flink topology (SchemaEvolutionSinkFlow.java): for a coordinated sink, splits the stream into dataRows (forwarded unchanged) and schemaRows (routed through ExternalSchemaChangeOperator, parallelism 1, applies DDL once), then reconnects dataRows.connect(schemaRows.broadcast()) into SchemaRefreshBarrierOperator at sinkParallelism, .forward()ed into the sink. I verified the forward edge is safe because dataStreamSink.setParallelism(parallelism) is applied consistently in all three Flink-starter variants (13/20/common) after this PR (flink-13 already had it; flink-20 and flink-common gained it in this diff) — so the barrier operator and the sink operator always run at matching parallelism, which is required for .forward() to preserve the per-subtask 1:1 mapping the refresh logic depends on.
MultiTableSinkWriter / MultiTableSink: MultiTableSink now implements SupportCoordinatedSchemaEvolutionSink unconditionally, and createSchemaChangeAppliers() is invoked from both createWriter() and restoreWriter(). Important scope note for reviewers: this doesn't only change Flink behavior. MultiTableSinkWriter.applySchemaChange(event) — the legacy, engine-agnostic entry point still called directly by the Zeta engine (untouched by this PR) — now also opportunistically takes the new "apply DDL once, then refresh every sibling" path via canUseCoordinatedSchemaChange()/applyCoordinatedSchemaChange() whenever the target writers implement SupportSchemaRefreshSinkWriter (true for JDBC after this PR) and event.getChangeAfter() != null. I confirmed this is not double-executed on the Flink coordinated path (Flink routes exclusively through the new "schema_change_refresh" key → MultiTableSinkWriter.refreshSchema(), which never touches schemaChangeAppliers), so there's no double-DDL bug — but the PR title/description scope this as "[Flink]" only, while it also fixes (in a good way) the pre-existing #11785 "every sibling sub-writer re-executes the same ALTER TABLE" behavior for Zeta. Worth an explicit call-out in the PR description that Zeta's multi-table JDBC schema-evolution runtime behavior changes too.
JDBC (AbstractJdbcSinkWriter / JdbcSchemaChangeApplier): applySchemaChange now branches on event.getChangeAfter() — uses the exact evolved schema from the event when present (coordinated path), falls back to the existing tableSchemaChanger delta-apply otherwise (legacy path, unchanged). refreshSchema/refreshTableSchema guard outputFormat open/close with isOpen, and rebuild a fresh JdbcOutputFormat — this is idempotent, satisfying the SupportSchemaRefreshSinkWriter contract ("repeating a refresh with the same schema must be safe").
1.2 Compatibility Impact — Partially incompatible in behavior (not in API), fully compatible in API
All new interfaces (SchemaChangeApplier, SupportCoordinatedSchemaEvolutionSink, SupportSchemaRefreshSinkWriter) are additive and @Experimental; nothing existing is removed from the public API surface, and non-opted-in sinks keep the old BroadcastSchemaSinkOperator path untouched. However, as noted in 1.1, JDBC + MultiTableSink jobs (Flink and Zeta) now get materially different DDL-execution behavior (once vs. once-per-sibling) purely because AbstractJdbcSinkWriter now implements SupportSchemaRefreshSinkWriter — this is a runtime behavior change for existing users of that combination, even though no config/API contract changed. Recommend the PR description explicitly state this.
1.3 Performance / Side-Effect Analysis
MultiTableSink.createSchemaChangeAppliers()eagerly creates oneSchemaChangeApplierper coordinated table on every writer creation (i.e., once per parallel subtask). For JDBC this is cheap (JdbcSchemaChangeApplierholds only config references; the JDBC connection is opened lazily insideapply()), but the SPI itself doesn't document this expectation, so a future connector with a heaviercreateSchemaChangeApplier()implementation could multiply resource usage bysinkParallelism × tableCountunnecessarily. Not a blocker for this PR (only JDBC implements it today), but worth a Javadoc note onSupportCoordinatedSchemaEvolutionSink.createSchemaChangeApplierthat implementations should stay lazy/cheap since they're created once per parallel writer instance.close()in bothMultiTableSinkWriterandExternalSchemaChangeOperatorcorrectly close all createdSchemaChangeAppliers with first-exception-wins + suppressed-exception aggregation — no resource leak observed.
1.4 Error Handling and Logging
Issue 1 — Compile failure in new E2E test: MysqlCDCDriverResolver does not exist
- Location:
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/MysqlCDCWithFlinkCoordinatedSchemaEvolutionIT.java:108 - Problem:
protected final ContainerExtendedFactory extendedFactory = MysqlCDCDriverResolver::copyMySQLDriverToContainer;references a class (MysqlCDCDriverResolver) that does not exist anywhere in the repository. This is confirmed as the direct root cause of the current CI failure — the fork'sBuildrun failstest-compileonconnector-cdc-mysql-e2ewithcannot find symbol: variable MysqlCDCDriverResolver, which is whyunit-testfails on every JDK/OS combination andtransform-v2-it-part-1also fails (whole reactor test-compile is poisoned). - Potential risk: PR cannot pass CI or be merged in its current state; nothing downstream of this module can even be compiled/tested.
- Best improvement: Use the same pattern already established by the sibling test
MysqlCDCWithFlinkSchemaChangeIT.java:109-113in this same package:protected final ContainerExtendedFactory extendedFactory = container -> DependencyJar.ofClassName("com.mysql.cj.jdbc.Driver") .copyTo(container, "/tmp/seatunnel/plugins/MySQL-CDC/lib");
- Severity: High
- Raised by another reviewer: No
Issue 2 — Dead code left behind: LocalSchemaCoordinator is now completely unreferenced
- Location:
seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/schema/coordinator/LocalSchemaCoordinator.java - Problem: This PR removes the only two call sites of
LocalSchemaCoordinator(SchemaOperator.java'scoordinator.requestSchemaChange(...)andFlinkSinkWriter.java'ssendSchemaChangeAck(...)→coordinator.notifySchemaChangeApplied(...)), but the class file itself (including its static instance registry, weak references, and backgroundScheduledThreadPoolExecutorcleanup thread) is left in the tree. I confirmed viagit grepacross the full PR head that no file referencesLocalSchemaCoordinatoranymore. - Potential risk: Dead code confuses future maintainers about which coordination mechanism is actually in use, and it's debt directly created by this PR's own refactor, not pre-existing.
- Best improvement: Delete
LocalSchemaCoordinator.java(and its test, if any exists) in this PR. - Severity: Medium
- Raised by another reviewer: No
Issue 3 — Test coverage gap: AbstractJdbcSinkWriter.applySchemaChange()'s new branching isn't directly exercised
- Location:
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/AbstractJdbcSinkWriter.java:62-70vs. the new testJdbcCoordinatedSchemaEvolutionTest.appliesExternalChangeOnceAndRefreshesEveryWriter() - Problem: The new test constructs a
JdbcSchemaChangeApplierdirectly and callswriter.refreshSchema(evolvedTable)directly — it never callswriter.applySchemaChange(event)itself, so the newevent.getChangeAfter() == null ? ... : ...branch insideapplySchemaChange(the method actually invoked by the legacy/Zeta coordinated path inMultiTableSinkWriter.applyCoordinatedSchemaChangeisn't — that one callsrefreshSchemadirectly too — but is invoked by any non-multi-table single JDBC sink writer, and byapplySchemaChangeToTarget's legacy fallback) has no direct new-test coverage for thegetChangeAfter() != nullbranch. - Potential risk: Low immediate risk since the branch is a straightforward field read, but a future refactor of this method wouldn't be caught by a regression test.
- Best improvement: Add a small test that calls
writer.applySchemaChange(event)directly withevent.getChangeAfter()set, asserting both that DDL executes and the local schema refreshes, rather than only testing the extracted pieces separately. - Severity: Low
- Raised by another reviewer: No
Issue 4 (informational, non-blocking) — millisecond wall-clock timestamp reused as ordering "epoch"
- Location:
seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/schema/SchemaRefreshBarrierOperator.java:76(this.epoch = schemaChangeEvent.getCreatedTime();), mirroring the pre-existing pattern inBroadcastSchemaSinkOperator.java - Problem:
TableEvent.createdTimeisSystem.currentTimeMillis()at construction (TableEvent.java:33).SchemaRefreshBarrierOperator.processElement2throwsIllegalStateExceptiononly when a new event's epoch is strictly less than the currently-tracked epoch, so same-millisecond back-to-back schema changes on the same table wouldn't be flagged as a genuine ordering problem — they'd just both apply, in webhook/network-arrival order, without an explicit tie-break. - Potential risk: Low — this pattern is inherited unchanged from the existing
BroadcastSchemaSinkOperator, not newly introduced, and rapid same-millisecond DDL on one table is an edge case. - Best improvement: Non-blocking; could use a monotonic per-table sequence counter instead of wall-clock time in a follow-up if this ever proves problematic in practice.
- Severity: Low
- Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
New public/package classes and methods are consistently documented with class- and method-level Javadoc (SchemaChangeApplier, SupportCoordinatedSchemaEvolutionSink, SupportSchemaRefreshSinkWriter, SchemaEvolutionSinkFlow, ExternalSchemaChangeOperator, SchemaRefreshBarrierOperator, and the new methods on MultiTableSinkWriter/MultiTableSink) — good adherence to the project's doc-comment expectations for non-trivial connector-facing SPI. No inline single-line /** ... */ Javadoc violations spotted in the diff.
2.2 Test Coverage and Test Stability
Coverage is genuinely broad: new unit tests for the barrier/dispatch logic in MultiTableSinkWriterSchemaChangeBroadcastTest (both refreshSchemaDelegatesToEveryAffectedSubWriter and coordinatedSchemaChangeAppliesExternalChangeOnceAndRefreshesEverySibling), SchemaOperatorTest.testDispatchedSchemaChangeKeepsBufferedRecordsBlocked (directly exercises the two-checkpoint gate), ExternalSchemaChangeOperatorTest, SchemaRefreshBarrierOperatorTest, FlinkSinkWriterTest, plus a new JDBC test and a substantial new Flink E2E IT (MysqlCDCWithFlinkCoordinatedSchemaEvolutionIT, parallel + failover scenarios). All unit tests I checked use Awaitility/deterministic synchronization rather than raw Thread.sleep polling for assertions, and the E2E IT consistently uses await().atMost(...) rather than fixed sleeps.
Flaky-test rating: Stable (modulo Issue 1, which is a compile error, not flakiness — it needs to actually compile before stability can be assessed at all).
2.3 Documentation Updates
No docs/en/docs/zh changes in this PR. Given the new SPI is @Experimental and connector-developer-facing rather than a new end-user config option, this is acceptable, but a short mention in the Flink/CDC schema-evolution developer docs (how a connector opts in to SupportCoordinatedSchemaEvolutionSink) would help future connector authors. Non-blocking.
3. Architectural Soundness
3.1 Precise fix / temporary workaround / long-term solution
This is a genuine, long-term-correct fix, not a workaround. The core mechanism — using Flink's own checkpoint-barrier alignment as the distributed synchronization primitive instead of an in-process ack coordinator — is the right way to solve this class of problem, and it removes a mechanism (LocalSchemaCoordinator) that could not have worked correctly across TaskManager process boundaries.
3.2 Maintainability
Good separation of concerns (SchemaChangeApplier = pure external-DDL side effect, SupportSchemaRefreshSinkWriter = pure writer-local state refresh), which makes it easy to reason about what runs exactly once vs. what runs per-parallel-writer. The one deduction here is Issue 2 (dead code left behind).
3.3 Extensibility
The opt-in interface design means other connectors (not just JDBC) can adopt coordinated schema evolution incrementally without being forced to, and MultiTableSink.supportsCoordinatedSchemaEvolution() correctly degrades to the legacy per-writer path when any child sink doesn't support it.
3.4 Historical-version compatibility (restate)
API-compatible (additive-only interfaces); the Flink SchemaOperator state now includes a new schemaChangeDispatchedCheckpointIdState list state alongside the pre-existing ones, restored defensively (defaults to -1L when absent), so restoring a savepoint/checkpoint taken by the old SchemaOperator (pre-PR) should still initialize safely into the new field's default. I did not find a dedicated restore-from-old-state-format test for this specific new field; given the checkpoint-based mechanism is the crux of this PR's correctness claim, a test restoring from a snapshot that lacks schemaChangeDispatchedCheckpointIdState (simulating upgrade from a job started on the pre-PR code) would strengthen confidence here.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | MysqlCDCDriverResolver doesn't exist — compile failure breaks all CI |
MysqlCDCWithFlinkCoordinatedSchemaEvolutionIT.java:108 |
High |
| 2 | LocalSchemaCoordinator left as dead/unreferenced code |
translation/flink/schema/coordinator/LocalSchemaCoordinator.java |
Medium |
| 3 | New applySchemaChange() branch not directly unit-tested |
AbstractJdbcSinkWriter.java:62-70 |
Low |
| 4 | Wall-clock millis reused as ordering epoch (pre-existing pattern) | SchemaRefreshBarrierOperator.java:76 |
Low |
5. Merge Recommendation
Conclusion: Not recommended for merge
-
Blockers
- Issue 1 (High): fix the compile error so CI can actually run — swap in the existing
DependencyJar.ofClassName("com.mysql.cj.jdbc.Driver").copyTo(...)pattern already used by the sibling test. - Issue 2 (Medium): remove the now-dead
LocalSchemaCoordinator.javaas part of this PR's own cleanup.
- Issue 1 (High): fix the compile error so CI can actually run — swap in the existing
-
Recommended fixes (non-blocking)
- Issue 3: add a direct test for
AbstractJdbcSinkWriter.applySchemaChange()'s newgetChangeAfter() != nullbranch. - Explicitly call out in the PR description that this also changes multi-table JDBC schema-evolution DDL-execution behavior for the Zeta engine (not just Flink), since
MultiTableSinkWriter's legacyapplySchemaChange()entry point picks up the new coordinated path too. - Consider a restore-from-old-checkpoint-format test for
SchemaOperator's newschemaChangeDispatchedCheckpointIdState.
- Issue 3: add a direct test for
Overall assessment: The architectural direction here is a real improvement — replacing a fundamentally broken JVM-local coordinator with a correct checkpoint-barrier-based coordination scheme is exactly the right fix, and the opt-in SPI design (SchemaChangeApplier / SupportCoordinatedSchemaEvolutionSink / SupportSchemaRefreshSinkWriter) is clean and well-tested where it's exercised. Once the compile error is fixed and CI is green, and the dead code is removed, I'd be glad to take another look. Great work on the checkpoint-alignment design — that's the hard part, and it looks correct.
SEZ9
left a comment
There was a problem hiding this comment.
Thanks for working on this. I reviewed the latest head 199e786b2cf7.
What this PR fixes
- User pain: Parallel Flink sink writers each execute external DDL independently for schema evolution, so concurrent/duplicate DDL from sibling subtasks causes conflicts, and there is no engine-level mechanism to apply a schema change once and propagate the evolved schema to all writers.
- Fix approach: Introduce an opt-in coordinated SPI (
SupportCoordinatedSchemaEvolutionSink,SchemaChangeApplier,SupportSchemaRefreshSinkWriter) that separates single-operator external DDL execution from writer-local schema refresh, with Flink broadcasting the full evolved schema and gating post-change rows on checkpoint confirmation; JDBC and MultiTable sinks implement it. - One-line summary: The SPI split and Flink coordination design are sound and well-tested, but the MultiTableSink integration has real problems — every parallel writer eagerly opens a
SchemaChangeApplierper table (contradicting the SPI's own "engine creates only the selected applier" contract and multiplying external connections by parallelism × table count), a failure increateSchemaChangeAppliers()leaks already-built sub-writers while ignoringMultiTableFailurePolicyso one unreachable table blocks recovery for all tables, andcreateSchemaChangeApplier(TablePath)resolves ambiguously on first match with a key space (logicalfullName) inconsistent with the physical-path applier it returns — plus the writer-must-implement-SupportSchemaRefreshSinkWriterrequirement is javadoc-only and unenforced.
Runtime chain I rechecked
MultiTableSink.createWriter(context) MultiTableSink.java:135
-> per-table sink.createWriter(...) builds all sub-writers first
-> MultiTableSink.createSchemaChangeAppliers() MultiTableSink.java:231
-> iterates sinks; for each SupportCoordinatedSchemaEvolutionSink checks supportsCoordinatedSchemaEvolution() MultiTableSink.java:236-241
-> resolves physical path via raw Optional<?> getWriteCatalogTable() cast to CatalogTable MultiTableSink.java:242-246
-> sink.createSchemaChangeApplier(physicalSinkTable) — eagerly opens applier per table per parallel writer MultiTableSink.java:247-250
-> on exception: closes appliers only, sub-writers created above are leaked MultiTableSink.java:252-263
-> new MultiTableSinkWriter(..., schemaChangeAppliers) MultiTableSink.java:145-156, MultiTableSinkWriter.java:216-228
Coordinated DDL path (engine side):
Flink coordinator selects applier -> MultiTableSink.createSchemaChangeApplier(requestedTablePath) MultiTableSink.java:280
-> first-match scan over sinks map comparing logical key OR physical path MultiTableSink.java:283-293 (nondeterministic when multiple logical tables share one physical table)
-> SchemaChangeApplier.apply(event) SchemaChangeApplier.java:36 (idempotency contract javadoc-only)
-> broadcast evolved schema -> MultiTableSinkWriter.refreshSchema(evolvedSchema) via SupportSchemaRefreshSinkWriter MultiTableSinkWriter.java:79-80, SupportSchemaRefreshSinkWriter.java:36 (sub-writer implementing SupportSchemaRefreshSinkWriter is unenforced at construction)
Findings
Issue 1: MultiTableSink eagerly opens one SchemaChangeApplier per table on every parallel writer, contradicting the SPI contract and holding external connections for the whole job lifetime
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:232 - Why it matters: - Root cause:
createWriterandrestoreWriterboth callcreateSchemaChangeAppliers(), which instantiates an applier for every coordinated per-table sink up front, even though the new SPI javadoc explicitly states "The engine creates and invokes only the applier selected for the coordinated schema change." - Impact: for a JDBC multi-table CDC job, each applier wraps a connection provider, so a job with M tables and parallelism N opens N×M external connections at startup that sit idle unless a schema change actually arrives for that table. Beyond wasting resources, this can exhaust the sink database's connection limit on large multi-table jobs.
- Suggested fix: create each applier lazily on the first schema-change event for its table (memoized, e.g. via
computeIfAbsent), rather than at writer construction. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:225 createSchemaChangeAppliers());; `seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SupportCoordinatedSchemaEvolutionSink.java:44 *The engine creates and invokes only the applier selected for the coordinated schema
- change.
;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:235 for (Map.Entry<TablePath, SeaTunnelSink> entry : sinks.entrySet()) {`
- change.
- Suggested fix:
createSchemaChangeAppliers()eagerly creates one applier (a live JDBC connection provider in the JDBC case) for every coordinated table on every parallel writer, even though theSupportCoordinatedSchemaEvolutionSinkjavadoc says the engine creates only the applier selected for a specific schema change. With M tables × N parallelism this holds N×M idle external connections for the whole job even if no DDL ever arrives, and can exhaust the sink DB's connection limit. Please create appliers lazily on the first schema change per table (memoized viacomputeIfAbsent) instead of at writer construction. - Severity: High
Issue 2: MultiTableSink eagerly creates a SchemaChangeApplier for every table in every parallel writer on every engine, even when coordinated schema evolution is never used
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:156 - Why it matters: - Root cause:
createWriterandrestoreWriternow unconditionally evaluatecreateSchemaChangeAppliers()and hand the full map to eachMultiTableSinkWriterinstance. The loop instantiates one applier per coordinated child sink regardless of whether schema evolution is even enabled for the job, and regardless of engine (Zeta and Spark also go throughMultiTableSink.createWriter, but the coordinated flow is Flink-only). - Impact: for a JDBC multi-table sync with T tables and parallelism P, the job creates T×P applier instances (and any connections or providers they hold) at startup. Existing Zeta multi-table pipelines pay this cost on upgrade despite never using the coordinated flow.
- Suggested fix: create appliers lazily on the first schema-change event, or gate applier creation on schema evolution actually being enabled, and ensure
MultiTableSinkWriter.close()disposes them. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:247 schemaChangeAppliers.put( entry.getKey().getFullName(), ((SupportCoordinatedSchemaEvolutionSink) sink) .createSchemaChangeApplier(physicalSinkTable));;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:229 this.schemaChangeAppliers = new HashMap<>(schemaChangeAppliers);;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:225 createSchemaChangeAppliers()); - Suggested fix: This eagerly creates one
SchemaChangeApplierper coordinated child sink for every parallel writer, on every engine (Zeta/Spark also callcreateWriter), even when schema evolution is disabled for the job. With JDBC children this can mean T tables × P parallelism applier instances (and whatever connections they hold) per job — a resource regression for existing Zeta multi-table pipelines on upgrade, and it contradicts the coordinated design where only the single selected applier should execute DDL. Please create appliers lazily on the first schema-change event (or gate this on schema evolution actually being enabled), and make sureMultiTableSinkWriter.close()disposes them. - Severity: Medium
Issue 3: createSchemaChangeApplier(TablePath) resolves the target sink nondeterministically when multiple logical tables map to the same physical sink table, and the applier map keying is inconsistent (logical fullName key vs physical-path applier)
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:289 - Why it matters: - Root cause:
createSchemaChangeApplieriteratessinks.entrySet()(aHashMap, so iteration order is unspecified) and accepts an entry if either the logical key or the derived physical table matchesrequestedTablePath, returning the first hit. With table routing (e.g., several source tables written into one physical sink table viagetWriteCatalogTable()), multiple entries share the same physical sink table, so which child sink's applier is chosen is nondeterministic — and different children can carry different evolved schemas or configuration. - Related inconsistency:
createSchemaChangeAppliers()keys the applier map by the logicalgetFullName()while each applier targets the physical path, so N logical tables sharing one physical table yield N appliers that may each execute the same DDL. - Suggested fix: match on the logical key first, fall back to the physical path only when that match is unique (raise an error on ambiguity), and deduplicate appliers by physical
TablePath. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:248 entry.getKey().getFullName(),;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:288 if (!entry.getKey().equals(requestedTablePath);seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:289 && !physicalSinkTable.equals(requestedTablePath)) { - Suggested fix: Matching on
logical key OR physical pathover aHashMapiteration means that when several logical tables route to the same physical sink table, which child's applier gets returned is nondeterministic (and children can carry different evolved schemas/config). Note also thatcreateSchemaChangeAppliers()keys by the logicalgetFullName()while the applier targets the physical path, so N logical tables sharing one physical table produce N appliers that may each execute the same DDL. Please match on the logical key first, fall back to the physical path only when the match is unique (error on ambiguity), and deduplicate appliers by physicalTablePath. - Severity: Medium
Issue 4: New public SchemaChangeApplier SPI executes source-derived DDL but its contract omits identifier-safety requirements
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SchemaChangeApplier.java:36 - Why it matters: - Root cause:
SchemaChangeApplier.apply(SchemaChangeEvent)is a new public SPI whose implementations (e.g. the newJdbcSchemaChangeApplier) translate upstream schema-change events into DDL executed against the sink database. Column and table identifiers in those events originate from the source database's binlog/DDL stream, which in multi-tenant or shared-source deployments is not trusted input from the sink's perspective. - Impact: the interface javadoc carefully mandates idempotency but is silent on identifier safety, so third-party implementations that string-concatenate raw event identifiers into DDL open a SQL injection channel into the sink, executed with the sink's credentials.
- Suggested fix: extend the interface contract to require that all event-derived identifiers be quoted/validated through the sink dialect before being embedded in DDL.
- Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SchemaChangeApplier.java:25 /** Applies schema changes to an external sink system without managing writer-local state. */; `seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SchemaChangeApplier.java:31 *The same event can be delivered again after recovery. Implementations must treat an
- already-applied compatible change as success and fail when the external schema conflicts with
- the requested change.`
- Suggested fix: This SPI executes DDL on the external sink from identifiers carried in
SchemaChangeEvent, which come from the (potentially untrusted) source database's DDL stream. The javadoc mandates idempotency but is silent on identifier safety — third-party implementations that string-concatenate raw event identifiers into DDL open a SQL injection channel into the sink with the sink's credentials. Please add a contract requirement that implementations must quote/validate all event-derived identifiers via the sink dialect (e.g.JdbcDialect.quoteIdentifier) and never assemble DDL from raw identifiers. - Severity: Medium
Issue 5: New coordinated schema evolution capability ships with no documentation update (concept docs, connector dev guide, or feature docs)
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SupportCoordinatedSchemaEvolutionSink.java:32 - Why it matters: - Root cause: this PR introduces a brand-new, user-visible capability — engine-coordinated schema evolution for parallel Flink sink writers — plus three new public SPI interfaces (
SchemaChangeApplier,SupportCoordinatedSchemaEvolutionSink,SupportSchemaRefreshSinkWriter), but no file underdocs/is touched and the PR description marks 'user-facing change' as No. - Impact: users cannot discover that Flink parallel sinks now support schema evolution (previously a known limitation), which connectors opt in, or what the fallback behavior is for sinks that do not; connector developers likewise have no guide for implementing the new SPI.
- Suggested fix: update
docs/en/concept/schema-evolution.md(and the zh version) and add developer-guide notes for the new interfaces. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SchemaChangeApplier.java:27 public interface SchemaChangeApplier extends AutoCloseable {;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SupportSchemaRefreshSinkWriter.java:27 public interface SupportSchemaRefreshSinkWriter {;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SupportCoordinatedSchemaEvolutionSink.java:28 * <p>Writers created by an implementation must also implement {@link - Suggested fix: This is a genuinely user-visible feature (Flink parallel sinks gaining schema evolution) plus a new connector SPI, but I don't see any
docs/changes in this PR. Please updatedocs/en/concept/schema-evolution.md(and the zh version) to describe coordinated schema evolution on Flink — which connectors opt in, the fallback for unsupported sinks — and add developer-guide notes for implementingSupportCoordinatedSchemaEvolutionSink/SupportSchemaRefreshSinkWriter. - Severity: Medium
Issue 6: The SupportCoordinatedSchemaEvolutionSink contract that writers must implement SupportSchemaRefreshSinkWriter is javadoc-only and unenforced, so a partially-implemented connector fails (or silently skips refresh) at runtime mid-DDL
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SupportCoordinatedSchemaEvolutionSink.java:28 - Why it matters: - Root cause: the new SPI states 'Writers created by an implementation must also implement SupportSchemaRefreshSinkWriter' purely in a javadoc comment on the interface; nothing at plan/translation time validates that
sink.createWriter(...)actually returns aSupportSchemaRefreshSinkWriter. - Impact: a third-party or future connector that opts into
SupportCoordinatedSchemaEvolutionSinkbut forgets the writer capability will pass the engine's capability check (supportsCoordinatedSchemaEvolution()defaults totrue) and be routed onto the coordinated flow, only to fail — or silently skip the schema refresh — when the first DDL's evolved-schema broadcast reaches the writer, i.e. mid schema change with post-change rows held by the barrier. - Suggested fix: enforce the invariant fail-fast with an
instanceof SupportSchemaRefreshSinkWritercheck when the coordinated flow is selected. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SupportCoordinatedSchemaEvolutionSink.java:38 default boolean supportsCoordinatedSchemaEvolution() { return true; } - Suggested fix: This writer-capability requirement is only stated in javadoc, but
supportsCoordinatedSchemaEvolution()defaults totrue, so a connector implementing this interface without aSupportSchemaRefreshSinkWriterwriter will be routed onto the coordinated Flink flow and only fail (or silently skip the refresh) when the first DDL's schema broadcast reaches the writer — mid schema change, with post-change rows held by the barrier. Please enforce this invariant fail-fast, e.g. aninstanceof SupportSchemaRefreshSinkWritercheck when the coordinated flow is selected in the Flink SinkExecuteProcessor/translation layer, with an error naming the offending sink. - Severity: Medium
Issue 7: Eager per-writer, per-table applier creation multiplies external resource footprint by parallelism × table count
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:232 - Why it matters: - Root cause:
createSchemaChangeAppliers()iterates every coordinated child sink and instantiates aSchemaChangeApplierup front, and this runs insidecreateWriter/restoreWriter, i.e. once per parallel subtask. - Impact: for a multi-table CDC job (e.g. 200 tables at parallelism 8) this creates 1600 applier instances that exist solely for the rare event of a DDL change; if
JdbcSink.createSchemaChangeApplierbacks each applier with its own connection provider, that translates into a large pool of idle sink connections held for the job's entire lifetime. - Suggested fix: create the applier lazily on the first schema-change event for the affected table (closing it after
apply), or reuse the child writer's existing connection provider. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:247 schemaChangeAppliers.put(;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:229 this.schemaChangeAppliers = new HashMap<>(schemaChangeAppliers); - Suggested fix: This eagerly builds one
SchemaChangeApplierfor every coordinated child sink, and it runs per parallel subtask (createWriter/restoreWriter). For a large multi-table job that means parallelism × tables applier instances — each potentially holding a sink DB connection provider — kept alive for the whole job just in case a DDL event arrives, even though the coordination design guarantees only one selected applier ever executes the DDL. Please create the applier lazily on the first schema-change event for the affected table (closing it afterapply), or reuse the child writer's connection provider. - Severity: Medium
Issue 8: No upgrade note covering checkpoint/savepoint restore for schema-evolution jobs after the Flink sink coordination changes
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:225 - Why it matters: - Root cause: this PR changes how schema evolution is coordinated on the Flink engine (the change set touches seatunnel-translation/seatunnel-translation-flink, and
restoreWriternow wiresSchemaChangeApplierinstances intoMultiTableSinkWriter), yetincompatible-changes.mdand the upgrade docs are not updated. - Impact: users running Flink schema-evolution jobs have no guidance on whether restoring a pre-upgrade checkpoint/savepoint onto the new coordinated flow is compatible, or whether they must restart affected jobs without state.
- Suggested fix: document the restore behavior for schema-evolution jobs across this upgrade — either an
incompatible-changes.mdentry with a migration path, or an explicit compatibility confirmation. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:206 tableRetryIntervalSeconds,;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:264 throw new IOException("Failed to create schema change appliers", e); - Suggested fix: The restore path now wires
SchemaChangeApplierinstances into the writer as part of the new coordinated schema-evolution flow on Flink. If restoring a pre-upgrade Flink checkpoint/savepoint onto the new flow is not compatible for schema-evolution jobs, please add an entry toincompatible-changes.mdexplaining the migration path (e.g. restart without state). If restore is compatible, a short note in the PR description confirming that would also help release management. - Severity: Medium
Review conclusion
Conclusion: can merge after the blocking items are fixed
1. Blocking items
- Issue 1: MultiTableSink eagerly opens one SchemaChangeApplier per table on every parallel writer, contradicting the SPI contract and holding external connections for the whole job lifetime
2. Remaining follow-ups
- Issue 2: MultiTableSink eagerly creates a SchemaChangeApplier for every table in every parallel writer on every engine, even when coordinated schema evolution is never used
- Issue 3: createSchemaChangeApplier(TablePath) resolves the target sink nondeterministically when multiple logical tables map to the same physical sink table, and the applier map keying is inconsistent (logical fullName key vs physical-path applier)
- Issue 4: New public SchemaChangeApplier SPI executes source-derived DDL but its contract omits identifier-safety requirements
- Issue 5: New coordinated schema evolution capability ships with no documentation update (concept docs, connector dev guide, or feature docs)
- Issue 6: The SupportCoordinatedSchemaEvolutionSink contract that writers must implement SupportSchemaRefreshSinkWriter is javadoc-only and unenforced, so a partially-implemented connector fails (or silently skips refresh) at runtime mid-DDL
- Issue 7: Eager per-writer, per-table applier creation multiplies external resource footprint by parallelism × table count
- Issue 8: No upgrade note covering checkpoint/savepoint restore for schema-evolution jobs after the Flink sink coordination changes
Thanks for the updates so far. Happy to discuss the remaining points.
|
Thanks for the second review pass, @SEZ9. I rechecked your findings against the current head ( Issue 1/2/7 (eager per-table applier creation) — confirmed, High. Issue 3 (nondeterministic applier resolution + key mismatch) — confirmed, Medium. Issue 6 (writer-must-implement-SupportSchemaRefreshSinkWriter is unenforced until dispatch time) — confirmed, Medium. There's no I didn't independently re-verify Issues 4 (identifier-safety/SQL-injection contract gap), 5 (missing docs), and 8 (no incompatible-changes.md entry for restore behavior) line-by-line, but given the accuracy of 1/2/3/6/7 above I have no reason to doubt them, and they read as reasonable asks for a new public SPI. @dybyte — this reinforces "not ready to merge" beyond what I flagged: on top of my Issue 1 (the |
|
Thanks for the thorough recheck against On the confirmed items, here's what I'd consider done vs. still open:
Nothing beyond these — once you push the fixes, ping me with the new head and I'll do a focused re-review against just these items. |
|
Thanks, @SEZ9 — glad we've converged on the same blocking list independently, that gives @dybyte a clean, unambiguous set of asks instead of two separate threads to reconcile. Your framing on Issue 3 (key consistently by physical path, since that's what the applier actually operates on) is a good concrete recommendation — better than what I'd left as an open question, so let's go with that. Same for the construction-time check on Issue 6 and the specific asks on 4/5/8 — all reasonable and none of it changes my read of the core design, which I still think is sound. @dybyte, to summarize where this leaves things: please address, as blockers, (1) the |
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: The pre-existing writer-local schema evolution path applies external DDL independently from every parallel Flink sink subtask/sibling sub-writer, and (before this PR) synchronization relied on a JVM-process-local static singleton (
LocalSchemaCoordinator) that cannot coordinate subtasks running in different TaskManager JVMs. - Fix approach: Split "apply the external DDL" (once, via a dedicated parallelism-1
ExternalSchemaChangeOperator) from "refresh writer-local state" (broadcast to every parallel sink writer), coordinated by a checkpoint-barrier-driven two-round gate on the source side (SchemaOperator), plus a new opt-in SPI (SupportCoordinatedSchemaEvolutionSink/SchemaChangeApplier/SupportSchemaRefreshSinkWriter) so JDBC sinks execute DDL exactly once instead of once per parallel writer. - One-sentence summary: Replaces a broken cross-JVM "local" coordinator with correct checkpoint-barrier-based coordination for Flink, and this latest push additionally removes a duplicate/buggy coordinated-dispatch mechanism that had leaked into the engine-agnostic
MultiTableSink/MultiTableSinkWriter.
I am re-reviewing this PR from scratch against the current head (627f04b), not just the delta. I read the full dev...head diff, the previous review rounds from both myself and @SEZ9, and the follow-up comment thread. First, an apology and a correction: in my first-round review I wrote that the (now-removed) MultiTableSinkWriter/MultiTableSink coordinated-dispatch path was "not double-executed on the Flink coordinated path" and treated it mainly as an undocumented Zeta scope-creep concern. @SEZ9's Issues 1/2/3/7 correctly identified that this same code was also broken in its own right (eager per-subtask applier creation, non-deterministic HashMap-iteration-order applier selection) independent of the double-execution question — that was a real gap in my original pass, not something new in this round, and I'm folding it in here as a carryover rather than claiming credit for finding it myself.
1. Code Change Review
1.1 Core Logic Analysis
What changed since the last reviewed commit (199e786b → 627f04b), verified via gh api .../compare/199e786b...627f04b:
-
MultiTableSink.java(seatunnel-api/.../multitablesink/MultiTableSink.java): the eagercreateSchemaChangeAppliers()method (previously invoked unconditionally from bothcreateWriter()andrestoreWriter(), instantiating oneSchemaChangeApplierper coordinated child sink on every call, i.e. once per parallel subtask) is deleted entirely.createSchemaChangeApplier(TablePath)is rewritten to resolve deterministically:- exact logical-key match (
sinks.get(requestedTablePath)) is tried first and wins outright; - otherwise it streams over all sinks, resolves each one's physical table via the new private
resolvePhysicalSinkTable(...), and only proceeds if exactly one sink's physical table matches the request; - more than one physical match now throws
IOException("Ambiguous physical sink table ... is shared by logical tables: ...")instead of silently picking whichever entry aHashMaphappens to iterate first.
This is a real, verifiable fix for SEZ9's Issue 3 (nondeterministic applier resolution / key mismatch), not just a rename — the ambiguous case is a hard failure now, not silent misrouting.
- exact logical-key match (
-
MultiTableSinkWriter.java: theschemaChangeAppliersfield, the corresponding constructor parameter,canUseCoordinatedSchemaChange(),applyCoordinatedSchemaChange(), and theirclose()-time cleanup are all removed.dispatchSchemaChangeToTargets()now unconditionally falls through to the plain per-targetapplySchemaChangeToTarget()loop. Net effect: the engine-agnosticMultiTableSinkWriter(shared by Zeta, Spark, and Flink) no longer does any "apply-once-then-refresh-siblings" dispatch — that responsibility now lives exclusively in the Flink-onlyExternalSchemaChangeOperator/SchemaEvolutionSinkFlowpath (pre-existing from earlier commits in this PR, at parallelism 1). This directly resolves SEZ9's Issues 1/2/7 (eager, per-parallel-instance applier creation held for the job's lifetime) by deleting the buggy mechanism rather than patching it, and it also removes the previously-undocumented Zeta side-effect I should have flagged in round 1 (Zeta'sMultiTableSinkWriter.applySchemaChange()opportunistically taking the coordinated path). I confirmed the removal is clean:MultiTableSinkWriterSchemaChangeBroadcastTest.java'scoordinatedSchemaChangeAppliesExternalChangeOnceAndRefreshesEverySiblingtest (which exercised the now-deleted constructor overload andappliersmap) is deleted in the same commit, along with its now-unused imports — no stale references left behind that would break compilation. -
FlinkSink.java: addsvalidateCoordinatedSchemaEvolutionWriter(...), called fromcreateWriter()/restoreWriter()right after the writer is built. If the sink declaresSupportCoordinatedSchemaEvolutionSink+supportsCoordinatedSchemaEvolution()==truebut the concrete writer does not implementSupportSchemaRefreshSinkWriter, it closes the half-built writer and throwsIOExceptionimmediately. This is a real fix for SEZ9's Issue 6: the previous state was that this contract was enforced only insideMultiTableSinkWriter.java:565-570at first-DDL-dispatch time — i.e. after post-change rows were already buffered behind the checkpoint barrier. Now it fails at writer-construction/job-startup time, before any data flows. Verified directly by the new testtestCoordinatedSinkRejectsWriterWithoutSchemaRefreshSupportinFlinkSinkWriterTest.java, which also asserts the half-built writer is actually closed on this failure path (no leak). -
SchemaChangeApplier.java(interface javadoc): now states explicitly that "Table, column, and other identifiers carried by the event must be treated as untrusted input. Implementations must validate and quote every event-derived identifier through the sink system's dialect or identifier API and must not concatenate raw identifiers into DDL." This addresses SEZ9's Issue 4 as a documented SPI contract. I did not re-audit everyJdbcDialect.applySchemaChange(...)implementation for actual quoting (that's pre-existing shared code, reused rather than introduced by this PR, and out of this diff's blast radius) — flagging that as a scope boundary, not a finding against this PR. -
Compile-breaking bug from my original review is fixed:
MysqlCDCWithFlinkCoordinatedSchemaEvolutionIT.java:108no longer references the nonexistentMysqlCDCDriverResolver; it now uses the sameDependencyJar.ofClassName("com.mysql.cj.jdbc.Driver").copyTo(...)pattern as the siblingMysqlCDCWithFlinkSchemaChangeIT, exactly as I suggested in round 1.LocalSchemaCoordinator.javaandSinkStateProvider.java(the dead/unreferenced code from Issue 2) are deleted outright rather than left to rot, andSinkStateProvider's replacement responsibility moved cleanly into the newSupportSchemaRefreshSinkWriterinterface inseatunnel-api.
Runtime path for the coordinated case (Flink), traced end to end: source-side SchemaOperator buffers post-DDL rows and only releases them after a second completed checkpoint confirms the control record was consumed everywhere → SchemaEvolutionSinkFlow.coordinate(...) splits the stream into dataRows and schemaRows, routing schemaRows through ExternalSchemaChangeOperator at parallelism 1 → ExternalSchemaChangeOperator.processElement() lazily creates (via schemaChangeAppliers.computeIfAbsent-style get-or-create keyed by physical TablePath) and caches a SchemaChangeApplier from ((SupportCoordinatedSchemaEvolutionSink) sink).createSchemaChangeApplier(physicalSinkTable), applies the DDL exactly once → dataRows.connect(schemaRows.broadcast()) feeds SchemaRefreshBarrierOperator at full sink parallelism, .forward()-ed into the real sink writers, each of which calls refreshSchema(evolvedSchema) via SupportSchemaRefreshSinkWriter. This is the only remaining coordinated-dispatch mechanism after this commit — it was already lazy (parallelism-1 operator, one applier per physical table, created on first use) even before this round's changes, so removing the duplicate eager mechanism from MultiTableSinkWriter does not remove any working functionality; it removes a second, buggy, unreachable-in-the-real-Flink-path implementation that was, however, live and reachable on Zeta (per my round-1 finding).
A process nit, not a correctness bug: the head commit's message is "[Feature][Connector-V2] Support PostgreSQL CDC ADD COLUMN schema evolution", but none of the 15 files it actually touches are PostgreSQL-related — they're exactly the MultiTableSink/MultiTableSinkWriter/Flink-translation/docs files described above. This looks like a copy-paste or squash mistake from another branch. Not a code defect, but worth a comment amend before merge so the git history stays accurate for future git-blame archaeology.
1.2 Compatibility Impact
Fully compatible. All new interfaces (SchemaChangeApplier, SupportCoordinatedSchemaEvolutionSink, SupportSchemaRefreshSinkWriter) are additive and annotated @Experimental. The removal of the coordinated-dispatch code from MultiTableSinkWriter/MultiTableSink does not remove any behavior that shipped in a release — this whole feature is still unreleased and in draft. Non-opted-in sinks are unaffected. One behavioral note carried over from round 1 still applies and is worth restating explicitly in the PR description: before this round's fix, Zeta's MultiTableSinkWriter would have silently gained "coordinated" DDL dispatch for any JDBC multi-table job (since AbstractJdbcSinkWriter now implements SupportSchemaRefreshSinkWriter); after this round's fix, Zeta multi-table JDBC jobs go back to the pre-PR per-writer independent-DDL behavior, and only Flink gets the new coordinated path. That is the correct, safer choice given the PR's title/scope is [Flink]-only, but it means "coordinated schema evolution" as a capability is Flink-exclusive for now — the docs update in schema-evolution.md states this accurately ("Flink uses coordinated schema evolution for sinks that explicitly support it... The JDBC sink currently supports this coordinated path"), so this is a real, checked fact rather than a gap.
1.3 Performance / Side-Effect Analysis
The lazy, on-first-DDL applier creation in ExternalSchemaChangeOperator (parallelism 1) replaces what would otherwise have been parallelism × table-count eagerly-held connection providers for the job's lifetime — this is the direct performance fix SEZ9 asked for, now verifiably in place. No new unbounded collections, no new blocking calls on the hot per-row write path (the DDL apply only executes on the dedicated single-parallelism control-record path, not per data row).
1.4 Error Handling and Logging
Carryover, not fixed in this round — Issue A (Medium).
- Location:
docs/en/introduction/concepts/incompatible-changes.md(not modified by this PR at all — confirmed viagrep -c incompatible-changes.mdover the fulldev...headdiff, zero hits). - Problem: Both @SEZ9 and I agreed in the prior thread (see the 2026-08-23/08-24 comment exchange) that this PR should add an upgrade note covering checkpoint/savepoint restore behavior for schema-evolution jobs, since a job that had a schema-change in flight across a checkpoint boundary before upgrading to a build with this PR has no documented restore-compatibility guidance.
- Potential risk: Operators upgrading a running Flink job that uses schema evolution have no documented guidance on restore semantics across this change.
- Best improvement: Add a short entry before merge, or explicitly state in the PR description why it's deferred (e.g. "no released version ever shipped the old coordinator, so there is no real upgrade path to document yet since this is still unreleased/experimental").
- Severity: Medium (was already agreed as an ask; not new).
- Raised by another reviewer: Yes (@SEZ9, restated by me in the 08-24 follow-up).
Carryover, Low, not addressed — Issue B (Low).
- Location:
seatunnel-translation/.../schema/SchemaRefreshBarrierOperator.java:76(untouched by this commit). - Problem: wall-clock
System.currentTimeMillis()reused as an ordering epoch — a pre-existing pattern flagged in round 1 as Low severity, still present. - Potential risk: Clock skew/NTP adjustment could in theory produce non-monotonic epochs across restarts, though this is an existing pattern elsewhere in the codebase, not introduced by this PR.
- Best improvement: Consider a monotonic counter instead of wall-clock millis if this is revisited.
- Severity: Low.
- Raised by another reviewer: No (originally mine, restated here as still-open).
No new High/Medium issues found in this round's diff. The two items originally raised as blockers (compile failure, dead code) are both verifiably fixed; the collaborative blocking list from myself + @SEZ9 (lazy creation, deterministic resolution, construction-time check, identifier-safety javadoc, docs) is verifiably fixed with real, targeted unit tests for each fix (MultiTableSinkSchemaChangeApplierTest for deterministic resolution, FlinkSinkWriterTest#testCoordinatedSinkRejectsWriterWithoutSchemaRefreshSupport for the construction-time check, JdbcCoordinatedSchemaEvolutionTest#applySchemaChangeUsesCompleteChangeAfterSchema for the previously-untested changeAfter branch).
2. Code Quality Assessment
2.1 Coding Standards
New/changed public methods (resolvePhysicalSinkTable, the new createSchemaChangeApplier overload, validateCoordinatedSchemaEvolutionWriter) have adequate inline documentation via the interface-level javadoc on SupportCoordinatedSchemaEvolutionSink/SchemaChangeApplier; the private helper methods are short and self-explanatory. No missing-Javadoc concerns on the new core SPI types — SchemaChangeApplier, SupportCoordinatedSchemaEvolutionSink, and SupportSchemaRefreshSinkWriter all carry class/method-level javadoc explaining the contract, which matters here since these are new public SPI surface that third-party connector authors will implement.
2.2 Test Coverage and Test Stability
Stable. New/changed tests in this commit are plain JUnit5 unit tests with no Thread.sleep, no shared static state, and deterministic assertions:
MultiTableSinkSchemaChangeApplierTest(new, 3 focused tests) directly exercises the deterministic-resolution fix: logical-match precedence over another sink's physical match, unique physical match, and the ambiguous-physical-match rejection with exact error-message assertions.FlinkSinkWriterTest's two new tests exercise the coordinated-refresh write path and the construction-time rejection, including verifying the half-built writer is closed on failure.JdbcCoordinatedSchemaEvolutionTest's new test uses a real SQLite file-backed connection (no mocking of the DB layer) to verify thechangeAfter-driven branch end to end, including row-level and column-count assertions after the DDL.- The one E2E test in this PR (
MysqlCDCWithFlinkCoordinatedSchemaEvolutionIT) was already reviewed for stability characteristics in round 1; this round's change to it is exactly the one-line driver-resolution fix, no new stability surface introduced.
2.3 Documentation Updates
docs/en/introduction/configuration/schema-evolution.md (and the zh counterpart) now list "Flink" as a supported engine and add a "Parallel Flink sinks" section describing the apply-once/refresh-every-writer model and stating precisely which sink (JDBC) supports it today — this matches the implementation. docs/en/developer/sink-connector-development.md (and zh) gained guidance for connector authors implementing the new SPI. The one gap is incompatible-changes.md, covered as Issue A above.
3. Architectural Soundness
3.1 Elegance of the Solution
Long-term solution, not a workaround. Deleting the duplicate coordination mechanism from the engine-agnostic MultiTableSinkWriter rather than patching its bugs in place is the right call — it collapses "coordinated schema evolution" down to exactly one implementation (the Flink-specific, already-lazy, already-correctly-scoped ExternalSchemaChangeOperator), instead of maintaining two mechanisms with overlapping but subtly different correctness properties.
3.2 Maintainability
Good. The new deterministic-resolution logic in MultiTableSink.createSchemaChangeApplier is small, readable, and has a dedicated unit test per branch. The removal of LocalSchemaCoordinator/SinkStateProvider eliminates a documented-as-fragile JVM-local singleton, reducing future maintenance burden.
3.3 Extensibility
The SupportCoordinatedSchemaEvolutionSink SPI is generically usable by any connector, not JDBC-specific — JdbcSchemaChangeApplier is just the first implementation. MultiTableSink.supportsCoordinatedSchemaEvolution() is overridable by composite sinks, and the new deterministic key-resolution logic in MultiTableSink will apply uniformly to any future coordinated sink, not just JDBC.
3.4 Historical-Version Compatibility
No released version has ever shipped LocalSchemaCoordinator, the old eager createSchemaChangeAppliers(), or any of the new SPI — this entire feature is unreleased and marked @Experimental, so there is no live upgrade/restore path to break yet. The Issue A ask (an incompatible-changes.md entry) is about documenting forward guidance for operators who upgrade across this PR once it does ship, not about an existing compatibility break today.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| A | No incompatible-changes.md entry for schema-evolution checkpoint/restore behavior (carryover ask, still open) |
docs/en/introduction/concepts/incompatible-changes.md |
Medium |
| B | Wall-clock millis reused as ordering epoch (pre-existing pattern, carryover, untouched by this commit) | SchemaRefreshBarrierOperator.java:76 |
Low |
| C | Head commit message ("PostgreSQL CDC ADD COLUMN schema evolution") does not match the actual diff content (Flink/MultiTableSink refactor) | commit 627f04b |
Low |
Previously-blocking Issues (compile failure, dead LocalSchemaCoordinator, eager applier creation, nondeterministic resolution, unenforced writer contract) are all verified fixed in this commit and are not repeated in this table.
5. Merge Recommendation
Conclusion: Ready to merge after fixes
-
Blockers — must be fixed:
- None from a code-correctness standpoint in this round. The two originally-blocking issues (CI-breaking compile error, dead code) and the full collaborative blocking list from @SEZ9 and myself (lazy creation, deterministic resolution, construction-time enforcement, identifier-safety contract, docs) are all verifiably fixed with matching unit tests.
- Operationally: the fork's CI run for this exact head (
627f04b) is stillqueuedas of this review (gh run list --repo dybyte/seatunnel --branch feature/schema-evolutionshowsdatabaseId 32695677103,status: queued, created at the same timestamp as this commit) — it has not finished. Given the previous head's failure was exactly the compile error now fixed, and I found no stale references left behind by the large removal inMultiTableSinkWriter/MultiTableSink, I have high confidence it will go green, but this must be confirmed once the run completes before merge — do not merge on my confidence alone.
-
Recommended fixes — non-blocking:
- Add the
incompatible-changes.mdentry (Issue A) or explicitly state in the PR description why it's deferred for an unreleased/experimental feature. - Amend the head commit message to accurately describe the change (Issue C).
- Issue B (wall-clock epoch) remains a nice-to-have, unchanged from round 1.
- Add the
Overall assessment: this is now a substantially stronger PR than either of the two prior rounds. The design (checkpoint-barrier-based coordination, single parallelism-1 external-apply operator, broadcast-and-refresh siblings) was already sound in round 1 and remains so; this round's changes fix every concrete implementation bug raised by two independent reviewers, with unit tests that directly pin the fixed behavior rather than just asserting the old bug is gone. Given the PR remains in draft, I'd treat this review as the technical sign-off needed before the author marks it ready for review — final merge should still wait on (a) the queued CI run finishing green on this exact head, and (b) the author's own call on whether to un-draft.
Thanks for the thorough iteration here, @dybyte — this was a genuinely collaborative back-and-forth with @SEZ9 and the fixes match what was asked precisely. Nice work.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: Parallel Flink sink writers each executed external DDL independently for schema evolution, causing duplicate/conflicting DDL across subtasks, with no cross-JVM coordination mechanism.
- Fix approach: A checkpoint-barrier-driven two-phase gate (
SchemaOperator+ExternalSchemaChangeOperator+SchemaRefreshBarrierOperator) applies external DDL exactly once via a parallelism-1 operator, then broadcasts the evolved schema to every parallel sink writer via an opt-in SPI (SupportCoordinatedSchemaEvolutionSink/SchemaChangeApplier/SupportSchemaRefreshSinkWriter). - One-sentence summary: The architecture is sound and every previously-raised blocker (compile error, dead code, eager applier creation, nondeterministic applier resolution, unenforced writer contract) is verifiably fixed — but the single new commit since my last review introduces a fresh, high-severity regression in exactly the mechanism (
.forward()parallelism matching) my prior round confirmed as load-bearing.
I'm re-reviewing from scratch against the current head (68601ebf). Only one new commit landed since my last review at 627f04b (68601ebf — "Fix Flink schema evolution sink parallelism and table comment resolution", same author, dev...head diff confirms only these 4 files changed). No new comments or reviews from anyone were posted after my 627f04b review, so there is no separate Step-0 reply pass this round.
1. Code Change Review
1.1 Core Logic Analysis
What changed in 68601ebf vs. 627f04b (verified via git diff 627f04b 68601ebf):
seatunnel-core/seatunnel-flink-starter/seatunnel-flink-20-starter/.../SinkExecuteProcessor.javaandseatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/.../SinkExecuteProcessor.java(the Flink 1.15 variant that lives in the "common" module) both drop the unconditionaldataStreamSink.setParallelism(parallelism)call that I specifically verified as correct in my prior review, and now justreturn ds.sinkTo(...)directly without forcing parallelism.AbstractSchemaChangeResolver.java:179is fixed to build the completedAlterTableCommentEventfromtable.getTableId()(the resolvedCatalogTable's identifier) instead ofcommentEvent.getTableIdentifier()(the raw, possibly-incomplete identifier from the binlog event) — a real, well-tested bug fix (new test asserts a comment event with a partial identifierTableIdentifier.of(null, null, "test_table")gets completed to the resolvedTableIdentifier.of("mysql", "test_db", "test_table"), not just left as-is). This is orthogonal to schema-evolution coordination but legitimately in scope sinceAbstractSchemaChangeResolverfeeds the sameSchemaChangeEvents that flow through the coordinated path.
Why item 1 is a real regression, traced end to end:
SchemaEvolutionSinkFlow.coordinate(ds, sink, sinkParallelism)(seatunnel-translation/.../schema/SchemaEvolutionSinkFlow.java:60-65) unconditionally pins theSchemaRefreshBarrieroperator's parallelism and chains.forward()onto it:This is unchanged by this commit and is exactly the mechanism I verified in my prior review as "required forreturn dataRows.connect(schemaRows.broadcast()) .transform("SchemaRefreshBarrier", ..., new SchemaRefreshBarrierOperator()) .name("SchemaRefreshBarrier") .setParallelism(sinkParallelism) .forward();
.forward()to preserve the per-subtask 1:1 mapping the refresh logic depends on."AbstractSinkExecuteProcessor.execute()(seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/.../AbstractSinkExecuteProcessor.java:202-215, unchanged by this commit) computes the sameparallelismint (defaulting to1when neithersink.parallelismnorenv.parallelismis configured), passes it intocreateVersionSpecificDataStreamSink(...), and only conditionally forces it onto the returneddataStreamSink:boolean sinkParallelism = sinkConfig.hasPath(EnvCommonOptions.PARALLELISM.key()); boolean envParallelism = envConfig.hasPath(EnvCommonOptions.PARALLELISM.key()); ... if (sinkParallelism || envParallelism) { dataStreamSink.setParallelism(parallelism); }
- Before this commit,
createVersionSpecificDataStreamSinkin the flink-20 and flink-15("common") variants also calleddataStreamSink.setParallelism(parallelism)unconditionally, so the sink operator's parallelism always matched the barrier operator's, regardless of whether the user configuredparallelismexplicitly. This commit removes that unconditional call, leaving only the base class's conditional gate above. - Concretely: for a Flink job using the new coordinated JDBC/MultiTable schema-evolution sink where the user does not set
sink.parallelismorenv.parallelism(very common — many users rely on the cluster's default parallelism or a-p NCLI flag instead of SeaTunnel-level config),parallelismcomputes to1. TheSchemaRefreshBarrieroperator is still forced to parallelism1(unconditional inSchemaEvolutionSinkFlow), but the sink operator built byds.sinkTo(new FlinkSink<>(...))is now left unset and inherits the Flink execution environment's actual default parallelism — which is very commonly not 1 on a real cluster (task-slot count,parallelism.defaultinflink-conf.yaml, or a-psubmission flag). A.forward()edge between operators with different parallelism is rejected by Flink atStreamGraph/JobGraphgeneration time (UnsupportedOperationException: Forward partitioning does not allow change of parallelism...), so the job fails to even start whenever the cluster's actual parallelism differs from 1 and the user relies on that default rather than SeaTunnel-levelparallelismconfig. - This is not a hypothetical: the new
MysqlCDCWithFlinkCoordinatedSchemaEvolutionITE2E test would not catch it, because both its.conffixtures explicitly setenv.parallelismandsink.jdbc.parallelismto the same value (cse_sink_parallelism,SINK_PARALLELISM = 4— seemysqlcdc_to_mysql_with_flink_coordinated_schema_change_parallel.conf:18,34andMysqlCDCWithFlinkCoordinatedSchemaEvolutionIT.java:89-90,214-215), which always takes theif (sinkParallelism || envParallelism)branch and masks the bug. Any user who omits both configs and instead relies on Flink's own default/CLI parallelism for a coordinated-schema-evolution job will hit a hard job-submission failure that no existing test in this PR exercises. - Scope note:
seatunnel-core/seatunnel-flink-starter/seatunnel-flink-13-starter/.../SinkExecuteProcessor.java:218(a separate, non-AbstractSinkExecuteProcessor-based implementation for the oldest supported Flink version) still callsdataStreamSink.setParallelism(parallelism)unconditionally and was not touched by this commit — so it doesn't have the new regression, but it still has whatever motivated this commit's fix in the first place (forcing sink parallelism to1whenever the user doesn't configure it, silently overriding the cluster/CLI default even for ordinary, non-schema-evolution sinks). The fix is now inconsistent across the three Flink-starter variants: flink-13 forces unconditionally (safe for.forward(), but keeps the original "downgrades to 1" bug this commit apparently set out to fix), flink-20/flink-15 fix that bug for ordinary sinks but break.forward()for coordinated schema evolution.
Everything else in this diff is confirmed fixed (re-verified directly, not just re-reading the prior thread): MysqlCDCDriverResolver compile error, dead LocalSchemaCoordinator/SinkStateProvider, eager per-table SchemaChangeApplier creation, nondeterministic HashMap-iteration-order applier resolution, unenforced SupportSchemaRefreshSinkWriter contract, and the identifier-safety SPI contract gap are all still resolved as of 627f04b and untouched by 68601ebf — no regression there.
1.2 Compatibility Impact — Fully compatible in API, but see Issue 1 for a functional regression
All SPI additions remain additive and @Experimental; nothing shipped in a release is affected (this feature is still unreleased). Issue 1 below is a functional bug in the new feature itself, not a backward-compatibility break.
1.3 Performance / Side-Effect Analysis
No change from my prior round's analysis: lazy, on-first-DDL applier creation in ExternalSchemaChangeOperator remains correct; no new unbounded collections or blocking calls on the per-row hot path.
1.4 Error Handling and Logging
Issue 1 — .forward() parallelism mismatch: coordinated schema-evolution Flink jobs fail at submission when parallelism isn't explicitly configured
- Location:
seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/schema/SchemaEvolutionSinkFlow.java:60-65(unconditional.setParallelism(sinkParallelism).forward()) vs.seatunnel-core/seatunnel-flink-starter/seatunnel-flink-20-starter/src/main/java/org/apache/seatunnel/core/starter/flink/execution/SinkExecuteProcessor.java:58andseatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/main/java/org/apache/seatunnel/core/starter/flink/execution/SinkExecuteProcessor.java:59(sink parallelism now conditional, viaAbstractSinkExecuteProcessor.java:202-215) - Problem: the
SchemaRefreshBarrierOperatorupstream of the sink is always pinned to the computedparallelismvalue (defaults to1when unconfigured), but after this commit the downstream sink operator is only pinned to that same value when the user explicitly setssink.parallelismorenv.parallelism. When neither is set and the Flink environment's actual default parallelism isn't1, the two operators connected by.forward()have different parallelism. - Potential risk: Flink rejects mismatched-parallelism
.forward()edges atStreamGraph/JobGraphgeneration withUnsupportedOperationException, so any coordinated-schema-evolution JDBC/MultiTable Flink job that doesn't explicitly configure parallelism fails to submit at all on any cluster whose default parallelism differs from 1. This is squarely inside the feature this PR implements, and it is not covered by the new E2E test, which always setsparallelismexplicitly in its.conffixtures (masking exactly this gap). - Best improvement: either (a) pass the same conditional decision into
SchemaEvolutionSinkFlow.coordinate(...)so the barrier operator is only pinned when parallelism is explicitly configured (and otherwise both barrier and sink inherit the environment default consistently), or (b) keep forcingdataStreamSink.setParallelism(parallelism)specifically whensink instanceof SupportSchemaEvolutionSinkeven though the general case stays conditional. Whichever direction is chosen, add a unit/E2E case that does not setsink.parallelism/env.parallelismexplicitly (so it exercises the environment-default path) to prevent this from regressing silently again — the existing fixtures can't catch it because they always pin parallelism. - Severity: High
- Raised by another reviewer: No
Issue 2 — Fix scope is inconsistent across the three Flink-starter variants
- Location:
seatunnel-core/seatunnel-flink-starter/seatunnel-flink-13-starter/src/main/java/org/apache/seatunnel/core/starter/flink/execution/SinkExecuteProcessor.java:218vs. the flink-20/flink-15 files touched by this commit - Problem: flink-13's standalone
execute()still callsdataStreamSink.setParallelism(parallelism)unconditionally and wasn't touched by this commit, so it still has whatever bug motivated this commit (forcing ordinary, non-schema-evolution sinks to parallelism1whenever the user doesn't setsink.parallelism/env.parallelism, silently overriding the cluster/CLI default) — while flink-20/flink-15 now fix that for ordinary sinks but introduce Issue 1 for coordinated schema evolution. - Potential risk: behavior now differs by Flink version for the same SeaTunnel config, and neither variant gets a fully-correct outcome for the schema-evolution case.
- Best improvement: fix all three variants consistently, ideally by centralizing the parallelism-application decision (ordinary sinks vs. coordinated-schema-evolution sinks) in one place shared by all three, rather than duplicating the conditional per starter module.
- Severity: Medium
- Raised by another reviewer: No
Carryover, still open (Medium, restated from my 627f04b review):
- No
incompatible-changes.mdentry for schema-evolution checkpoint/restore behavior — unaddressed by this commit (docs/en/introduction/concepts/incompatible-changes.mdstill has zero hits for schema evolution indev...head). Given the feature remains unreleased/@Experimental, non-blocking, but still an open ask from both myself and @SEZ9.
Carryover, still open (Low, restated):
SchemaRefreshBarrierOperator.java:76wall-clock-millis-as-epoch pattern, unchanged, still Low.
2. Code Quality Assessment
2.1 Coding Standards
No new public/package classes in this commit; the two touched methods (AbstractSchemaChangeResolver.completeSchemaChangeEvents, the two createVersionSpecificDataStreamSink overrides) are pre-existing and adequately documented at the class level already.
2.2 Test Coverage and Test Stability
The new/updated test AbstractSchemaChangeResolverTest.testCompletionEventFillsTableComment is a good, deterministic, targeted unit test for the comment-identifier fix (Issue 179's fix) — asserts the exact resolved TableIdentifier, not just a loose existence check. Rating: Stable for what's tested.
However, no test exercises Issue 1 (the parallelism regression) — neither a translation-layer unit test asserting the built DataStreamSink's parallelism, nor an E2E fixture that omits explicit parallelism configuration. This is a real coverage gap directly tied to a High-severity bug in this same commit; I'd flag test coverage here as a Risk-present gap specifically for the schema-evolution-with-unconfigured-parallelism scenario, even though the rest of the suite remains stable.
2.3 Documentation Updates
No doc changes in this commit; carries over the still-open incompatible-changes.md ask from Issue 1.4 above.
3. Architectural Soundness
3.1 Elegance of the Solution
The core checkpoint-barrier coordination design remains a precise, long-term-correct fix — unchanged from my prior assessment. The parallelism-conditional change in this commit, in isolation, is also the right instinct (don't silently downgrade sink parallelism to 1 when the user relies on the cluster/CLI default) — it's just applied without accounting for the .forward() invariant the same PR's coordinated path depends on. This reads as an honest oversight in an otherwise-correct cleanup, not a workaround.
3.2 Maintainability
The duplication of the parallelism-decision logic across SchemaEvolutionSinkFlow (always-on) and AbstractSinkExecuteProcessor (conditional) is exactly the kind of split-brain state that produced Issue 1 — consolidating the decision in one place (Issue 2's suggested fix) would remove this class of bug going forward.
3.3 Extensibility
Unaffected by this commit; unchanged from my prior review.
3.4 Historical-Version Compatibility
Unaffected — this entire feature remains unreleased/@Experimental, so there's no live upgrade path to break yet, as before.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | .forward() parallelism mismatch breaks coordinated schema-evolution jobs at submission when parallelism isn't explicitly configured (new regression in this commit) |
SchemaEvolutionSinkFlow.java:60-65 vs. flink-20-starter/flink-starter-common SinkExecuteProcessor.java |
High |
| 2 | Parallelism-application fix is inconsistent across flink-13/flink-20/flink-15 starter variants | flink-13-starter/.../SinkExecuteProcessor.java:218 |
Medium |
| A | No incompatible-changes.md entry for schema-evolution checkpoint/restore behavior (carryover, still open) |
docs/en/introduction/concepts/incompatible-changes.md |
Medium |
| B | Wall-clock millis reused as ordering epoch (pre-existing pattern, carryover, untouched) | SchemaRefreshBarrierOperator.java:76 |
Low |
Previously-blocking issues from earlier rounds (compile failure, dead LocalSchemaCoordinator, eager applier creation, nondeterministic applier resolution, unenforced writer contract, identifier-safety contract) remain verifiably fixed in this commit and are not repeated here.
5. Merge Recommendation
Conclusion: Not recommended for merge (regression from my prior "ready to merge after fixes" assessment)
I need to walk back my 627f04b sign-off: the latest commit reintroduces a real bug in the exact mechanism I verified as safe in that review. This isn't a case of me having missed something originally — the .forward()-parallelism invariant genuinely held at 627f04b; it was broken by the very next commit, 68601ebf, which I'm reviewing for the first time here.
-
Blockers — must be fixed
- Issue 1 (High): fix the parallelism mismatch between
SchemaRefreshBarrierOperatorand the sink operator when neithersink.parallelismnorenv.parallelismis explicitly configured, and add a test that exercises the unconfigured-parallelism path (the existing E2E fixtures can't catch this since they always setparallelismexplicitly).
- Issue 1 (High): fix the parallelism mismatch between
-
Recommended fixes — non-blocking
- Issue 2 (Medium): make the parallelism-application behavior consistent across all three Flink-starter variants, ideally by centralizing the decision instead of duplicating it per module.
- Issue A (Medium, carryover): add the
incompatible-changes.mdentry, or explicitly state in the PR description why it's deferred for an unreleased/experimental feature. - Issue B (Low, carryover): consider a monotonic counter instead of wall-clock millis for the refresh-barrier epoch, if ever revisited.
Overall assessment: The AbstractSchemaChangeResolver table-comment-identifier fix in this same commit is a solid, well-tested, unrelated cleanup — no concerns there. The core coordinated-schema-evolution design remains sound and everything from the two previous review rounds is genuinely fixed. But Issue 1 is a real, evidenced, high-severity regression in the feature's core Flink wiring, introduced by this exact commit, that would break real-world coordinated-schema-evolution jobs that don't hand-configure parallelism — and it's invisible to the current test suite because the new E2E fixtures happen to always set parallelism explicitly. Once that's fixed (and ideally covered by a test that doesn't set parallelism explicitly), I'd expect this to be back to "ready to merge" territory. Thanks for the continued fast iteration, @dybyte — the comment-identifier fix bundled in here is a nice catch, and I'd rather flag this parallelism issue now than have it surface as a hard-to-diagnose job-submission failure after merge.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: Parallel Flink sink writers each executed external DDL independently for schema evolution, causing duplicate/conflicting DDL across subtasks, with no cross-JVM coordination mechanism.
- Fix approach: A checkpoint-barrier-driven two-phase gate (
ExternalSchemaChangeOperatorapplies DDL exactly once at parallelism 1, thenSchemaRefreshBarrierOperatorbroadcasts the evolved schema so every parallel sink writer refreshes locally) applies external DDL exactly once, then broadcasts the evolved schema to every parallel sink writer via an opt-in SPI (SupportCoordinatedSchemaEvolutionSink/SchemaChangeApplier/SupportSchemaRefreshSinkWriter). - One-sentence summary: I re-reviewed from scratch against the current head (
2794351) — the single new commit since my last review (68601eb→2794351, "Align Flink schema evolution sink parallelism") verifiably fixes both of the issues I raised last round (the.forward()parallelism mismatch and the flink-13 scope inconsistency), adds a solid targeted unit test for exactly the previously-untested path, and I found no new regression in the coordination/partial-failure semantics after independently re-tracing them.
I'm re-reviewing fully, not delta-only, per this round's request. Only one new commit landed since my 68601eb review (verified via git log); no one replied to that review, so there is no separate Step-0 reply pass this round.
1. Code Change Review
1.1 Core Logic Analysis
What 2794351 changes vs. 68601eb (verified via git show 2794351..., 6 files):
Both AbstractSinkExecuteProcessor.execute() and flink-13's standalone SinkExecuteProcessor.execute() now compute a parallelismConfigured boolean (sinkParallelism || envParallelism) alongside the existing parallelism int, and thread it through to createVersionSpecificDataStreamSink(...) and into SchemaEvolutionSinkFlow.coordinate(ds, sink, parallelism, parallelismConfigured). Inside coordinate(), both the pre-existing BroadcastSchemaHandler operator (non-coordinated SupportSchemaEvolutionSink path) and the new SchemaRefreshBarrier operator (coordinated path) now only call .setParallelism(sinkParallelism) when parallelismConfigured is true:
SingleOutputStreamOperator<SeaTunnelRow> schemaRefreshBarrier =
dataRows.connect(schemaRows.broadcast())
.transform("SchemaRefreshBarrier", ..., new SchemaRefreshBarrierOperator())
.name("SchemaRefreshBarrier");
if (parallelismConfigured) {
schemaRefreshBarrier.setParallelism(sinkParallelism);
}
return schemaRefreshBarrier.forward();When parallelism isn't explicitly configured, this operator (and the downstream sink operator, whose own .setParallelism() call is likewise now gated by the same parallelismConfigured flag) both simply inherit the Flink execution environment's actual default parallelism, restoring the invariant .forward() requires (same parallelism on both sides of the edge) — this is exactly fix option (a) I suggested in my prior review, applied consistently rather than as a one-off patch.
Second, related fix I traced independently: the parallelism int's fallback (used when neither sink.parallelism nor env.parallelism is set) changes from a hardcoded 1 to stream.getDataStream().getExecutionEnvironment().getParallelism(). I checked dev HEAD directly (git show dev:.../AbstractSinkExecuteProcessor.java) and confirmed the hardcoded-1 fallback is pre-existing, unrelated to this PR's earlier commits — it predates the schema-evolution work entirely. That parallelism value also flows into FlinkSink's constructor → FlinkSinkWriterContext(context, parallelism), which backs SinkWriter.Context.getNumberOfParallelSubtasks(). So on dev today, any streaming Flink sink job that doesn't explicitly set sink.parallelism/env.parallelism gets told by the framework that it has exactly 1 parallel writer, even when the cluster's actual default parallelism is higher — a real latent bug this commit incidentally fixes for every Flink sink, not just schema-evolution ones (see 1.2).
Partial-failure / coordination safety (independently re-traced, since this was flagged as the key thing to scrutinize this round): ExternalSchemaChangeOperator.processElement() only calls output.collect(element) — the row that gets broadcast downstream to every SchemaRefreshBarrierOperator instance — after applier.apply(event) returns without throwing. If apply() throws, the exception propagates out of processElement() uncaught, failing this parallelism-1 task; Flink's standard failure/recovery semantics then restart the whole job (or failover region) from the last checkpoint. There is no code path where the broadcast/refresh row is emitted before the DDL has fully succeeded, so there's no window in which some parallel sink writers observe the evolved schema while others don't — partial application across siblings is structurally prevented by the ordering, not just by convention. This part of the design is unchanged by 2794351 and I found no new race or deadlock introduced by the parallelism-wiring change itself (it only affects operator parallelism assignment, not control flow or state).
Runtime path (unconfigured-parallelism case, now fixed):
source/transform (env-default parallelism N)
-> ExternalSchemaChangeOperator (pinned parallelism=1, applies DDL once)
\-broadcast()-> SchemaRefreshBarrier (parallelism=N, inherited from env — was pinned to 1 before this commit when unconfigured)
-> dataRows --forward()--> SchemaRefreshBarrier (parallelism=N) [requires N==N, previously N vs 1 mismatch -> StreamGraph build failure]
-> sink operator (parallelism=N, inherited from env — previously left unset while barrier was forced to 1, or vice versa depending on variant)
Everything else re-verified as still fixed, unchanged by this commit: eager per-table applier creation, nondeterministic HashMap-iteration applier resolution, unenforced SupportSchemaRefreshSinkWriter contract, dead LocalSchemaCoordinator, the compile error — no regression in any of these.
1.2 Compatibility Impact — Partially incompatible (undocumented default-behavior change, beyond the experimental feature's own scope)
The coordinated-schema-evolution SPI itself remains additive and @Experimental — no impact there, feature is unreleased. However, the parallelism-fallback fix described above changes observable default behavior for all existing, already-released streaming Flink sink jobs that don't explicitly set sink.parallelism/env.parallelism: previously SinkWriter.Context.getNumberOfParallelSubtasks() (via FlinkSink/FlinkSinkWriterContext) always reported 1 in that case; after this commit it correctly reports the environment's actual default parallelism. This is a legitimate bug fix, not an arbitrary change, but it's bundled into a feature PR without being called out, and it affects released functionality outside the experimental feature's boundary. Recommend an explicit note in the PR description (and ideally incompatible-changes.md) so users who happen to depend on the old forced-to-1 reporting aren't surprised.
1.3 Performance/Side-Effect Analysis
No change from my prior round's analysis — lazy, on-first-DDL applier creation remains correct, no new unbounded collections or blocking calls on the per-row hot path. The new unit test builds/discards a local StreamExecutionEnvironment graph per test method, which is fine for a unit test and has no production impact.
1.4 Error Handling and Logging
No new error-handling or logging issues in this commit. ExternalSchemaChangeOperator.close() (unchanged) still correctly aggregates and suppresses exceptions across all held appliers plus super.close(), which I re-verified reading the file directly.
2. Code Quality Assessment
2.1 Coding Standards
The added/changed method signatures (createVersionSpecificDataStreamSink(..., boolean parallelismConfigured, ...), SchemaEvolutionSinkFlow.coordinate(..., boolean parallelismConfigured)) are propagated consistently to all three Flink-starter variants and the abstract method declaration — no stale call site left behind (confirmed by the passing "Code style"/"License header"/unit-test CI jobs on both JDK 8 and 11, which would fail to compile otherwise). The new SchemaEvolutionSinkFlowTest has the ASF header and clear, self-descriptive test names.
2.2 Test Coverage and Test Stability
SchemaEvolutionSinkFlowTest adds two deterministic tests that build a real StreamExecutionEnvironment + DataStreamSink, and assert both the resulting operator parallelism values and that environment.getStreamGraph() does not throw — this is precisely the right layer to pin the .forward()-mismatch defect (a translation-layer unit test catches the UnsupportedOperationException at graph-build time, which the existing E2E fixtures can't reach since they always pin sink.jdbc.parallelism/env.parallelism explicitly and therefore never exercise the unconfigured-parallelism path). Rating: Stable for what's tested; this closes the exact coverage gap I flagged as a blocker last round.
I independently fetched and read the actual failing-job logs for the current head's red Build check rather than trusting the status alone:
engine-v2-it (8, ubuntu-latest):RowErrorHandlingFatalException/Timed out waiting for error sink worker to closein an unrelated JDBC row-error-handling test — no code in this PR's diff is in its call path.jdbc-connectors-it-part-6 (11, ubuntu-latest):JdbcHanaIT— the SAP HANA testcontainer failed to start (Check failed: syscalls), a known container/environment flake, unrelated to schema evolution.rocketmq-connector-it (11, ubuntu-latest):RocketMqIT.testSourceRocketMqRestore— off-by-2 restored-message count (expected: <15> but was: <17>), an unrelated connector's pre-existing flaky assertion.
None of these touch seatunnel-core/seatunnel-flink-starter/** or seatunnel-translation-flink/**. I'd rate the code this commit actually changed as Stable; the Build check's red state is CI noise, not evidence of a regression in this PR.
2.3 Documentation Updates
No doc changes in this commit. Still-open, carried over: the incompatible-changes.md entry for schema-evolution checkpoint/restore behavior (asked by both myself and @SEZ9 across two prior rounds), plus the new parallelism-default-behavior note from 1.2 above.
3. Architectural Soundness
3.1 Elegance of the Solution
Threading parallelismConfigured end-to-end through the real call chain (rather than special-casing schema-evolution sinks, or hardcoding around .forward()) is the precise, minimal fix — it addresses the root cause (two independently-parallelism-assigned operators connected by an edge that requires them to match) rather than papering over the symptom, and it's applied uniformly to both the coordinated and non-coordinated schema-evolution paths.
3.2 Maintainability
This closes the split-brain risk I flagged last round (parallelism-decision logic duplicated across SchemaEvolutionSinkFlow and the three starter variants) — all four now derive the same parallelismConfigured decision from the same two config checks, rather than diverging per module.
3.3 Extensibility
Unaffected by this commit; unchanged from my prior rounds' assessment.
3.4 Historical-Version Compatibility
The schema-evolution feature itself remains unreleased/@Experimental, so there's no live checkpoint/savepoint upgrade path to break. The parallelism-default fix (1.2) does touch already-released sink code, but only affects newly-submitted job graphs going forward, not restoring existing checkpoints/savepoints — no restore-compatibility break.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Parallelism-fallback fix (bundled in this commit) changes default parallelism-reporting behavior for all existing streaming Flink sinks system-wide, not just schema-evolution ones; undocumented | AbstractSinkExecuteProcessor.java:202-215, flink-13-starter SinkExecuteProcessor.java |
Medium |
| 2 | No incompatible-changes.md entry for schema-evolution checkpoint/restore behavior (carryover, still open from two prior rounds) |
docs/en/introduction/concepts/incompatible-changes.md |
Medium |
| 3 | Wall-clock millis reused as ordering epoch (pre-existing pattern, carryover, untouched) | SchemaRefreshBarrierOperator.java:76 |
Low |
Resolved this round, not repeated as open issues: the .forward() parallelism mismatch (previously High) and the flink-13 fix-scope inconsistency (previously Medium) are both verifiably fixed, with a new targeted unit test pinning the previously-untested unconfigured-parallelism path. Previously-blocking issues from earlier rounds (compile failure, dead LocalSchemaCoordinator, eager applier creation, nondeterministic applier resolution, unenforced writer contract, identifier-safety contract) remain fixed and are not repeated here either.
5. Merge Recommendation
Conclusion: Ready to merge after fixes
-
Blockers — must be fixed
- None from a code-correctness standpoint. Both issues from my previous round are fixed with direct evidence — I re-read the actual diff and the new unit test rather than trusting the commit message, and independently re-traced the coordination/partial-failure control flow to confirm no new race was introduced.
- Operationally: the fork's Build check is currently red on this exact head, but I pulled and read the logs for all three failing jobs myself and confirmed each is an unrelated, pre-existing flake (JDBC error-sink-close timeout, SAP HANA container startup failure, RocketMQ restore-count race) — none touch any file in this PR's diff. This should be rerun and confirmed green before merge, but I found no evidence the failures are caused by this PR.
-
Recommended fixes — non-blocking
- Issue 1 (Medium, new): call out the parallelism-default behavior change in the PR description, since it affects existing released Flink sink behavior beyond this experimental feature's scope.
- Issue 2 (Medium, carryover): add the
incompatible-changes.mdentry, or explicitly state why it's deferred for an unreleased/experimental feature. - Issue 3 (Low, carryover): consider a monotonic counter instead of wall-clock millis for the refresh-barrier epoch, if ever revisited.
Overall assessment: this round closes out the regression I flagged last time cleanly — the fix is applied at the right layer (threading a single boolean decision consistently through the whole call chain, not a targeted patch around the specific symptom), and it's backed by a new unit test that exercises exactly the scenario the existing E2E fixtures couldn't reach. The core checkpoint-barrier coordination design remains sound, and my independent re-check of the partial-failure path (DDL-apply-then-broadcast ordering) confirms there's no window for some parallel writers to diverge from others. The one new thing I'd like addressed before merge is documentation, not code: the parallelism-fallback fix quietly changes default behavior for sinks well outside this feature's boundary, and that deserves a one-line callout so it doesn't surprise anyone downstream. Thanks for iterating fast on this, @dybyte — this is in good shape.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Thanks for the ping via the new commit, @dybyte. Since my last round (head 2794351), exactly one new commit landed (3add4380a, docs-only). This full re-review re-reads the entire dev...HEAD diff and re-traces the whole coordination call chain from scratch, not just this delta, per this round's request.
- User pain point: Parallel Flink sink writers each executed external DDL independently for schema evolution, causing duplicate/conflicting DDL across subtasks, with no cross-JVM coordination mechanism (the old
LocalSchemaCoordinatorwas a JVM-local static singleton that cannot coordinate subtasks running in different TaskManager JVMs). - Fix approach: A checkpoint-barrier-driven two-phase gate —
SchemaOperatorbuffers all rows behind a detected DDL and only releases them after a second completed checkpoint;ExternalSchemaChangeOperator(pinned parallelism 1) applies the DDL exactly once;SchemaRefreshBarrierOperator(parallelism = sink parallelism) broadcasts the evolved schema so every parallel writer refreshes locally before touching post-DDL rows — plus a new opt-in SPI (SupportCoordinatedSchemaEvolutionSink/SchemaChangeApplier/SupportSchemaRefreshSinkWriter). - One-sentence summary: The coordination design is sound and every blocker raised across four prior rounds (compile error, dead code, eager/nondeterministic applier creation, unenforced writer contract,
.forward()parallelism mismatch) is verifiably fixed in the current head; this round's only change is a docs commit that closes out the two remaining non-blocking recommendations from my last review.
1. Code Change Review
1.1 Core Logic Analysis
What 3add4380a changes vs. 2794351 (verified via git show 3add4380a, 2 files, docs only): adds two "Breaking Change" entries to docs/en/introduction/concepts/incompatible-changes.md:192-203 and the mirrored Chinese file docs/zh/introduction/concepts/incompatible-changes.md:184-195 — one covering the unconfigured-sink-parallelism behavior change (fixed in 2794351), one covering checkpoint/savepoint restore risk for jobs using the new coordinated operator topology. This is exactly Issue 1 and Issue 2 ("Recommended fixes — non-blocking") from my previous review; no code changed.
Independent re-verification of the core mechanism against the current head (I re-read every file below directly, not from memory of prior rounds):
SchemaOperator.java:234-297(notifyCheckpointComplete): on the checkpoint that first observes the DDL at the head of the buffer, onlyfirstSeenCheckpointIdis recorded (:249-259) — nothing is dispatched yet, so any in-flight XACOMMITfrom theFlinkGlobalCommitterfor the prior cycle isn't racing the ALTER TABLE. Only oncecheckpointId >= firstSeenCheckpointId + 1doesdispatchNextPendingSchemaChange(:378-410) fire, and only a subsequent completed checkpoint callscompleteNextPendingSchemaChange(:412-441), which is what actually drains buffered rows (drainDataUntilNextSchemaChange,:443-464). Because Flink requires an operator to have processed every record preceding a checkpoint barrier on all input channels before forwarding that barrier, this two-round gate is a real (not advisory) guarantee that every downstream operator — includingExternalSchemaChangeOperatorand everySchemaRefreshBarrierOperatorinstance — has processed the schema control record before any post-DDL row is released.ExternalSchemaChangeOperator.java:53-76:output.collect(element)(the row that gets broadcast to everySchemaRefreshBarrierOperatorinstance) only happens afterapplier.apply(event)returns without throwing (:74-75). Ifapply()throws, it propagates uncaught, failing this parallelism-1 task and triggering Flink's standard checkpoint-based recovery. There is no code path where the refresh signal is emitted before the DDL has actually succeeded — partial application across sibling writers (some seeing the new schema, some not) is structurally prevented by ordering, not convention.SchemaRefreshBarrierOperator.java:80-124: uses union list state (getUnionListState,:86) for the authoritative per-table schema snapshot, and onopen()(:114-124) eagerly re-emits a refresh for every restored snapshot before the first data row can arrive. This correctly handles the failover/rescale case: a recovered sink writer is a brand-new in-memory writer instance and must not be allowed to process a row against a stale schema just because the local "already refreshed" bookkeeping (locallyRefreshedEpochs, intentionally not checkpointed) was lost on restart.SchemaEvolutionSinkFlow.java:35-77: confirmed the previously-fixed parallelism-alignment bug (my prior round's blocker) is applied consistently — both the coordinated (SchemaRefreshBarrier,:66-75) and non-coordinated (BroadcastSchemaHandler,:43-52) branches now gate.setParallelism()behind the sameparallelismConfiguredflag, so.forward()(:76) always sees matching parallelism on both sides of the edge whether or not the user setsink.parallelism/env.parallelismexplicitly.MultiTableSink.java:240-298:createSchemaChangeApplierresolves deterministically — exact logical-key match wins outright (:243-249); otherwise it computes each sink's physical table and requires exactly one match, throwingIOException("Ambiguous physical sink table ...")on more than one (:258-269). No eager per-subtask applier creation remains anywhere increateWriter/restoreWriter.FlinkSink.java:96,100-121:validateCoordinatedSchemaEvolutionWriterruns at writer-construction time (both fresh and restored paths) and closes the half-built writer before throwing if a sink declares coordination support but its writer doesn't implementSupportSchemaRefreshSinkWriter— this fails at job start, not mid-DDL after rows are already buffered.
New this round — a race-window question I traced independently, per this task's specific ask about multi-writer coordination: SchemaOperator runs at source parallelism (AbstractSourceExecuteProcessor.java:126-131: .setParallelism(sourceStream.getParallelism())), so with source parallelism > 1 there are multiple independent SchemaOperator instances, each with its own local buffer/checkpoint-gate state (regular per-subtask ListState, not union). If more than one of them independently detected and dispatched a SchemaChangeEvent for the same logical DDL, ExternalSchemaChangeOperator (which does not deduplicate by table+epoch) would call applier.apply(event) more than once for one DDL. I traced this to the CDC source layer: all three SupportSchemaEvolution sources in this diff's scope (MySqlIncrementalSource, OracleIncrementalSource, SqlServerIncrementalSource) build on connector-cdc-base's incremental-snapshot IncrementalSource framework, whose split enumerator assigns the shared streaming/binlog split to exactly one reader subtask at a time — an existing, pre-PR invariant this diff does not touch — so in practice only one SchemaOperator instance ever observes a given DDL. This holds today, but it is an implicit assumption the SPI doesn't state anywhere; worth a one-line javadoc note on SchemaChangeApplier/SchemaOperator that the contract assumes single-subtask emission per event, so a future non-CDC-base source with multi-subtask DDL detection doesn't silently reintroduce double-apply.
1.2 Compatibility Impact
Partially incompatible, and now correctly documented as such. The two "Breaking Change" entries added in 3add4380a accurately describe real behavior changes I independently verified:
docs/en/introduction/concepts/incompatible-changes.md:192-197: unconfigured Flink sink parallelism now inherits the execution environment's default instead of being forced to1on Flink 1.13 or silently misreported viagetNumberOfParallelSubtasks()elsewhere — matches the2794351fix I verified line-by-line last round.docs/en/introduction/concepts/incompatible-changes.md:198-203: checkpoint/savepoint restore risk for coordinated-schema-evolution jobs is real and, if anything, understated in one respect — since SeaTunnel does not appear to assign explicit operator UIDs in this pipeline, insertingExternalSchemaChangeOperator/SchemaRefreshBarrierOperatorinto the middle of the graph can shift Flink's auto-generated hash-based UIDs for all downstream operators, not just the new ones, so restore risk extends beyond the schema-evolution operators themselves. The migration guidance (test restore before upgrading; fall back to the old version or an explicit start position otherwise) is the right operational answer regardless, so I'm not asking for a rewrite — just flagging that the risk is slightly broader than "the new operators can't restore."
1.3 Performance / Side-Effect Analysis
Unchanged from my last round (docs-only commit): lazy, on-first-DDL applier creation avoids holding parallelism × table-count connections for the job's lifetime; the parallelism-fallback fix (AbstractSinkExecuteProcessor.java, unchanged since 2794351) also incidentally fixes a pre-existing, PR-unrelated latent bug (every unconfigured Flink sink previously reported getNumberOfParallelSubtasks()==1 regardless of actual parallelism) — correctly called out in the new docs as increasing external-system concurrency after upgrade, which is exactly the kind of side effect operators need advance warning about.
1.4 Error Handling and Logging
No new Issues this round. All Issues from prior rounds (compile failure, dead LocalSchemaCoordinator, eager/nondeterministic applier resolution, unenforced writer contract, .forward() parallelism mismatch) remain fixed as re-verified in 1.1 above; I am not re-listing them as open items.
- Issue 1 — Location:
seatunnel-translation-flink-common/.../schema/ExternalSchemaChangeOperator.java(class-level) andseatunnel-api/.../sink/SchemaChangeApplier.java. Problem: the SPI/operator contract implicitly assumes at most one source subtask ever emits a given logicalSchemaChangeEvent; this is true today only because of an un-stated CDC-base framework invariant. Potential risk: a futureSupportSchemaEvolutionsource that isn't built onconnector-cdc-base(or a refactor of the base's split assignment) could reintroduce duplicate DDL application without any test in this PR catching it. Best improvement: one sentence in theSchemaChangeApplierjavadoc (orExternalSchemaChangeOperator's class doc) stating the single-emission assumption explicitly. Severity: Low. Raised by another reviewer: No.
2. Code Quality Assessment
2.1 Coding Standards
All core new classes (SchemaOperator, ExternalSchemaChangeOperator, SchemaRefreshBarrierOperator, SchemaEvolutionSinkFlow, SchemaChangeApplier, SupportCoordinatedSchemaEvolutionSink) carry class-level javadoc explaining responsibility and, where relevant (SchemaOperator), the concurrency/checkpoint safety reasoning. No gaps found this round.
2.2 Test Coverage and Test Stability
No test files changed in 3add4380a (docs-only, correctly so). Test coverage for the code itself was already assessed as solid in prior rounds — targeted unit tests exist for the parallelism-alignment fix, the deterministic applier resolution, the construction-time writer-contract check, and an E2E (MysqlCDCWithFlinkCoordinatedSchemaEvolutionIT) covering both a parallel and a failover scenario. I did not re-run tests (static review only per protocol) but re-read SchemaRefreshBarrierOperatorTest.java and ExternalSchemaChangeOperatorTest.java to confirm they exercise the restore-then-refresh-before-first-row path (1.1 above) and not just the happy path — confirmed. Rating: Stable — no hard sleeps, static/global state, or order-dependent assertions found in the schema-evolution test files.
2.3 Documentation Updates
This commit is the documentation update requested last round, and it's complete: both docs/en and docs/zh incompatible-changes entries are added in the same commit, in the same format as neighboring entries (Affected component / Description / Impact / Migration Guide), and the two entries match actual verified behavior (1.2 above). Nothing further needed here.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise, long-term fix — not a workaround. Splitting "apply DDL once" from "refresh writer-local state" and driving both off Flink's own checkpoint-barrier ordering guarantee (rather than a custom ack protocol or a process-local singleton) is the correct fix for the underlying cross-JVM coordination problem, and it composes cleanly with existing checkpoint/restore semantics rather than adding a parallel out-of-band coordination channel.
3.2 Maintainability
Good. The two-round checkpoint gate in SchemaOperator is non-obvious and could trip up a future maintainer, but it's documented in detail both at the class level and inline at each decision point (:216-233, :299-309).
3.3 Extensibility
The opt-in SPI (SupportCoordinatedSchemaEvolutionSink/SchemaChangeApplier/SupportSchemaRefreshSinkWriter) is cleanly separated from the non-coordinated path (BroadcastSchemaSinkOperator is untouched for sinks that don't opt in), so adding coordination support to a new connector doesn't require touching this PR's core operators.
3.4 Historical-Version Compatibility
Correctly and now explicitly documented as a breaking change for checkpoint/savepoint restore (see 1.2). This is the right way to handle it for an experimental/opt-in feature: disclose the restore risk with concrete migration guidance rather than attempting silent state-compatibility shims that would add significant complexity for a feature not yet in a released version.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | SPI/operator contract implicitly assumes single-subtask DDL emission per event; not documented | ExternalSchemaChangeOperator.java, SchemaChangeApplier.java |
Low |
5. Merge Recommendation
Conclusion: Ready to merge
-
Blockers — must be fixed
- None. Every blocker from all four prior review rounds (mine and @SEZ9's) is verifiably fixed in the current head, independently re-confirmed in this round rather than assumed.
-
Recommended fixes — non-blocking
- Issue 1 above (Low): document the single-subtask-emission assumption in the SPI javadoc.
- Carryover (Low, from my last round, still open, still non-blocking): consider a monotonic counter instead of wall-clock millis for the refresh-barrier epoch if this is ever revisited — not urgent since epoch is only used for ordering within a single job run.
Operational note, not a code blocker: the apache-side "Build" check is currently in_progress/pending on this exact head (3add4380a) at review time — the previous head (2794351) had three fork job failures (JDBC error-sink-close timeout, SAP HANA container startup, RocketMQ restore-count race) that I confirmed by reading logs were pre-existing, unrelated flakes, not caused by this PR's diff. Since this round's only change is two markdown files, I have high confidence CI will resolve the same way, but please confirm the fresh run is green before merging.
Overall assessment: this is a well-executed, thoroughly-iterated fix for a real cross-JVM coordination gap, and the checkpoint-barrier-based design is the right long-term answer rather than a patch. This round's commit closes out the last two open asks (parallelism-change disclosure and checkpoint/savepoint restore disclosure) cleanly and accurately. Thanks for the sustained back-and-forth across five rounds, @dybyte — this is in good shape to merge once CI confirms green on the current head.
|
Stale-CI-status update on this same head ( In my 2026-08-26 approval I noted the apache-side No code blockers were open in that review ("None. Every blocker from all four prior review rounds is verifiably fixed") — CI confirmation was the only outstanding item, and it's now cleared. My conclusion remains Approve; nothing further is blocking from my side. |
…tion # Conflicts: # seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/AbstractJdbcSinkWriter.java # seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/flink/AbstractTestFlinkContainer.java # seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/flink/Flink20Container.java
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the continued work and for keeping the branch moving, @dybyte. Since my last approval (head 3add438) the only new commit is a merge of upstream dev (5673b26). I re-checked that merge against the PR's own code to make sure nothing was lost or double-applied, and I found one thing that needs your attention: the branch now has a merge conflict with dev.
What Problem Does This PR Solve?
- User pain point: With schema evolution on a parallel Flink sink, every sink subtask (and every sibling sub-writer of a MultiTableSink) used to run the external DDL on its own, and the old LocalSchemaCoordinator only synchronised inside one JVM, so it could not coordinate subtasks on different TaskManagers.
- Fix approach: Apply the external DDL exactly once in a parallelism-1 operator, broadcast the complete evolved schema to every parallel writer for a local refresh, and release post-change rows only after a later checkpoint proves every downstream operator has seen the control record. JDBC and MultiTableSink opt in through the new SPI; other sinks keep the old path.
- Example: A MySQL CDC job writes to JDBC with sink parallelism 4. An ADD COLUMN arrives. Before: four writers each try the ALTER TABLE. After: one operator runs it, all four writers refresh their statements, and only then do rows containing the new column flow.
1. Code Change Review
1.1 Core Logic Analysis
What the new head adds on top of my last approval. I diffed the PR's own changes (three-dot against dev) at the old and new heads. The functional delta is the upstream "restore schema" work that landed in dev (RestoreTableSchemaEvent / SCHEMA_CHANGE_RESTORE), now interacting with the coordinated path. I traced it through the real call chain:
CDC source restore -> emits RestoreTableSchemaEvent as a schema control row
-> SchemaOperator.handleSchemaChangeDetected (SchemaOperator.java:169: restore bypasses the "source supports no change types" skip)
-> SchemaOperator timestamp de-dup (SchemaOperator.java:393: restore events are exempt, so two tables restored in the same millisecond both pass)
-> isSchemaChangeSupported (SchemaOperator.java:613: SCHEMA_CHANGE_RESTORE returns true)
-> two-round checkpoint gate (unchanged), then control row dispatched
-> ExternalSchemaChangeOperator.processElement (ExternalSchemaChangeOperator.java:74-75: applier.apply(event) then output.collect)
-> JdbcSchemaChangeApplier.apply (JdbcSchemaChangeApplier.java:52: restore event returns before any connection is opened, so NO physical DDL)
-> SchemaRefreshBarrierOperator broadcast -> each sink writer refreshSchema(...) rebuilds its output format from the restored schema
Findings:
- The dev contract for RestoreTableSchemaEvent is "refresh runtime schema only, never execute DDL". The coordinated path honours it, because the DDL-applying step (JdbcSchemaChangeApplier.apply) short-circuits on restore events. I confirmed this in the source; this is the key interaction the merge introduced and it is handled correctly.
- AbstractJdbcSinkWriter.applySchemaChange (the legacy/Zeta entry point) now routes through the same applier, so the dev-side restore guard that used to live in reOpenOutputFormat is preserved through the applier rather than lost. The commitOnFlush field and the extra JdbcSink constructor argument from dev's recent JDBC change are both intact at the merged head (AbstractJdbcSinkWriter.java:65 and :113, JdbcSink.java), so I see no compile-level fallout from the merge.
- The MultiTableSinkWriter routing change from dev (#12290, bucket index instead of Math.abs) merged cleanly with the PR's schema-refresh changes; the PR does not touch the routing code.
- The two-round checkpoint gate, the parallelism-1 external DDL operator (emit only after apply returns successfully) and the union-list-state restore refresh are unchanged from the head I approved, and I saw nothing in the merge that disturbs them.
Is the normal path affected? Yes for the main path (any Flink job whose sink opts in and whose source emits schema changes). The restore handling only matters on failover/restart.
1.2 Compatibility Impact
Partially incompatible (documented). The public SPI additions are additive and experimental. The behavior changes for coordinated sinks (unconfigured sink parallelism handling, and checkpoint/savepoint restore across the new operator topology) are already recorded in incompatible-changes.md in both English and Chinese, as I asked in the previous round. The merge did not change this assessment.
1.3 Performance / Side-Effect Analysis
No new side effects from the merge. Per-writer cost of schema refresh is bounded (one output-format rebuild per DDL), and the single DDL operator runs once per event. The restore path adds one no-op apply plus one refresh per table per restore, which is cheap and idempotent.
1.4 Error Handling and Logging
No new code-level blocking issues were found at this head. One mechanical blocker remains, plus two low carryovers.
Issue 1: Branch has a merge conflict with dev in the Flink E2E base container
- Location: seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/flink/AbstractTestFlinkContainer.java, tearDown() (about line 210 at the PR head)
- Problem: GitHub reports the PR as DIRTY. A read-only merge simulation of dev into this head shows exactly one conflicting hunk. The PR's tearDown calls stopTaskManagers() (stops the primary and the additional TaskManagers used by the new parallel/failover E2E) and then removes the volume; dev's tearDown (changed by #12481) calls stopContainersAndDeleteVolume(taskManager, jobManager) so that both containers always stop even if one fails.
- Potential risk: Resolving by taking either side wholesale is unsafe. Taking dev's side would leak the additionalTaskManagers containers the new E2E starts (they stay registered on the shared network and can attach to the next test's JobManager, which is the very hang #12481 fixed). Taking the PR's side would reintroduce the leak-on-failure behavior dev just removed.
- Best improvement: Please sync latest dev and resolve the conflict by keeping dev's guaranteed-stop semantics and extending them to the additional TaskManagers, for example by stopping the extra managers inside the same always-run cleanup before calling dev's stopContainersAndDeleteVolume(taskManager, jobManager), and clearing the list afterwards. Re-run the new MysqlCDCWithFlinkCoordinatedSchemaEvolutionIT scenarios after the resolution since they depend on this teardown.
- Severity: High (it blocks merging; the code itself is fine)
- Raised by another reviewer: No
Issue 2: SPI javadoc does not state the single-emission assumption (carryover from my last round, still non-blocking)
- Location: seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SchemaChangeApplier.java and ExternalSchemaChangeOperator.java:74
- Problem: Correctness relies on each schema event being applied by the parallelism-1 operator exactly once per dispatch, and on apply() being safe to retry after a failover (the control row may be replayed). The contract does not say so.
- Potential risk: A future connector implementing the SPI with a non-idempotent apply() could double-apply DDL after recovery.
- Best improvement: Add one javadoc sentence requiring idempotent or retry-safe apply().
- Severity: Low
- Raised by another reviewer: No
Issue 3: Refresh epoch uses wall-clock millis (carryover, still non-blocking)
- Location: SchemaRefreshBarrierOperator / SchemaOperator epoch handling
- Problem: Epoch is derived from event creation time; a monotonic counter would be more robust to clock skew.
- Potential risk: Only ordering within one job run depends on it, so practical risk is low.
- Best improvement: Optional; consider a monotonic counter if this area is revisited.
- Severity: Low
- Raised by another reviewer: No
My earlier blockers and @SEZ9's blockers (compile error in the E2E, dead LocalSchemaCoordinator, eager and nondeterministic applier creation, unenforced SupportSchemaRefreshSinkWriter contract, forward-edge parallelism mismatch) were verified fixed in the previous round at 3add438; the merge did not reintroduce any of them (LocalSchemaCoordinator is still deleted in the diff against dev, and the writer-contract and applier files are unchanged by the merge).
2. Code Quality Assessment
2.1 Coding Standards
Good. New classes carry class-level javadoc and the non-obvious two-round gate is explained at the decision points. The new restore-related lines in SchemaOperator have an explanatory comment for the timestamp de-dup exemption.
2.2 Test Coverage and Test Stability
The new head adds SchemaOperatorTest cases for the restore events (always-supported check, and two restore events sharing one timestamp both being processed through three checkpoints each). They exercise real operator behavior (queue contents, emitted records, pending flag), so they would fail if the de-dup exemption or the support-check branch were removed. I reviewed them statically and did not run them. Stability rating: Stable; no hard sleeps or shared static state in the schema-evolution tests I read. The E2E base-container teardown conflict above is the only test-infrastructure risk.
2.3 Documentation Updates
Complete for this feature: English and Chinese incompatible-changes entries, schema-evolution notes and the sink-development guide are present. No change needed from the merge.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise, long-term fix: separating one-time DDL from per-writer refresh and using Flink's checkpoint-barrier ordering is the right mechanism, and it composes cleanly with dev's restore-event contract.
3.2 Maintainability
Good. The opt-in SPI keeps non-coordinated sinks on their existing path.
3.3 Extensibility
Other connectors can adopt the SPI without touching the Flink operators; Issue 2 would make the idempotency expectation explicit for them.
3.4 Historical-Version Compatibility
Restore-from-old-savepoint risk for the new operator topology is documented as a breaking change; the feature is opt-in and not part of a released version. Fine.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Merge conflict with dev; teardown must keep both dev's guaranteed-stop and the extra TaskManager cleanup | AbstractTestFlinkContainer.java tearDown() | High (blocks merge, mechanical) |
| 2 | Document retry-safe, single-emission apply() contract | SchemaChangeApplier.java, ExternalSchemaChangeOperator.java:74 | Low |
| 3 | Wall-clock epoch (optional) | SchemaOperator / SchemaRefreshBarrierOperator | Low |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
-
Blockers - must be fixed
- Issue 1: sync latest dev and resolve the AbstractTestFlinkContainer.tearDown conflict as described, preserving both behaviors.
-
Recommended fixes - non-blocking
- Issue 2 and Issue 3 (Low).
Overall assessment: I have no code-level objection at this head; my earlier approval of the design and logic still stands, and the interaction with dev's new restore-event contract is handled correctly (no DDL on restore, tested at the operator level). Because the branch cannot merge as is, I am leaving this as a comment rather than a fresh approval until the conflict is resolved.
Response to existing reviews: @SEZ9's change request (at 199e786) was fully addressed in earlier rounds as recorded in my previous review; nothing from it is outstanding.
CI / sync status: The failing fork job is unit-test (11, ubuntu-latest), where engine-server JobMasterTest fails in its setup after a 300 second wait. This PR does not modify seatunnel-engine, so I treat it as an unrelated flake (an inference from the diff scope and the log, not a proven root cause); a targeted rerun of that single job after you push the conflict resolution should settle it. Next step: merge dev, fix the one conflict, push, and confirm the fresh Build is green.
|
@dybyte pls resolve conflicts🚀 |
|
Thanks for keeping this moving. Quick status from my side:
Once the conflict is resolved, could you also give a short per-item status on the earlier findings so I can close them out?
If any of these were already addressed in the merge commit, just point me at it and I'll re-check. Thanks! |
…tion # Conflicts: # docs/en/introduction/concepts/incompatible-changes.md # docs/zh/introduction/concepts/incompatible-changes.md # seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/flink/AbstractTestFlinkContainer.java
| @Experimental | ||
| public interface SupportCoordinatedSchemaEvolutionSink extends SupportSchemaEvolutionSink { | ||
|
|
||
| /** |
There was a problem hiding this comment.
I think that this method seems unnecessary?
examples: can use: (xxx instanceof SupportCoordinatedSchemaEvolutionSink)
There was a problem hiding this comment.
Thanks for the question, @nzw921rx. I traced the callers: MultiTableSink itself implements SupportCoordinatedSchemaEvolutionSink (MultiTableSink.java:243-250), so a plain instanceof check would be true for every multi-table sink, including ones whose child sinks do not support coordination. The method lets the composite answer 'all children support it' (callers: FlinkSink.java:105 and SchemaEvolutionSinkFlow.java:42). I think it is needed; a short javadoc on the interface method explaining why instanceof alone is not enough would make that clear. @dybyte could you add that line?
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Thanks for resolving the conflict, @dybyte, and sorry the earlier round left this waiting on a mechanical merge. I re-reviewed the latest head 40c9ff2782e9 in full (not just the delta). My last round (2026-10-03, head 5673b261ca) had exactly one blocker: the merge conflict in AbstractTestFlinkContainer.tearDown(). That blocker is cleared.
- User pain point: With parallel Flink sink writers, every subtask used to run external DDL on its own, producing duplicate or conflicting DDL, and the old JVM-local
LocalSchemaCoordinatorcould not coordinate subtasks living in different TaskManager JVMs. - Fix approach: A checkpoint-barrier-driven gate.
SchemaOperatorbuffers rows behind a detected DDL,ExternalSchemaChangeOperator(parallelism 1) applies the DDL once, andSchemaRefreshBarrierOperatorbroadcasts the evolved schema so every parallel writer refreshes locally before it sees post-DDL rows. This sits behind the opt-inSupportCoordinatedSchemaEvolutionSink/SchemaChangeApplier/SupportSchemaRefreshSinkWriterSPI. - One-sentence summary: Exactly-once external DDL across parallel Flink sink writers, with a clean opt-in SPI for connectors.
1. Code Change Review
1.1 Core Logic Analysis
What changed since my last review. I compared the PR's own added and removed lines at 5673b261ca against the current head, both taken relative to their merge base with dev. The only difference is in AbstractTestFlinkContainer.java tearDown(): the PR's multi-TaskManager support now composes with dev's guaranteed-stop teardown. Every other line of the author's work is line-for-line the same as what I already reviewed and approved in the earlier rounds.
Resolved tearDown() (AbstractTestFlinkContainer.java, around lines 208-221):
List<GenericContainer<?>> containers = new ArrayList<>();
containers.add(taskManager);
containers.addAll(additionalTaskManagers);
containers.add(jobManager);
additionalTaskManagers.clear();
stopContainersAndDeleteVolume(containers.toArray(new GenericContainer<?>[0]));This is the resolution I asked for. It keeps dev's stopContainersAndDeleteVolume(...) contract in AbstractTestContainer.java:156-175 (every container is attempted, failures are accumulated, the host volume is always deleted, and null entries are skipped by stopContainer) and it also stops the extra TaskManagers created by replaceTaskManagers(...). The JobManager is stopped last and the "jobmanager" network alias is not left behind for the next test case. getServerLogs() and stopTaskManagers() are null-safe for the replaced-cluster case.
Key findings
- The normal Flink path still reaches the new logic through
SinkExecuteProcessor->SchemaEvolutionSinkFlow, which is selected only whenSupportCoordinatedSchemaEvolutionSink.supportsCoordinatedSchemaEvolution()is true. Everything else stays on the existingBroadcastSchemaSinkOperatorpath. - Runtime path, unchanged:
SchemaOperatorrecords the first checkpoint that sees the DDL at the head of its buffer, then dispatches only after a later completed checkpoint, and drains buffered rows only after the next one.ExternalSchemaChangeOperatoremits the refresh element only afterapplier.apply(...)returns, andSchemaRefreshBarrierOperatorre-emits restored union-state snapshots inopen().FlinkSink.java:106-113andFlinkSinkWriter.javafail fast when a coordinated sink's writer does not implementSupportSchemaRefreshSinkWriter. - The earlier blockers from @SEZ9 and from me (eager and nondeterministic applier creation, unenforced writer contract,
.forward()parallelism mismatch, deadLocalSchemaCoordinator) are still fixed on this head. The merge did not reintroduce any of them:LocalSchemaCoordinator.javais still deleted in the diff against dev.
On @nzw921rx's inline question about supportsCoordinatedSchemaEvolution() (could it be replaced by a plain instanceof SupportCoordinatedSchemaEvolutionSink?): I traced the callers and I believe the method is needed. MultiTableSink itself implements the interface (MultiTableSink.java:230-238), so an instanceof check would be true for every multi-table sink, including ones whose child sinks do not support coordination. The method lets the composite answer "all children support it". The callers are FlinkSink.java:105 and SchemaEvolutionSinkFlow.java:42. Happy to be corrected if I am missing a simpler way to express that; a short javadoc remark on why instanceof alone is not enough could also close that thread.
1.2 Compatibility Impact
Fully compatible for existing jobs: the feature is opt-in per sink, non-coordinated sinks keep the existing path, and the restore risk of the new operator topology is documented in incompatible-changes.md (en and zh). Public API surface is additive and marked @Experimental. No configuration option, default, serialization format or released-version behavior changes in this merge-only update.
1.3 Performance / Side-Effect Analysis
Unchanged from the reviewed version: the DDL gate costs two checkpoint rounds only when a schema change is actually in flight, the applier is created lazily, and buffered rows are held in operator state only for that window. The only change in this update is test-container teardown, so there is no production CPU, memory or lock impact.
1.4 Error Handling and Logging
Unchanged. apply() failures propagate and fail the parallelism-1 task, so the refresh signal is never emitted before the DDL succeeded. Teardown accumulates and rethrows failures instead of masking them.
2. Code Quality Assessment
2.1 Coding Standards
Good; new classes carry class-level javadoc and the two-round gate is explained at the decision points.
2.2 Test Coverage and Test Stability
Operator, applier, JDBC and E2E coverage is unchanged and still exercises the real code paths. The teardown change makes the E2E containers more robust (all containers are always stopped). I reviewed the tests statically and did not run them. Stability rating: Stable.
2.3 Documentation Updates
Complete: en and zh incompatible-changes.md, schema-evolution notes and the sink-development guide are present. No change needed.
3. Architectural Soundness
3.1 Elegance of the Solution
Long-term solution: it separates one-time DDL from per-writer refresh and relies on Flink's barrier ordering rather than a JVM-local coordinator.
3.2 Maintainability
Good; the opt-in SPI keeps non-coordinated sinks untouched.
3.3 Extensibility
Other connectors can adopt the SPI without touching the Flink operators.
3.4 Historical-Version Compatibility
Compatible with released versions; savepoint restore into the new topology is documented.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Document that SchemaChangeApplier.apply() must be retry-safe and emit once (carryover from my last round, non-blocking) |
SchemaChangeApplier.java, ExternalSchemaChangeOperator.java |
Low |
| 2 | Optional: monotonic counter instead of wall-clock epoch (carryover, non-blocking) | SchemaOperator / SchemaRefreshBarrierOperator |
Low |
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers - must be fixed: None. The merge-conflict blocker from my previous round is cleared.
- Recommended fixes - non-blocking: Issues 1 and 2 above (both already noted last round; neither is new).
CI / merge state: CI on the current head is green. The apache-side Build check points to the fork run 37341045709 for head 40c9ff2782e9, which finished successfully (83 jobs succeeded, 11 skipped). The branch is behind dev (behind_by=45, status diverged) but GitHub reports it as mergeable with no conflicts. The remaining gate is the required approval from a reviewer with write access (reviewDecision=REVIEW_REQUIRED). My technical conclusion is that no source-side blocker remains; since I only have read-level review controls here, a maintainer will need to submit the final approval. Please note that my earlier changes requested entry may still be visible in the review summary for the same reason.
Response to existing reviews: @SEZ9's change request (at 199e786b2c) and the per-item status list from 2026-10-04 (applier creation, keying, javadoc, writer contract, docs) were addressed in earlier rounds; I re-checked the contract enforcement and docs on this head and they are still in place.
Thanks again for the patience and the careful work on this.
…tion # Conflicts: # docs/en/introduction/concepts/incompatible-changes.md # docs/zh/introduction/concepts/incompatible-changes.md
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks @dybyte for keeping this branch in sync with dev again. The head moved to d3a8a348ddb0 after my last review at 40c9ff2782e9, so I re-read the whole PR from scratch instead of only the merge. Analysis is static; nothing was built or run locally.
What Problem Does This PR Solve?
- User pain point: with parallel Flink sink writers, every subtask used to run external DDL on its own, producing duplicate or conflicting DDL. The old JVM-local
LocalSchemaCoordinatorcould not coordinate subtasks in different TaskManager JVMs. - Fix approach: a checkpoint-barrier-driven gate.
SchemaOperatorbuffers rows behind a detected DDL,ExternalSchemaChangeOperator(parallelism 1) applies the DDL once, andSchemaRefreshBarrierOperatorbroadcasts the evolved schema so every writer refreshes locally before it sees post-DDL rows. It sits behind the opt-inSupportCoordinatedSchemaEvolutionSink/SchemaChangeApplier/SupportSchemaRefreshSinkWriterSPI. - One-sentence summary: exactly-once external DDL across parallel Flink sink writers with an opt-in connector SPI.
1. Code Change Review
1.1 Core Logic Analysis
What changed since 40c9ff2782e9: the only commit is a merge of apache:dev. To separate the author's work from dev drift, I diffed the PR's own changed lines (relative to each head's merge base with dev) over all 44 PR files for both heads, and the added and removed lines are identical. So everything I reviewed and approved in earlier rounds, including the multi-TaskManager-safe AbstractTestFlinkContainer.tearDown() composition with dev's stopContainersAndDeleteVolume(...), is unchanged.
Runtime path (unchanged, re-verified at this head):
SinkExecuteProcessor -> SchemaEvolutionSinkFlow
(selected only if SupportCoordinatedSchemaEvolutionSink.supportsCoordinatedSchemaEvolution())
SchemaOperator: buffer rows behind DDL, record the checkpoint that saw it, dispatch after a later completed checkpoint
-> ExternalSchemaChangeOperator (parallelism 1): applier.apply(...), emit refresh only after success
-> SchemaRefreshBarrierOperator: broadcast full evolved schema; re-emit restored union-state snapshots in open()
-> parallel sink writers: SupportSchemaRefreshSinkWriter refresh, then post-DDL rows are released
Non-coordinated sinks stay on the existing BroadcastSchemaSinkOperator path, and FlinkSink / FlinkSinkWriter fail fast when a coordinated sink's writer does not implement the refresh contract. LocalSchemaCoordinator is still deleted.
On @nzw921rx's inline question (could supportsCoordinatedSchemaEvolution() be a plain instanceof SupportCoordinatedSchemaEvolutionSink?): I traced the callers (FlinkSink.java:105, SchemaEvolutionSinkFlow.java:42, MultiTableSink.java:243-250, :296). MultiTableSink itself implements the interface, so instanceof alone would be true for every multi-table sink, including ones whose child sinks do not support coordination. The method lets the composite answer "all children support it". So I believe it is needed. A one-line javadoc on the interface method saying why instanceof is not enough would close that thread.
1.2 Compatibility Impact
Fully compatible for existing jobs. The feature is opt-in per sink, the SPI is additive and @Experimental, and the restore risk of the new operator topology is documented in incompatible-changes.md (en and zh). No option, default or serialization change in this update.
1.3 Performance / Side-Effect Analysis
Unchanged: the DDL gate costs checkpoint rounds only while a schema change is in flight, the applier is created lazily, and buffered rows live in operator state only for that window.
1.4 Error Handling and Logging
Unchanged: apply() failures fail the parallelism-1 task, and the refresh signal is never emitted before the DDL succeeded.
2. Code Quality Assessment
2.1 Coding Standards
Good; the new classes have class-level javadoc.
2.2 Test Coverage and Test Stability
Operator, applier, JDBC and E2E coverage is unchanged and exercises the real code paths. Stability rating: Stable.
CI for this head: the apache-side Build check is action_required because no Build run exists in your fork for d3a8a348ddb0. The previous head 40c9ff2782e9 had a fully green fork run, so this is a missing run, not a failure.
To pass the automated CI checks for this PR, could you please enable CI workflows in your forked repository first? You can refer to this check run for the required configuration: https://github.com/apache/seatunnel/runs/120034146429. If you run into any trouble enabling CI, feel free to leave a comment here.
2.3 Documentation Updates
Complete (en and zh incompatible-changes, schema-evolution notes, sink development guide).
3. Architectural Soundness
3.1 Elegance
Long-term solution: it separates one-time DDL from per-writer refresh and relies on Flink's barrier ordering instead of a JVM-local coordinator.
3.2 Maintainability
Good; the opt-in SPI keeps non-coordinated sinks untouched.
3.3 Extensibility
Other connectors can adopt the SPI without touching the Flink operators.
3.4 Historical-Version Compatibility
Compatible with released versions; savepoint restore into the new topology is documented.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Carried over, non-blocking: document that SchemaChangeApplier.apply() must be retry-safe |
SchemaChangeApplier.java, ExternalSchemaChangeOperator.java |
Low |
| 2 | Carried over, non-blocking: optional monotonic counter instead of wall-clock epoch | SchemaOperator / SchemaRefreshBarrierOperator |
Low |
| 3 | New, non-blocking: javadoc on why supportsCoordinatedSchemaEvolution() is not replaceable by instanceof (answers the open inline thread) |
SupportCoordinatedSchemaEvolutionSink.java:39 |
Low |
5. Merge Recommendation
Conclusion: Ready to merge
Blockers: none in source. The only remaining gate is CI on this head (see 2.2).
Recommended non-blocking: Issues 1 to 3.
Overall assessment: the PR-owned code is unchanged since the head I last verified and it has had a green fork run on that head. My earlier changes requested entry may still show in the review summary; I have no write-level review controls, so a maintainer needs to do the final approval or dismissal. The branch is mergeable with no conflicts (behind_by is metadata only).
|
Agree with the analysis in the thread on Please add a short javadoc on that interface method explaining exactly this (why Remaining asks from the previous review that are still open:
Once those are in, I'll take another pass. |
|
Thanks @SEZ9 for the follow-up. I re-checked each "remaining ask" against the current head (
The one item that is genuinely still open is the small one we agreed on in the inline thread: a javadoc line on Separately, the apache-side If you see a specific scenario in the code above that I mis-traced, please point me at the line and I will re-check. Thanks again for the careful review! |
|
Thanks for the detailed walkthrough against head
I'll re-check each of these against the diff for |
|
Thanks, @SEZ9, for mapping the responses back to your original findings. That is useful context for closing your threads: lazy applier construction, logical/physical table resolution, identifier safety, the writer contract and the paired docs should each be checked against the current head before being marked resolved. I am not adding a second numbered copy of those points or treating this acknowledgement as your final review. The check snapshot still has the workflow-approval gate rather than a completed required Build result; that needs repository-side attention, and is not evidence that the contributor should add another source patch. Your thread closeout and final write-capable maintainer decision remain separate from this discussion reply. |
nzw921rx
left a comment
There was a problem hiding this comment.
[P1] A later completed checkpoint can release post-DDL rows before writer refresh
Reviewed head: d3a8a348ddb08c9866c305276ec8f91b01f0953f
Locations
Problem
schemaChangeDispatchedCheckpointId records the checkpoint whose completion callback dispatches the DDL. Any subsequent completion with a larger ID releases the buffered rows.
However, a larger checkpoint ID does not prove that its snapshot/barrier followed the schema control record. With concurrent checkpoints enabled, that checkpoint may already have passed through the downstream operators before the DDL was dispatched.
Data and schema-refresh records travel through separate inputs. If data arrives first, SchemaRefreshBarrierOperator.processElement1() forwards it when no schema snapshot is available, allowing the sink to process a new-schema row using its old writer schema.
Triggering scenario
For example, with execution.max-concurrent-checkpoints = 2:
- Receive a schema change and buffer its following data row.
- Complete checkpoint 10, setting
firstSeenCheckpointId = 10. - Take the local snapshots for checkpoints 11 and 12 before processing completion notification 11.
- Process completion notification 11: dispatch the schema control record and record dispatch checkpoint ID 11.
- Process completion notification 12: the current implementation releases the buffered row because
12 > 11. - Delay the schema-refresh input and deliver the released row to the barrier's data input first. The row reaches the sink without a preceding refresh.
Checkpoint 12 cannot confirm this schema change: its barrier preceded the control record.
Local validation
I compiled the affected production classes from this head against Flink 1.15.3 and ran the targeted tests on JDK 17.
| Validation | Result |
|---|---|
| Existing schema-operator and topology tests | 16/16 passed |
| Existing MultiTable and JDBC tests | 17/17 passed |
| Existing Flink writer tests | 5/5 passed |
| Additional controlled snapshot/completion interleaving | Reproduced post-DDL data reaching the sink before refresh |
Actual JDBC writer with SQLite after ADD COLUMN email |
Input email = 'alice@example.com' was committed as NULL when refresh was delayed |
| Positive control: deliver refresh before the same row | email = 'alice@example.com' was preserved |
The JDBC probe had already applied the physical ADD COLUMN. The stale writer still generated an INSERT without the new column:
INSERT INTO users (id, name, age) VALUES (?, ?, ?)The new field was therefore silently omitted.
These are deterministic operator-level tests with controlled callback/input ordering and a real SQLite database, not a full Flink cluster E2E run.
Impact
Post-DDL rows can be processed using stale writer-local schema state. The SQLite probe demonstrates silent field loss even after the external DDL has succeeded.
Requested change
Please make row release depend on confirmation that actually covers the dispatched schema change and downstream writer refresh.
For a checkpoint-based solution, establish control-before-barrier ordering for the confirming checkpoint instead of relying only on:
completedCheckpointId > dispatchCallbackCheckpointIdPlease add a regression test covering an already-in-flight checkpoint and delayed refresh delivery, asserting that the new JDBC column retains its value.
Recommendation: Request changes. This ordering issue should be fixed before merging because it can cause silent field loss.
|
Thanks for the detailed P1 write-up, @nzw921rx, on For this pass I'm keeping to the points raised in the earlier review:
Happy to take another look once these have a reply or a push. |
|
Thanks @nzw921rx for the detailed P1 on
This needs a code change, so I am treating it as a blocking item on my side and I have not marked it resolved. @dybyte, please make row release depend on a checkpoint whose barrier is known to follow the dispatched control record, or on an explicit ack from the downstream refresh, and add a regression test with an in-flight checkpoint plus delayed refresh delivery that asserts the new column keeps its value. I will re-review as soon as a new commit lands. |
|
Thanks for keeping this contribution moving. I need to update the merge-gate information on unchanged head Please sync the latest The source-level schema-refresh/checkpoint ordering blocker remains open. Resolving the conflict alone does not supply the downstream-refresh acknowledgement required by that review. The preceding complete source review remains the source assessment; this is a gate clarification, not another full review or a new list of source findings. Current existing-head checks: Build=ACTION_REQUIRED. Compare |
|
Quick status update on this PR at head Merge gate
Open review items
The schema-refresh/checkpoint ordering blocker from that review also remains open; resolving the conflict alone doesn't supply the downstream-refresh acknowledgement it asks for. If any of these were already handled, a short pointer in the PR description would be enough. Happy to take another look as soon as the rebased head is up. |
|
Thanks for the status update, @SEZ9, and for keeping the threads organized. I re-checked your list against the unchanged head (
If you see a spot where one of these is not covered at the current head, please point me at the line and I will re-check. What is genuinely still open:
@dybyte, thank you for the work so far. Could you sync the latest |
|
Following up on the earlier review findings against head
Concrete asks before I mark these resolved:
Nothing else from my previous review remains open. |
|
Thanks @SEZ9. I checked the current source for F6: SchemaEvolutionSinkFlow.coordinate (common Flink schema package, lines 40-72) is the entry that selects the new coordinated applier/broadcast path; FlinkSink:103-113 checks the writer capability, and the Flink writer refresh path also checks it. A repository search found no Zeta or Spark consumer of SupportCoordinatedSchemaEvolutionSink on this head. Thus the new coordinated execution path is currently Flink-specific; that does not establish coordinated support on the other engines. Please state that scope in the SPI Javadoc as you suggested. The actual merge conflict remains a separate blocker: resolve it against dev while preserving the lazy applier creation, physical-table ambiguity rejection and these contracts, then push the resulting head for one complete re-review. The source findings already resolved on this head should not be reopened merely because a rebase is pending. This is an unchanged-head discussion reply, not another complete source review. Daniel has READ permission; technical approval and GitHub's effective maintainer gate are separate. |
…tion # Conflicts: # docs/en/introduction/concepts/incompatible-changes.md # docs/zh/introduction/concepts/incompatible-changes.md
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for contributing to Apache SeaTunnel! Thanks for resolving the merge conflict while retaining the lazy applier and deterministic table selection. The current head still contains the ordering blocker already raised by @nzw921rx. Sorry for the earlier overconfident conclusion about checkpoint ordering, and for missing the test-lifecycle gaps below; these are carryover findings, not problems introduced by your rebase.
Reviewed head fd745646ad5636d2c5fe5a581de4dc6ea348b7f9 against base 9f741b9c64220db31bd94c62dd0749d0b71e9358. Report time: 2026-11-06T01:23:04.051295+00:00.
What Problem Does This PR Solve?
User pain point: A JVM-local coordinator cannot synchronize schema application and every parallel Flink sink writer across TaskManagers.
Fix approach: Separate external DDL from writer-local refresh, broadcast the evolved schema and use checkpoint callbacks to hold post-DDL records.
One-sentence summary: Coordinate one external schema change with all parallel writers, although the current confirmation fence is still incomplete.
Example: After ADD COLUMN email, every writer must build an INSERT including email before accepting a row containing it. A stale writer can otherwise commit that row without its email value.
1. Code Change Review
1.1 Core Logic Analysis
All 44 changed files were inspected, including shared API, MultiTable routing, JDBC DDL/refresh, three Flink starter variants, both writer adapters, state/checkpoint operators and tests. SchemaEvolutionSinkFlow.coordinate splits data/control, applies external DDL at parallelism 1, broadcasts control into a two-input barrier and forwards each barrier to its sink. SchemaOperator records a dispatch callback ID and waits for a larger completed ID; that comparison is the remaining incorrect boundary.
Before / after:
Before: per-JVM LocalSchemaCoordinator ACK -> one receiving writer performs DDL
After: SchemaOperator holds rows -> external applier (parallelism 1) -> broadcast complete schema
-> per-writer refresh barrier -> FlinkSinkWriter -> JDBC local statement rebuild
Current release condition: completedCheckpointId > schemaChangeDispatchedCheckpointId
Required: completion must cover the control record and every writer refresh, not merely a larger number
Key findings:
- Normal streaming schema-evolution setup reaches the new flow on Flink.
- MultiTable sinks opt in only when all children support the capability; appliers are lazy and physical ambiguity is rejected.
- Writer capability enforcement closes an invalid created writer before failing.
- The checkpoint-number comparison does not establish cross-input ordering.
- New topology/default parallelism migration risks are documented, but the cluster failover test remains disabled.
Complete runtime path:
CDC schema event -> AbstractSourceExecuteProcessor schema operator with source parallelism
-> SchemaOperator buffers following rows and checkpoints pending queue/schema state
-> completion callback dispatches schema_change_broadcast
-> SchemaEvolutionSinkFlow data/control filters
-> ExternalSchemaChangeOperator: resolve table -> lazy SchemaChangeApplier -> apply DDL
-> broadcast control to every SchemaRefreshBarrierOperator
-> schema_change_refresh on same output edge before subsequent known-schema data
-> FlinkSinkWriter capability check -> MultiTableSinkWriter drains internal queues
-> AbstractJdbcSinkWriter.refreshSchema -> close/rebuild statements without external DDL
Recovery: union schema snapshots -> barrier.open emits refresh -> new local writers
Failure window: a higher checkpoint was snapshotted before dispatch; its completion releases data while control is delayed
Correctness and boundaries: The single-JVM limitation is correctly removed, and DDL failure prevents forwarding its control record. Same-edge refresh-before-data is sound once the barrier knows the schema, but cannot repair the missing control-before-checkpoint ordering upstream. JDBC delegates replay handling to JdbcDialect (ADD/DROP existence checks); this is not a new exactly-once DDL transaction. RestoreTableSchemaEvent skips physical DDL and rebuilds local schema. The source schema restore dependency and the checkpoint-ordering blocker remain distinct.
1.2 Compatibility Impact
Partially incompatible. SPI additions are experimental, but the operator topology/state and unconfigured Flink sink parallelism change. EN/ZH incompatible-changes notes cover old savepoint restoration uncertainty and setting sink parallelism=1 to preserve old concurrency. Existing JDBC legacy schema-change entry also uses the extracted applier; coordinated execution itself is currently Flink-only.
1.3 Performance / Side-Effect Analysis
A schema change holds subsequent rows up to the existing 100000-record bound across checkpoint rounds. The new parallelism-1 applier can serialize DDL across tables, and schema snapshots are broadcast/replicated in union state. Lazy appliers avoid parallelism-times-table eager connections; JdbcSchemaChangeApplier opens/closes each DDL connection. Active applier close failures are accumulated. No local throughput, recovery or lock-duration benchmark was run. Unconfigured Flink 1.13 sinks may now create more external connections as documented.
1.4 Error Handling and Logging
Existing high-severity blocker, not renumbered: +1 to @nzw921rx's checkpoint-ordering finding. SchemaOperator.java:262-268 still releases rows whenever completedCheckpointId exceeds the dispatch callback ID. A checkpoint 12 snapshot/barrier can already have happened before completion callback 11 dispatches the schema control row. Completion 12 therefore does not acknowledge that row. SchemaRefreshBarrierOperator.java:124-131 forwards a data row when no matching schema snapshot has arrived, so delaying its control input still permits stale-writer processing. The review's SQLite loss demonstration is reviewer-reported evidence; my independent source trace confirms the same reachable ordering, without executing the PR. Establish control-before-barrier ordering for the actual confirming checkpoint, or use explicit per-writer/epoch acknowledgement. Add the already-in-flight-checkpoint plus delayed-control regression and assert the new column value survives.
DDL and refresh failures propagate instead of being acknowledged as success. The completion log claiming every downstream task confirmed processing is too strong until the ordering blocker is fixed. No new credential value logging was found.
Issue 1: Restore real checkpoint/failover validation instead of leaving the only cluster case disabled
- Location:
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/MysqlCDCWithFlinkCoordinatedSchemaEvolutionIT.java:148 - Problem description: The only TaskManager-restart test is disabled pending #11780, so the new checkpointed flow has no active cluster recovery assertion. That linked PR is now closed without merge; its presence is not proof the dependency is available.
- Potential risk: The current change promises reconstructed writer state after recovery without exercised cluster acceptance for that path.
- Best improvement: Identify the current tracked prerequisite or verified replacement and enable the failover case once satisfied; if recovery cannot be supported yet, gate/document that scope explicitly and do not claim completed recovery acceptance. Retain the deterministic ordering regression requested by @nzw921rx as well.
- Severity: Medium (blocking)
- Raised by another reviewer: No
Issue 2: Retain cleanup ownership before starting replacement TaskManagers
- Location:
seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/flink/AbstractTestFlinkContainer.java:187 - Problem description: replaceTaskManagers keeps all new containers in a local list until after deepStart and extendedFactory.extend succeed. If startup or dependency-copy fails, taskManager remains null and additionalTaskManagers empty; tearDown cannot stop those already-started containers.
- Potential risk: Failed setup can leave TaskManagers and network aliases alive until external cleanup, consuming resources and contaminating later CI cases.
- Best improvement: Register the containers with teardown ownership before starting them, or stop every locally created container in a failure-safe catch/finally. Keep cleanup exceptions suppressed on the original failure.
- Severity: Medium (non-blocking)
- Raised by another reviewer: No
Issue 3: Document the nontrivial coordination helpers and state fields
- Location:
seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/schema/SchemaOperator.java:96 - Problem description: The new dispatch-checkpoint marker and helpers encode a safety/lifecycle contract, but their field/method purpose is not documented locally; the current surrounding completion claim is also incorrect. SchemaEvolutionSinkFlow.coordinate and ExternalSchemaChangeOperator resolve/cache helpers need their scope and preconditions stated.
- Potential risk: Future maintenance can conflate callback IDs with barrier ordering or assume cross-engine support.
- Best improvement: After fixing the fence, document what the stored ID proves, when it is persisted/reset, and the Flink-only orchestration/complete-schema requirement. Keep the SPI scope correction aligned with @SEZ9's F6 request.
- Severity: Medium (non-blocking)
- Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
ASF headers and public SPI contracts are present. Identifier safety, retry-safe application and writer refresh are documented. The all-children capability method explains why instanceof is insufficient. Add the remaining Flink-only scope sentence requested by @SEZ9; several nontrivial new helpers/state fields also need comments explaining lifecycle and epoch meaning (Issue 3).
2.2 Test Coverage and Test Stability
Test stability: Risk present. Operator/SQLite fixtures use deterministic inputs and close JDBC resources; SchemaOperatorTest models sequential completion callbacks and does not cover the interleaving above. seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/MysqlCDCWithFlinkCoordinatedSchemaEvolutionIT.java:119-144 uses real row equality and non-null email checks across two TaskManagers with polling, which is stronger than container/log readiness. Its failover case at :148-155 is disabled. The replacement-TaskManager failure path can leave live containers untracked (Issue 2); this is an intermittent cleanup/pollution risk, not evidence that CI passed the race. HTTP polling also uses default client timeouts, so the Awaitility outer bound is not a per-request network bound. No sleep-based assertion was added.
Local verification: git fetch obtained the reviewed head; an independent seatunnel-review-11912 worktree was checked out. git diff 9f741b9c64220db31bd94c62dd0749d0b71e9358...fd745646ad5636d2c5fe5a581de4dc6ea348b7f9 covered all 44 changed files, reconciled with GitHub's complete files list. git diff --check returned 0. Source searches and caller inspection support the paths above. No local build, unit test, integration test, or PR runtime execution was performed, as requested. CI is separate evidence.
2.3 Documentation Updates
EN/ZH configuration, developer and upgrade pages are present and aligned. The public SPI should state that current orchestration is Flink-only. Do not describe recovery validation as complete while the cluster failover test is disabled.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. The correction belongs at the affected boundary rather than in unrelated engine code.
3.2 Maintainability
Keep the source declarations as the reference for future changes.
3.3 Extensibility
No additional abstraction is needed for this focused correction.
3.4 Historical-Version Compatibility
Historical API, configuration and checkpoint formats are unchanged.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Restore real checkpoint/failover validation instead of leaving the only cluster case disabled | seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/MysqlCDCWithFlinkCoordinatedSchemaEvolutionIT.java:148 |
Medium |
| 2 | Retain cleanup ownership before starting replacement TaskManagers | seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/flink/AbstractTestFlinkContainer.java:187 |
Medium |
| 3 | Document the nontrivial coordination helpers and state fields | seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-common/src/main/java/org/apache/seatunnel/translation/flink/schema/SchemaOperator.java:96 |
Medium |
Full-scan check: complete diff, affected callers, failure/lifecycle branches, compatibility, test behavior/stability, documentation and current merge gates examined. The current merge conflict is cleared. @SEZ9's earlier eager-creation, ambiguous-selection, identifier-contract, capability-enforcement and documentation findings are addressed in source; their later F6 scope request remains. I agree with @nzw921rx's request-changes recommendation on ordering and explicitly withdraw the earlier source-ready conclusion. The existing high-severity point is acknowledged above, not duplicated as a numbered Daniel issue.
5. Merge Recommendation
Conclusion: Not recommended for merge
- Blockers — must be fixed: Issue 1: Restore real checkpoint/failover validation instead of leaving the only cluster case disabled The existing high-severity checkpoint-ordering blocker above must be fixed. Apache Build is TIMED_OUT. Exact-head fork Build is completed / cancelled. Missing checks alone do not establish disabled workflows. A write-capable maintainer owns workflow approval/check adoption and the effective merge approval. The exact fork Build timed out/cancelled with all-connectors-it-3 (JDK 17) and connector-file-local-it (JDK 17) unfinished. This is not runtime acceptance. No established base fix makes sync alone a remedy for those cancellations.
- Recommended fixes — non-blocking: Issue 2: Retain cleanup ownership before starting replacement TaskManagers; Issue 3: Document the nontrivial coordination helpers and state fields
Overall assessment and alternatives: The architecture is promising but the safety fence is incomplete. Prefer a checkpoint whose barrier is demonstrably emitted after the control record, or explicit distributed acknowledgement; a numeric delay or sleep is not a substitute. Clear the ordering and active-recovery coverage gates before merge.
Upstream snapshot: dev, ahead 10, behind 0, compare ahead, merge state BLOCKED. Behind/diverged alone is metadata, not a request to synchronize. Daniel has READ permission; this COMMENT is a technical review, not a write-capable maintainer approval.
Related to: #11785
Purpose of this pull request
Introduce coordinated schema evolution for parallel Flink sinks by separating external DDL execution from writer-local schema refresh.
Flink applies each external schema change through a single operator, broadcasts the complete evolved schema to all parallel sink writers, and delays post-change rows until downstream processing is confirmed by a checkpoint. JDBC and MultiTable sinks implement the new opt-in SPI, while unsupported sinks retain the existing behavior.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Check list
New License Guide
incompatible-changes.mdto describe the incompatibility caused by this PR.