Repository navigation
[Test][E2E] Add Zeta CDC cluster failover coverage - #11947
davidzollo merged 9 commits into
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
The Zeta engine already has a generic Hazelcast fault-injection harness (ClusterFaultToleranceIT, SplitClusterFaultToleranceIT, etc.) that validates worker/master failover and all-node-down recovery for plain Fake-source-to-local-file batch/streaming jobs, but none of that coverage exercises a real, stateful CDC source (binlog position tracking, snapshot vs. incremental phase, multi-table/multi-pipeline CDC state) under failover. This PR adds a new, self-contained MysqlCDCClusterFailoverIT that combines the existing local Hazelcast fault-injection harness with a real MySQL CDC source and JDBC upsert sink, covering:
- worker/master failover for a single CDC pipeline in a default (combined master+worker) 2-node cluster and in a split master/worker 4-node cluster,
- all-node-down restart-from-persistent-state recovery for both cluster topologies,
- worker/master failover for a 2-pipeline CDC job.
Supporting changes: two new CDC config templates + MySQL container docker resources under src/test/resources/mysql-cdc-failover/, and a pom.xml addition of connector-cdc-mysql (regular + test-jar) as a test-scope dependency so the module can reuse MySqlContainer/MySqlVersion from the CDC connector's own test utilities.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path: each test method drives real SeaTunnelServerStarter.createHazelcastInstance / createMasterHazelcastInstance / createWorkerHazelcastInstance members, submits a real job through SeaTunnelClient / ClientJobExecutionEnvironment, and exercises the actual checkpoint coordinator (StateStoreCheckpointIDCounter, CounterStateStore) and job-status state machine via ClientJobProxy polling — not a mocked or simulated path. This is genuine engine-level integration coverage, consistent with the existing sibling files it explicitly models itself on.
Verified against precedent: I cross-checked this new file against the two existing classes it says it "combines" (ClusterFaultToleranceIT.java, SplitClusterFaultToleranceIT.java):
TestUtils.getClusterName/TestUtils.createTestConfigFileFromTemplate(used at L222, L744, L779) already exist with matching signatures — no compile risk.- The custom persistent-cluster YAML (
map-store/FileMapStoreFactory/namespace: /tmp/seatunnel/imap, L632-679) is copied near-verbatim fromSplitClusterFaultToleranceIT.testStreamJobRestoreInAllNodeDown(same namespace, same Hazelcast tuning properties) — an already-proven pattern in this module, not a novel risk. connector-cdc-mysql'spom.xmlalready configuresmaven-jar-pluginwith thetest-jargoal, so the new test-scopetest-jardependency (pom.xml diff) resolves cleanly.
Notable improvement over precedent: SplitClusterFaultToleranceIT.testStreamJobRestoreInAllNodeDown restarts all 4 nodes after a blind Thread.sleep(10000) to let the old ports release (L976 in that file). This PR's equivalent (startNodeWithRetry, L1160-1177) instead polls with Awaitility.await().ignoreExceptions().until(...), retrying node startup until the ports are actually free — this is a meaningfully more robust pattern than the sleep-based one it's modeled after, and correctly uses .ignoreExceptions() since Awaitility's default untilAsserted/until does not retry on arbitrary RuntimeException, only on AssertionError.
Design choice worth highlighting: unlike a naive "compare row counts," awaitSourceAndSinkConsistent (L874-917) compares full row content (id, name, stage) with an explicit ORDER BY id in queryRows (L1041) — this correctly avoids the un-ordered-SELECT fragility that a raw physical-storage-order comparison would introduce (see my review of the companion PR #11946, which lacks this ORDER BY). The sink uses primary_keys = ["id"] (upsert), so at-least-once CDC replay after failover converges to the same final content rather than needing exact replay-count bookkeeping — a sound design for this scenario.
1.2 Compatibility Impact
None. Purely additive test module changes: one new test class, new test-only config/docker resources, and a test-scope Maven dependency. No production code, config option, API, or serialization format is touched.
1.3 Performance / Side-Effect Analysis
No production-path side effects. Confirmed junit-platform.properties for this module (seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/junit-platform.properties) sets junit.jupiter.execution.parallel.mode.default = same_thread and ...classes.default = same_thread, so all 8 new @Test methods, and this class relative to sibling classes in the module, run strictly sequentially — this rules out the Hazelcast-port and MySQL server-id collision risks that would otherwise be a concern with 8 back-to-back cluster bootstraps sharing one MySQL container. All new waits use Awaitility polling (no Thread.sleep anywhere in the new file), with reasonable bounds (1-3 minutes) given checkpoint.interval = 3000 in the new templates.
1.4 Error Handling and Logging
Every test method wraps its body in try/finally and calls closeClient/shutdownNode helpers that swallow and log.warn cleanup-only failures (L1127-1151) so a real assertion failure isn't masked by a secondary cleanup exception — good practice, and stronger than the precedent files' plain (non-exception-swallowing) finally blocks. See Issue 1 for the one substantive finding.
2. Code Quality Assessment
2.1 Coding Standards
Comprehensive Javadoc on every new public/private method, matching the project's requirement for non-trivial methods. New file has the required ASF license header. Formatting appears consistent with the rest of the module.
2.2 Test Coverage and Test Stability
This is itself new coverage filling a real gap (CDC-specific failover, not covered by the generic Fake-source harness). Applying the mandatory flaky-test checklist:
- No
Thread.sleepanywhere; all waits are boundedAwaitilitypolling. - Deterministic
ORDER BY idin the reconciliation query removes the row-ordering fragility that an un-ordered comparison would carry. - No shared mutable state across test methods beyond the class-level
MYSQL_CONTAINER; every test creates its own uniquely-suffixed databases/tables (databaseSuffixcombines a sanitized test name withSystem.nanoTime()) and its own uniquely-suffixed cluster name (TestUtils.getClusterName(testCaseName + "_" + System.currentTimeMillis())), so tests are not order-dependent on each other. - Confirmed sequential (not parallel) execution at the
junit-platform.propertieslevel, eliminating the main class of concurrency-driven flakiness this style of test would otherwise be exposed to. startNodeWithRetrycorrectly uses.ignoreExceptions()given Awaitility's default behavior of only retryingAssertionError, not arbitrary exceptions — shows the author understands the library's actual retry semantics rather than assuming it.
Overall test-stability rating: Stable. This is meaningfully more robust than the sleep-based precedent it extends, and I did not find a Thread.sleep/shared-static-state/weak-readiness-signal/order-dependence anti-pattern in the new file.
One precision nitpick, not a stability risk (see Issue 1): assertCheckpointIdsGrow only requires that at least one tracked pipeline's checkpoint id advances after failover, which is slightly weaker than "every pipeline resumed" for the two-pipeline scenario — but this gap is compensated by the subsequent awaitSourceAndSinkConsistent(TwoTableBinding) call, which independently verifies both pipelines' source/sink content converge, so a genuinely stuck second pipeline would still fail the test via the data-reconciliation step even though the checkpoint-growth step wouldn't have caught it on its own.
2.3 Documentation Updates
Not required — internal E2E test coverage only, no user-facing behavior or config semantics changed.
3. Architectural Soundness
3.1 Elegance of the Solution
Good reuse of the existing local-cluster fault-injection harness pattern instead of inventing a new one, while correctly adapting the reconciliation strategy (ordered content diff + upsert sink) to CDC's at-least-once replay semantics rather than reusing the file-line-count strategy the precedent files use for Fake-source jobs (which wouldn't fit a stateful CDC source).
3.2 Maintainability
TableBinding/TwoTableBinding value objects and the NodeStarter functional interface keep the eight scenario methods readable and DRY — shared setup/teardown/assert logic is properly factored into private helpers rather than duplicated per test.
3.3 Extensibility
The helper set (awaitCheckpointIds, assertCheckpointIdsGrow, awaitSourceAndSinkConsistent, startNodeWithRetry) is generic enough to support adding further CDC failover scenarios (e.g., other connectors' CDC sources) with minimal new code.
3.4 Historical-Version Compatibility
N/A — test-only addition, no checkpoint/savepoint format, serialization, or upgrade-path impact.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | assertCheckpointIdsGrow treats the two-pipeline scenario as passing once any one tracked pipeline's checkpoint id advances after failover, rather than requiring all tracked pipelines to advance. In practice this is compensated by the subsequent awaitSourceAndSinkConsistent(TwoTableBinding) call (which independently checks both pipelines' data), so it is not a real coverage gap end-to-end, but tightening the helper to require growth on every entry in checkpointBefore would make the intent of "both pipelines recovered" explicit at the checkpoint-counter level too, and would fail faster/closer to the root cause if one pipeline's checkpoint coordinator got stuck. |
MysqlCDCClusterFailoverIT.java L996-1019 |
Low |
Raised by another reviewer: No.
5. Merge Recommendation
Conclusion: Ready to merge
No blockers found. This is well-executed, genuinely new failover coverage for CDC pipelines in the Zeta engine, built on a proven local-cluster fault-injection pattern already used elsewhere in this module, with several stability practices (retry-based node restart instead of blind sleep, ordered reconciliation queries, exception-swallowing cleanup helpers, confirmed sequential test execution) that are stronger than the precedent it extends.
- Blockers — none.
- Recommended fixes — non-blocking:
- Consider tightening
assertCheckpointIdsGrowto require growth across all tracked pipelines for the two-pipeline scenario (Issue 1).
- Consider tightening
Nice work modeling this on the existing fault-injection harness while adapting the reconciliation strategy correctly for CDC's replay semantics.
|
Follow-up on my previous review: I wrote it about three minutes into this head's ( I pulled the failed job logs ( This is not confined to the new Given this PR's own diff adds This needs to be root-caused and fixed before merge — it is a real, PR-caused break of unrelated existing coverage, not something to rerun past. I'd suggest checking whether the new test-jar dependency can be scoped more narrowly (e.g. excluding transitive relocations that collide with what this module already provides) or whether a |
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
The Zeta engine already has a generic Hazelcast fault-injection harness (ClusterFaultToleranceIT, SplitClusterFaultToleranceIT) that validates worker/master failover and all-node-down recovery, but only for plain Fake-source-to-local-file batch/streaming jobs — none of it exercises a real, stateful CDC source (binlog position, snapshot-vs-incremental phase, multi-table/multi-pipeline CDC state) under failover. This PR adds a new, self-contained MysqlCDCClusterFailoverIT that combines that existing fault-injection harness with a real MySQL CDC source and JDBC upsert sink, covering worker/master failover and all-node-down restart-from-persistent-state recovery across default and split cluster topologies, plus a two-pipeline failover scenario. It's a purely additive test-only change (new test class, new test resources/docker config, one new test-scope Maven dependency pair).
Quick correction to my own record first: I left a "Ready to merge" review on this PR yesterday (2026-08-23), then partially walked that back this morning in an issue comment once I saw the Build check had actually finished RED and pulled the real job logs — that comment correctly flagged a classpath regression but only had a hypothesis for the mechanism ("shaded/relocated class collision"). Doing the full fresh pass below, I found the precise mechanism for that one, and a second, independent, 100%-deterministic bug that my comment this morning didn't catch at all: the new test's own container never starts, on every single run. Both are addressed as formal blockers below. Sorry for the back-and-forth — consolidating everything into this one review.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path: each test method drives real SeaTunnelServerStarter.createHazelcastInstance / createMasterHazelcastInstance / createWorkerHazelcastInstance members, submits a real job through SeaTunnelClient / ClientJobExecutionEnvironment, and exercises the actual checkpoint coordinator (StateStoreCheckpointIDCounter, CounterStateStore) and job-status state machine via ClientJobProxy polling — genuine engine-level integration coverage, not mocked. The class reuses the existing local-cluster fault-injection pattern from ClusterFaultToleranceIT / SplitClusterFaultToleranceIT (custom persistent-cluster YAML with FileMapStoreFactory, matching Hazelcast tuning properties) and adapts the reconciliation strategy correctly for CDC: instead of a naive row-count compare, awaitSourceAndSinkConsistent (L1153-1196) does an ordered full-content diff (queryRows, ORDER BY id at L1320) against an upsert sink (primary_keys = ["id"]), which is the right approach for CDC's at-least-once replay semantics after failover.
Where it currently breaks: I traced the actual Build check failure (fork run 32638154468, engine-v2-it shards 8 and 11, both red the same way) all the way to root cause on two independent, unrelated bugs — both 100% reproducible, neither a flake:
Issue 1 — the new test's own MySQL container can never start.
MysqlCDCClusterFailoverIT.java:883-888
return new MySqlContainer(MySqlVersion.V8_0)
.withSetupSQL("mysql-cdc-failover/docker/setup.sql")
.withDatabaseName("emptydb")
.withUsername(ROOT_USERNAME)
.withPassword(ROOT_PASSWORD);
MySqlContainer.withDatabaseName("emptydb") sets the MYSQL_DATABASE=emptydb container env var, which the official MySQL entrypoint script uses to auto-create that database (guarded, IF NOT EXISTS-equivalent) before running any docker-entrypoint-initdb.d script. withSetupSQL then mounts setup.sql as exactly such an init script, and setup.sql:26 unconditionally does:
CREATE DATABASE emptydb;with no IF NOT EXISTS guard. I pulled the actual container log from the failed CI run and this is exactly what happens:
2026-08-24 04:50:38+00:00 [Note] [Entrypoint]: Creating database emptydb
...
2026-08-24 04:50:38+00:00 [Note] [Entrypoint]: running /docker-entrypoint-initdb.d/setup.sql
ERROR 1007 (HY000) at line 26: Can't create database 'emptydb'; database exists
The official image's entrypoint runs SQL init scripts without --force, so this single statement error aborts the whole init script and the container exits with code 1. Testcontainers' deepStart (called at @BeforeAll, L91-93) retries for the container's configured startup window and then gives up — in the CI run this burned exactly 360.97s before JUnit reported one class-level ERROR (Tests run: 1, Errors: 1 — a @BeforeAll failure aborts the whole class, none of the 8 @Test methods ever execute). This is deterministic, not environment-dependent: it will fail identically on every run, local or CI, as long as setup.sql keeps the unguarded CREATE DATABASE emptydb; next to withDatabaseName("emptydb").
The project's own established idiom for exactly this situation is CREATE DATABASE IF NOT EXISTS, used consistently in every one of the sibling connector-cdc-mysql-e2e DDL scripts (add_columns.sql, drop_columns.sql, multi_db_same_name_schema_change.sql, etc.) — this file is the one place in the CDC test suite that didn't follow that pattern.
Issue 2 — the pom.xml dependency addition breaks ~10 pre-existing, unrelated test classes module-wide.
connector-seatunnel-e2e-base/pom.xml:55-67 (new)
<dependency>
<groupId>org.apache.seatunnel</groupId>
<artifactId>connector-cdc-mysql</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.seatunnel</groupId>
<artifactId>connector-cdc-mysql</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
I checked connector-cdc-mysql's own pom.xml and found the root cause precisely: it declares connector-cdc-base as <scope>provided</scope> (its pom.xml, dependency block around the shading section). Maven's provided scope is non-transitive by design — it is never exported to a module that depends on connector-cdc-mysql normally. So connector-seatunnel-e2e-base's test classpath ends up with connector-cdc-mysql but without connector-cdc-base, and BaseChangeStreamTableSourceFactory (which lives in connector-cdc-base) is missing at runtime. I confirmed this from the actual failed-job log — it's not a compile-time issue, it surfaces at Factory-discovery time and takes down every pre-existing FakeSource-based test in the module, not just the new CDC one:
org.apache.seatunnel.api.table.factory.FactoryException: ... Unable to create a source for identifier 'FakeSource'.
Caused by: java.lang.NoClassDefFoundError: org/apache/seatunnel/connectors/cdc/base/source/BaseChangeStreamTableSourceFactory
Caused by: java.lang.ClassNotFoundException: org.apache.seatunnel.connectors.cdc.base.source.BaseChangeStreamTableSourceFactory
Affected in shard 11 alone: PendingJobsRestIT, ClusterFaultToleranceIT, RestApiIT, SeaTunnelSlotIT, SplitClusterFaultToleranceIT, SplitClusterPendingJobLifecycleFailoverIT, TextHeaderIT, SlotRatioAllocateStrategyIT, SystemLoadAllocateStrategyIT, TimerFlushIT (66 errors total) — all completely unrelated to CDC. The fix is a known, already-proven pattern in this codebase: connector-cdc-mysql-e2e/pom.xml (the existing standalone CDC e2e module) depends on both connector-cdc-base (scope test) and connector-cdc-mysql (regular + test-jar) side by side, for exactly this reason. This PR's pom.xml diff added only the latter pair and is missing the connector-cdc-base test dependency that precedent always pairs with it.
Key Findings:
- Both bugs are independent of each other — fixing one does not fix the other, and both must be fixed before this PR can pass CI or deliver working coverage.
- Once both are fixed, the actual test design (real cluster harness, ordered-content reconciliation for CDC, retry-based node restart) is sound — see 1.3/2.2 below.
1.2 Compatibility Impact
Fully compatible. Purely additive test module changes: one new test class, new test-only config/docker resources, and a test-scope Maven dependency pair. No production code, config Option, public API, or serialization/checkpoint format is touched. (The pom.xml change is test-scope only, so it does not affect seatunnel-dist packaging or runtime plugin loading.)
1.3 Performance / Side-Effect Analysis
No production-path side effects. junit-platform.properties for this module sets execution.parallel.mode.default = same_thread (and same for classes.default), so the 8 new @Test methods, and this class relative to its siblings in the module, run strictly sequentially — this rules out Hazelcast-port and MySQL server-id collision risk from 8 back-to-back cluster bootstraps sharing one MySQL container. queryRows/executeSql open a fresh DriverManager connection per call (no connection pool) inside try-with-resources — correctly closed each time, just some avoidable per-poll connection churn across up to 2-minute Awaitility windows called from ~20 call sites; not a leak, not blocking, but worth simplifying if this pattern gets reused elsewhere.
1.4 Error Handling and Logging
Every test method wraps its body in try/finally and calls closeClient/shutdownNode helpers that swallow and log.warn cleanup-only failures (so a real assertion failure isn't masked by secondary cleanup exceptions) — stronger than the precedent files' plain finally blocks. See Issues 1-3 below for the formal findings.
| Issue | Location | Problem | Risk | Best Improvement | Severity | Raised by another reviewer |
|---|---|---|---|---|---|---|
| 1 | .../src/test/resources/mysql-cdc-failover/docker/setup.sql:26 |
Unguarded CREATE DATABASE emptydb; collides with the container's own MYSQL_DATABASE=emptydb auto-create (from .withDatabaseName("emptydb") at MysqlCDCClusterFailoverIT.java:886); the MySQL entrypoint aborts init on the resulting SQL error and the container exits with code 1. |
The new test's @BeforeAll container bootstrap fails on every single run (local and CI) — none of the 8 new @Test methods ever execute. Deterministic, not a flake. |
Change line 26 to CREATE DATABASE IF NOT EXISTS emptydb; (the established idiom already used throughout connector-cdc-mysql-e2e's DDL scripts), or simply drop the redundant line since withDatabaseName already creates it. |
High | No |
| 2 | connector-seatunnel-e2e-base/pom.xml:55-67 |
New test-scope dependency on connector-cdc-mysql omits connector-cdc-base, which connector-cdc-mysql's own pom declares as provided (non-transitive) scope, so BaseChangeStreamTableSourceFactory is absent from this module's test runtime classpath. |
NoClassDefFoundError during Factory discovery breaks FakeSource job creation module-wide, failing ~10 pre-existing, unrelated test classes (confirmed via CI job logs: PendingJobsRestIT, ClusterFaultToleranceIT, RestApiIT, SeaTunnelSlotIT, SplitClusterFaultToleranceIT, SplitClusterPendingJobLifecycleFailoverIT, TextHeaderIT, SlotRatioAllocateStrategyIT, SystemLoadAllocateStrategyIT, TimerFlushIT). This is the cause of the current Build check failure. |
Add connector-cdc-base (scope test) alongside the existing connector-cdc-mysql entries, mirroring the proven pattern already used in connector-cdc-mysql-e2e/pom.xml. |
High | Yes — this is a follow-up/refinement of my own 2026-08-24 issue comment, which correctly identified the symptom and blamed the new dependency but only guessed at "shaded/relocated class collision" as the mechanism; the actual mechanism is the provided-scope non-transitivity above, confirmed against both poms. |
| 3 | MysqlCDCClusterFailoverIT.java:1153-1196 (awaitSourceAndSinkConsistent, both overloads) |
Awaitility.await()...untilAsserted(...) is used without .ignoreExceptions(), while queryRows (L1319-1336) wraps any SQLException in a RuntimeException. Awaitility's default untilAsserted only retries on AssertionError, not arbitrary RuntimeException — so a transient SQL exception from either query would abort the poll immediately instead of retrying. |
Low-probability but real: MYSQL_CONTAINER itself is never restarted during these tests (only the Zeta cluster nodes are), so this needs an actual transient JDBC blip (connection reset/refusal under CI resource pressure) to manifest — but if it does, the test hard-fails instead of retrying, which is exactly the anti-pattern startNodeWithRetry (same file, L1439-1449) correctly avoids by using .ignoreExceptions(). |
Add .ignoreExceptions() to both awaitSourceAndSinkConsistent overloads for consistency with startNodeWithRetry's pattern in the same file. |
Medium | No |
2. Code Quality Assessment
2.1 Coding Standards
Comprehensive Javadoc on every new public/private method (confirmed by spot-checking assertCheckpointIdsGrow, queryRows, awaitSourceAndSinkConsistent, checkpointCounterStore, etc.), matching the project's requirement for non-trivial methods. New file has the required ASF license header. Formatting is consistent with the rest of the module.
2.2 Test Coverage and Test Stability
This closes a real coverage gap (CDC-specific failover, not covered by the generic Fake-source harness) — once Issues 1 and 2 are fixed. Applying the mandatory flaky-test checklist to the test logic itself:
- No
Thread.sleepanywhere in the file; all waits are boundedAwaitilitypolling (1-3 minute bounds, reasonable givencheckpoint.interval = 3000in the new templates). queryRowsuses a deterministicORDER BY id(L1320), correctly avoiding un-ordered-SELECTfragility for the source/sink content comparison.- No shared mutable state across test methods beyond the class-level
MYSQL_CONTAINER; every test uses its own uniquely-suffixed databases/tables and its own uniquely-suffixed cluster name, so tests are not order-dependent on each other. - Confirmed sequential (not parallel) execution at the
junit-platform.propertieslevel. startNodeWithRetry(L1439-1449) correctly uses.ignoreExceptions(), showing the author understands Awaitility's actual retry semantics — which makes the inconsistency inawaitSourceAndSinkConsistent(Issue 3) more of a one-off oversight than a systemic misunderstanding.
Overall test-stability rating: Risk present. This is not "Stable": Issue 3 is a genuine, source-confirmed gap in retry semantics on the file's highest-frequency assertion helper (~20 call sites across all 8 tests), even though the probability of it firing in practice is bounded by MYSQL_CONTAINER never being restarted mid-test. It's also not "High risk" — there's no Thread.sleep, no shared/order-dependent state, and the primary demonstrated CI failure (Issues 1 and 2) is a deterministic bug, not flakiness. I'd revise this down from the "Stable" rating I gave in my review yesterday; that review was written while Build was still mid-run and didn't have the actual failure evidence in front of it yet.
One additional low-severity precision nitpick, carried over from my own prior review (not re-numbered as new): assertCheckpointIdsGrow (L1275-1298) only requires that at least one tracked pipeline's checkpoint id advances after failover for the two-pipeline scenario — the method's own Javadoc documents this as intentional ("Verifies that at least one previously observed pipeline checkpoint id grows..."). This is compensated end-to-end by the subsequent awaitSourceAndSinkConsistent(TwoTableBinding) call, which independently verifies both pipelines' data converges, so a genuinely stuck second pipeline would still fail the test via data reconciliation. Tightening it to require growth across all tracked pipelines would fail faster and closer to the root cause, but this is a non-blocking nicety, not a coverage gap.
2.3 Documentation Updates
Not required — internal E2E test coverage only, no user-facing behavior or config semantics changed.
3. Architectural Soundness
3.1 Elegance of the Solution
Good reuse of the existing local-cluster fault-injection harness pattern instead of inventing a new one, correctly adapting the reconciliation strategy (ordered content diff + upsert sink) to CDC's at-least-once replay semantics rather than reusing the file-line-count strategy the precedent files use for Fake-source jobs. The two blockers found here are integration-boundary mistakes (a Maven dependency-scope gap, a Testcontainers/init-script name collision), not design flaws in the core test approach — this is a precise fix away, not a rework.
3.2 Maintainability
TableBinding/TwoTableBinding value objects and the NodeStarter functional interface keep the eight scenario methods readable and DRY — shared setup/teardown/assert logic is properly factored into private helpers rather than duplicated per test.
3.3 Extensibility
The helper set (awaitCheckpointIds, assertCheckpointIdsGrow, awaitSourceAndSinkConsistent, startNodeWithRetry) is generic enough to support adding further CDC failover scenarios (other connectors' CDC sources) with minimal new code, once the current blockers are cleared.
3.4 Historical-Version Compatibility
N/A — test-only addition, no checkpoint/savepoint format, serialization, or upgrade-path impact.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | setup.sql's unguarded CREATE DATABASE emptydb; collides with the container's own MYSQL_DATABASE auto-create, aborting container startup on every run |
mysql-cdc-failover/docker/setup.sql:26 |
High |
| 2 | pom.xml adds connector-cdc-mysql without the connector-cdc-base test dependency it needs (provided-scope, non-transitive in the mysql module), breaking ~10 unrelated pre-existing tests module-wide |
connector-seatunnel-e2e-base/pom.xml:55-67 |
High |
| 3 | awaitSourceAndSinkConsistent's untilAsserted doesn't ignore the RuntimeException-wrapped SQLException that queryRows can throw, unlike startNodeWithRetry elsewhere in the same file |
MysqlCDCClusterFailoverIT.java:1153-1196 |
Medium |
| 4 | assertCheckpointIdsGrow only requires one of N tracked pipelines to advance (documented/intentional, compensated by data reconciliation) |
MysqlCDCClusterFailoverIT.java:1275-1298 |
Low |
5. Merge Recommendation
Conclusion: Not recommended for merge
This confirms and extends what my issue comment said this morning — I'm not just deferring to that comment, I independently re-traced both the CI logs and the pom/testutils source in this pass and found a second, fully independent blocker (Issue 1) that the comment didn't catch. Both High-severity issues are deterministic and source-confirmed, not flakiness, and both must be fixed for this PR to deliver working, mergeable coverage.
- Blockers — must be fixed:
- Issue 1 (High): guard or remove the redundant
CREATE DATABASE emptydb;insetup.sqlso the new test's own MySQL container can actually start. - Issue 2 (High): add the missing
connector-cdc-basetest-scope dependency toconnector-seatunnel-e2e-base/pom.xmlso the module's Factory discovery stops breaking ~10 unrelated pre-existing tests.
- Issue 1 (High): guard or remove the redundant
- Recommended fixes — non-blocking:
- Issue 3 (Medium): add
.ignoreExceptions()toawaitSourceAndSinkConsistent's Awaitility polls for consistency withstartNodeWithRetry's correct pattern elsewhere in the same file. - Issue 4 (Low): optionally tighten
assertCheckpointIdsGrowto require growth across all tracked pipelines in the two-pipeline scenario, for a faster/closer-to-root-cause failure signal (not a real coverage gap today).
- Issue 3 (Medium): add
No alternative implementation approach is needed here — the core design (real local-cluster fault injection + real CDC source + ordered-content reconciliation against an upsert sink) is the right one and doesn't need rethinking. Once Issues 1 and 2 are fixed and a green Build run confirms it, this closes a real and previously-missing gap in the Zeta engine's failover test coverage. Happy to take another pass as soon as an updated commit is pushed.
…verIT setup
createMySqlContainer() calls withDatabaseName("emptydb"), which sets the
MYSQL_DATABASE environment variable; testcontainers' mysql image entrypoint
auto-creates that database during initialization, before any script under
docker-entrypoint-initdb.d/ (including this suite's mounted setup.sql) runs.
setup.sql also ran 'CREATE DATABASE emptydb;', so MySQL failed with
'ERROR 1007: Can't create database emptydb; database exists' and the
container exited with code 1. Testcontainers retried container startup
for the full 2-minute budget and then failed, which cascaded into every
test in MysqlCDCClusterFailoverIT erroring out after ~6 minutes (this
suite's own container-start retries), and in CI runs where this class
happened to execute mid-suite, into every subsequent engine-v2-it test
class in the same JVM also failing on unrelated symptoms (OOM, dangling
Docker resources) once the module's shared resources were exhausted.
The dynamically-scoped source/sink databases each test actually exercises
are created separately at runtime via executeSql("CREATE DATABASE ...")
(see MysqlCDCClusterFailoverIT.createDatabaseAndTables); 'emptydb' is only
ever used as the container's initial connection catalog and is never
read from or written to by test logic, so removing the redundant CREATE
DATABASE statement changes no test behavior.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
The Zeta engine's generic Hazelcast fault-injection harness (ClusterFaultToleranceIT, SplitClusterFaultToleranceIT) validates worker/master failover only for plain Fake-source-to-local-file batch/streaming jobs — none of it exercises a real, stateful CDC source (binlog position, snapshot-vs-incremental phase, multi-table/multi-pipeline CDC state) under failover. This PR adds a new, self-contained MysqlCDCClusterFailoverIT combining that harness with a real MySQL CDC source and JDBC upsert sink, covering worker/master failover and all-node-down restart-from-persistent-state recovery across default and split cluster topologies, plus a two-pipeline scenario.
Re-review at the new head 82a0eeb34c6a, one real commit since my last full review (2026-08-24, head d6e24425b582): "[Fix][E2E] Remove duplicate database creation in MysqlCDCClusterFailoverIT setup" (2026-09-08). My last review found two independent High-severity blockers, both 100%-deterministic and CI-confirmed. I re-verified both directly against the current head's actual source and, critically, against a fresh CI run on this exact head rather than reusing the old result.
0. Disposition of Prior Blockers
Issue 1 (High, setup.sql's unguarded CREATE DATABASE emptydb; colliding with the container's own MYSQL_DATABASE auto-create) — FIXED, and independently confirmed working by live CI evidence, not just by reading the diff. The new commit removes the offending line and replaces it with a comment explaining exactly the mechanism I diagnosed last round (container auto-creates emptydb via withDatabaseName, the redundant CREATE DATABASE then collides and aborts init). I didn't stop at reading the diff: I pulled the actual fork CI log for this exact head (run 34185391429, job engine-v2-it (11, ubuntu-latest)) and confirmed the fix works in practice — MysqlCDCClusterFailoverIT now reports Tests run: 12 (up from 1 class-level @BeforeAll error and 0 executed test methods before the fix). The container-start blocker is genuinely gone.
Issue 2 (High, pom.xml's connector-cdc-mysql test dependency missing the connector-cdc-base companion, breaking BaseChangeStreamTableSourceFactory classpath resolution module-wide) — STILL OPEN, and now confirmed to also break the PR's own new test, not just the ~10 pre-existing ones. I checked the current connector-seatunnel-e2e-base/pom.xml at this head directly: it still declares only the connector-cdc-mysql pair (regular + test-jar), with no connector-cdc-base entry anywhere in the file. I re-verified the root cause still holds against current dev's connector-cdc-mysql/pom.xml (connector-cdc-base is <scope>provided</scope>, non-transitive). Then I checked the live CI run on this exact head rather than assuming the diagnosis still applies unchanged:
MysqlCDCClusterFailoverITitself now runs but all 12 of its own test methods error out:Tests run: 12, Failures: 0, Errors: 12, every single one withFactoryException: Unable to create a source for identifier 'MySQL-CDC'caused byNoClassDefFoundError: org/apache/seatunnel/connectors/cdc/base/source/BaseChangeStreamTableSourceFactory. This is a new, stronger piece of evidence than my last round had (last time the class never got past@BeforeAll, so I couldn't yet observe whether the tests themselves would also hit this classpath gap — now that Issue 1 is fixed, they do, immediately and 100% of the time).- The same
NoClassDefFoundErrorstill takes down the previously-identified unrelated classes in this run —SplitClusterFaultToleranceIT,ClusterFaultToleranceIT,RealtimeMetricsRestIT,SplitClusterPendingJobLifecycleFailoverITall confirmed still failing with the identical stack trace at this exact head. - Module-wide total for this job:
Tests run: 179, Failures: 0, Errors: 77— essentially unchanged in shape from what I documented last round.
Net effect: this PR currently delivers zero working CDC failover coverage. The one bug that was fixed (Issue 1) only got the suite as far as proving the other bug (Issue 2) also breaks the new test's own 12 scenarios, on top of continuing to break ~10 unrelated pre-existing tests. This is not a new finding on my part — it's the exact same root cause I diagnosed last round, now demonstrated against fresh evidence on the current head instead of carried forward on trust.
Issue 3 (Medium, awaitSourceAndSinkConsistent missing .ignoreExceptions()) and Issue 4 (Low, assertCheckpointIdsGrow single-pipeline check) — unchanged, not addressed by the one commit that landed (which touched only setup.sql). Both remain exactly as described in my last round; I re-read the relevant methods at the current head and confirmed no change.
1-3. Code Change Review / Quality / Architecture
Unchanged in substance from my last full review — the core test design (real local-cluster fault injection + real CDC source + ordered-content reconciliation against an upsert sink, TableBinding/TwoTableBinding value objects, NodeStarter functional interface) remains sound and is not what's blocking this PR; see that review for the full line-level trace. I'm not re-deriving it here since nothing in that part of the diff moved.
4. Issue Summary
| # | Issue | Location | Severity | Status |
|---|---|---|---|---|
| 1 | setup.sql's unguarded CREATE DATABASE emptydb; collided with the container's own auto-create, aborting container startup on every run |
mysql-cdc-failover/docker/setup.sql:26 |
High | Fixed, verified against live CI (container now starts, 12/12 tests execute) |
| 2 | pom.xml adds connector-cdc-mysql without the connector-cdc-base test dependency it needs (provided-scope, non-transitive), breaking BaseChangeStreamTableSourceFactory resolution module-wide |
connector-seatunnel-e2e-base/pom.xml:55-67 |
High | Still open — confirmed via fresh CI on this exact head: now also breaks all 12 of this PR's own new tests, plus the same ~4+ previously-identified unrelated classes |
| 3 | awaitSourceAndSinkConsistent's untilAsserted doesn't ignore the RuntimeException-wrapped SQLException that queryRows can throw |
MysqlCDCClusterFailoverIT.java:1153-1196 |
Medium | Still open |
| 4 | assertCheckpointIdsGrow only requires one of N tracked pipelines to advance (documented/intentional, compensated by data reconciliation) |
MysqlCDCClusterFailoverIT.java:1275-1298 |
Low | Still open |
5. Merge Recommendation
Conclusion: Not recommended for merge
-
Blockers — must be fixed
- Issue 2 (High): add the missing
connector-cdc-basetest-scope dependency toconnector-seatunnel-e2e-base/pom.xml, mirroring the proven pattern inconnector-cdc-mysql-e2e/pom.xml(which depends on bothconnector-cdc-baseandconnector-cdc-mysqlside by side). This is the sole remaining blocker for CI to actually pass, and fresh evidence from this exact head's CI run shows it now also fully defeats the new test's own 12 scenarios, not just the previously-identified unrelated ones.
- Issue 2 (High): add the missing
-
Recommended fixes — non-blocking
- Issue 3 (Medium): add
.ignoreExceptions()toawaitSourceAndSinkConsistent's Awaitility polls, for consistency with the correct pattern already used bystartNodeWithRetryin the same file. - Issue 4 (Low): optionally tighten
assertCheckpointIdsGrowto require growth across all tracked pipelines in the two-pipeline scenario.
- Issue 3 (Medium): add
Overall assessment. Genuine, verified progress this round on Issue 1 — not just a plausible-looking diff, but confirmed against live CI on this exact head that the container now starts and all 12 new test methods actually execute. That progress is what let a fresh CI run surface, for the first time, direct proof that Issue 2 also completely breaks this PR's own new coverage (not only the previously-known unrelated tests) — so the practical urgency of fixing Issue 2 is higher than my last round could demonstrate, even though the root cause and the fix are unchanged from what I identified then. This is a one-line pom.xml addition, not a design problem — the test design itself remains sound and doesn't need rework. Once Issue 2 lands and a fresh CI run confirms green (or at least confirms MysqlCDCClusterFailoverIT's own 12 tests pass and the previously-affected unrelated classes are clean again), this closes a real and previously-missing gap in the Zeta engine's failover test coverage.
…nel-e2e-base This module's test-scope dependency on connector-cdc-mysql does not transitively pull in connector-cdc-base, because connector-cdc-mysql declares that dependency as provided and Maven excludes provided-scope dependencies from transitive resolution. Classes connector-cdc-mysql expects on its own runtime classpath, such as BaseChangeStreamTableSourceFactory, were therefore absent from this module's test classpath, and CDC e2e tests here failed with NoClassDefFoundError (observed in engine-v2-it, e.g. RealtimeMetricsRestIT). Adds an explicit test-scope dependency on connector-cdc-base so it is available wherever connector-cdc-mysql is used in tests here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
The Zeta engine's generic Hazelcast fault-injection harness (ClusterFaultToleranceIT, SplitClusterFaultToleranceIT) validates worker/master failover and all-node-down restart-from-persistent-state recovery only for plain Fake-source-to-local-file batch/streaming jobs — none of it exercises a real, stateful CDC source (binlog position, snapshot-vs-incremental phase, multi-table/multi-pipeline CDC state) under failover. This PR adds a new, self-contained MysqlCDCClusterFailoverIT combining that harness with a real MySQL CDC source and JDBC upsert sink, covering worker/master failover and all-node-down recovery across default and split cluster topologies, plus a two-pipeline scenario.
Re-review at the new head 67c8f3c889, one real commit since my last full review (2026-09-10, head 82a0eeb34c6a). My last review had exactly one remaining High-severity blocker (Issue 2 below) after confirming the first blocker fixed via live CI evidence. This round's commit is "[Fix][E2E] Add connector-cdc-base test dependency to connector-seatunnel-e2e-base" — precisely that fix. I re-read the entire diff against dev from scratch (not just this one-commit delta) and re-verified the whole test file, not only the file this commit touches.
- Simple example of what this closes. Before this PR: kill the active master mid-stream on a plain Fake-source job and the generic harness proves the job recovers and keeps emitting. There was no equivalent proof for a MySQL CDC source — e.g., does the binlog position survive a master failover and all-node-down restart without duplicating or dropping rows relative to what MySQL actually wrote? This test answers that directly, with an ordered full-row diff against the sink.
0. Disposition of Prior Blockers
Issue 1 (High, setup.sql's unguarded CREATE DATABASE emptydb; colliding with the container's own MYSQL_DATABASE auto-create) — FIXED, previously confirmed via live CI, unchanged since. git diff 82a0eeb34c6a..67c8f3c889 -- '**/setup.sql' is empty — this round's commit doesn't touch it, and I already independently verified this fix against a live CI run on the exact head that introduced it (fork run 34185391429, MysqlCDCClusterFailoverIT executing all 12 test methods instead of erroring at @BeforeAll). Nothing to re-litigate.
Issue 2 (High, pom.xml's connector-cdc-mysql test dependency missing the connector-cdc-base companion) — FIXED at the source level this round; CI on this exact head has not finished yet.
<!-- seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/pom.xml -->
<dependency>
<groupId>org.apache.seatunnel</groupId>
<artifactId>connector-cdc-base</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>I checked this against the exact precedent I cited last round: connector-cdc-mysql-e2e/pom.xml declares connector-cdc-base (scope test) immediately before connector-cdc-mysql (regular + test-jar) — the new dependency block here matches that pattern dependency-for-dependency (same groupId/artifactId/version property/scope), and the commit's own inline XML comment correctly restates the provided-scope non-transitivity root cause I diagnosed two rounds ago. This is the right fix, in the right place, mirroring a proven working pattern — I have no source-level objection to it.
What I can't yet confirm: a fresh green run on this exact head. I checked the fork CI directly rather than trusting the apache-side pointer: DanielLeens/seatunnel run 34726727821 for head 67c8f3c889 is status: queued, conclusion: null — it had not started at the time of this review. I'm reporting that honestly rather than assuming the fix works because the diff looks right; the previous round's Issue 1 fix taught the same lesson (a plausible-looking diff still needed live-CI confirmation before I'd call it closed). I did not wait for or poll this run further.
Issue 3 (Medium, awaitSourceAndSinkConsistent missing .ignoreExceptions()) and Issue 4 (Low, assertCheckpointIdsGrow single-pipeline check) — unchanged, not addressed by this round's commit (which touched only pom.xml). I re-read both methods at the current head directly rather than assuming they're unchanged from the diff-stat: git diff 82a0eeb34c6a..67c8f3c889 --stat touches only pom.xml (13 lines), so MysqlCDCClusterFailoverIT.java is byte-identical to what I already fully traced. Confirmed still present, unchanged.
1. Code Change Review
1.1 Core Logic Analysis
Unchanged in substance from my earlier full-detail review — the core test design (real local-cluster fault injection via genuine SeaTunnelServerStarter members, a real submitted job through SeaTunnelClient, actual checkpoint-coordinator state via StateStoreCheckpointIDCounter/CounterStateStore, and CDC-appropriate ordered-content reconciliation against an upsert sink rather than a naive row-count compare) remains sound. I'm not re-deriving the full line-level trace here since nothing in that part of the diff moved across either of the last two rounds; see my 2026-08-24 full review for it.
1.2 Compatibility Impact
Fully compatible. Purely additive test-only changes across all three commits so far: one new test class, new test-only docker/config resources, and now two test-scope Maven dependencies. No production code, config Option, public API, or checkpoint/serialization format touched. The pom.xml change is test-scope only, so it has no effect on seatunnel-dist packaging or runtime plugin/connector loading — I checked the <scope> tag directly rather than assuming scope from the dependency's purpose.
1.3 Performance / Side-Effect Analysis
No production-path effects — test-only module. Sequential execution is still enforced by this module's junit-platform.properties (junit.jupiter.execution.parallel.mode.default = same_thread, classes.default = same_thread, unchanged file, not part of this PR's diff), which rules out port/server-id collisions across this class's 8 back-to-back cluster bootstraps and rules out cross-class interference with the other engine-v2-it classes now correctly restored to the module's test classpath.
1.4 Error Handling and Logging
Unchanged from the prior full review: every test method wraps its body in try/finally with cleanup helpers that swallow-and-log.warn teardown failures so a real assertion isn't masked by secondary cleanup exceptions. See Issue 3 in Section 2.2 for the one open gap (already known, not new this round).
2. Code Quality Assessment
2.1 Coding Standards
Unchanged — ASF license header present, comprehensive Javadoc on new public/private methods, formatting consistent with the module. The new pom.xml dependency carries an inline XML comment explaining exactly why it's needed and citing the specific class (BaseChangeStreamTableSourceFactory) and failure mode it fixes — good practice for a future maintainer who might otherwise "clean up" what looks like a duplicate-looking dependency.
2.2 Test Coverage and Test Stability — explicit flaky-test rating, re-derived from a fresh read of the current head
I re-walked the entire 1529-line test file again this round (not relying on my previous pass) specifically hunting for the flaky-test checklist items, given this is a cluster-failover scenario:
- No
Thread.sleepanywhere in the file — confirmed via a direct grep of the current head; every wait is a boundedAwaitility.await()poll (1-3 minute bounds —MysqlCDCClusterFailoverIT.java:1155,1175,1206,1221,1244,1280,1442). - Container-readiness signal:
MYSQL_CONTAINERstartup is handled by Testcontainers' owndeepStart/wait-strategy machinery at@BeforeAll(MysqlCDCClusterFailoverIT.java:92-96), not a custom sleep-based probe — this is the correct, non-flaky approach, and it's the same container instance reused (not restarted) across all 8 test methods. - Order dependency: none found. Every test method builds its own uniquely-suffixed cluster name (
TestUtils.getClusterName(testCaseName + "_" + System.currentTimeMillis()), e.g.MysqlCDCClusterFailoverIT.java:235,298,369,444,554,618,698,772) and its own uniquely-named source/sink databases and tables (viacreateDatabaseAndTables), so no test's data or cluster identity can collide with another's, and combined with the module's forcedsame_threadsequential execution, there's no realistic interleaving hazard. - Shared mutable state: only the class-level
MYSQL_CONTAINER(a Testcontainers instance, expected to be shared) — no shared mutable test-state fields beyond that; each test's checkpoint/row-comparison state is method-local. .ignoreExceptions()usage is inconsistent within the same file — this is Issue 3, and it's the one real gap:startNodeWithRetry(MysqlCDCClusterFailoverIT.java:1439-1454) correctly uses.ignoreExceptions()when polling for a node restart to succeed, butawaitSourceAndSinkConsistent's two overloads (MysqlCDCClusterFailoverIT.java:1153-1166and:1173-1196) — the file's highest-frequency assertion helper, called from all 8 test methods — use plainuntilAsserted(...)without.ignoreExceptions().queryRows(MysqlCDCClusterFailoverIT.java:1319-1336) wraps anySQLExceptionin aRuntimeException, and Awaitility's defaultuntilAssertedonly retries onAssertionError, not arbitraryRuntimeException— so one transient JDBC blip (connection reset/refused under CI resource pressure) during the up-to-2-minute reconciliation poll aborts the test immediately instead of retrying.MYSQL_CONTAINERitself is never restarted mid-test (only the Zeta cluster nodes are), which bounds how often this can actually fire, but it's a real, source-confirmed gap, not a hypothetical one.
Explicit stability rating: Risk present. Not "Stable" — Issue 3 is a genuine, reachable gap in retry semantics on the file's busiest assertion path. Not "High risk" — there's no Thread.sleep, no order dependency, no unguarded shared mutable state, and the container/cluster lifecycle management is done correctly throughout. This rating is unchanged from my last full-detail pass, which I'm treating as re-confirmed rather than assumed, since I re-read the actual file content at this round's head end to end rather than trusting the diff-stat alone.
One additional non-blocking precision note, carried over unchanged: assertCheckpointIdsGrow (MysqlCDCClusterFailoverIT.java:1275-1298) only requires that at least one tracked pipeline's checkpoint id advance after failover in the two-pipeline scenario (documented as intentional in its own Javadoc). This is compensated end-to-end by the subsequent awaitSourceAndSinkConsistent(TwoTableBinding) call, which independently verifies both pipelines' data converges — so a genuinely stuck second pipeline would still fail the test via data reconciliation, just with a less specific failure signal.
2.3 Documentation Updates
Not required — internal E2E test coverage only, no user-facing behavior or config semantics changed.
3. Architectural Soundness
3.1 Elegance of the Solution
Good reuse of the existing local-cluster fault-injection harness instead of inventing a new one, with the reconciliation strategy correctly adapted for CDC (ordered content diff against an upsert sink) rather than reusing the file-line-count approach from the Fake-source precedent files. Both blockers found across this PR's rounds were integration-boundary mistakes (a Testcontainers/init-script name collision, a Maven dependency-scope gap), not design flaws in the test approach itself.
3.2 Maintainability
TableBinding/TwoTableBinding value objects and the NodeStarter functional interface keep the eight scenario methods readable and DRY. The new pom.xml comment is a good maintainability addition on its own.
3.3 Extensibility
The helper set (awaitCheckpointIds, assertCheckpointIdsGrow, awaitSourceAndSinkConsistent, startNodeWithRetry) generalizes well to future CDC-source failover scenarios beyond MySQL, once Issue 3 is addressed so the pattern being copied forward is the correct one.
3.4 Historical-Version Compatibility
N/A — test-only addition, no checkpoint/savepoint format, serialization, or upgrade-path impact.
4. Issue Summary
| # | Issue | Location | Severity | Status |
|---|---|---|---|---|
| 1 | setup.sql's unguarded CREATE DATABASE emptydb; collided with the container's own auto-create, aborting container startup on every run |
mysql-cdc-failover/docker/setup.sql |
High | Fixed, previously confirmed via live CI |
| 2 | pom.xml added connector-cdc-mysql without the connector-cdc-base test dependency it needs (provided-scope, non-transitive), breaking BaseChangeStreamTableSourceFactory resolution module-wide |
connector-seatunnel-e2e-base/pom.xml |
High | Fixed this round at the source level, mirrors the proven connector-cdc-mysql-e2e/pom.xml pattern exactly; CI on this exact head (67c8f3c889) is still queued, not yet confirming |
| 3 | awaitSourceAndSinkConsistent's untilAsserted doesn't ignore the RuntimeException-wrapped SQLException that queryRows can throw |
MysqlCDCClusterFailoverIT.java:1153-1196 |
Medium | Still open |
| 4 | assertCheckpointIdsGrow only requires one of N tracked pipelines to advance (documented/intentional, compensated by data reconciliation) |
MysqlCDCClusterFailoverIT.java:1275-1298 |
Low | Still open |
5. Merge Recommendation
Conclusion: Ready to merge after CI confirms
- Blockers — must be fixed: none remaining at the source level. Both prior High-severity blockers are fixed; I'm withholding a plain "Ready to merge" only because this exact head's CI run (
DanielLeens/seatunnelrun34726727821) was stillqueuedat review time and I want an actual green run — not just a correct-looking diff — before calling this fully closed, consistent with how Issue 1 was handled last round (fixed in the diff, then separately confirmed against real CI evidence). - Recommended fixes — non-blocking:
- Issue 3 (Medium): add
.ignoreExceptions()to bothawaitSourceAndSinkConsistentoverloads, for consistency withstartNodeWithRetry's correct pattern in the same file. - Issue 4 (Low): optionally tighten
assertCheckpointIdsGrowto require growth across all tracked pipelines in the two-pipeline scenario.
- Issue 3 (Medium): add
Divergence note: this head is ahead_by=4, behind_by=201 relative to dev — a large gap, though this PR only touches files it owns plus one shared pom.xml it's adding a dependency to, so I don't have evidence of an actual conflict (mergeStateStatus was UNKNOWN at check time, not CONFLICTING). Worth a dev sync before merge as routine hygiene given the size of the gap, but I have no specific evidence of a functional problem from it.
Overall assessment. Both High-severity blockers from earlier rounds are now addressed at the source level, and Issue 2's fix is a precise, well-commented mirror of an already-proven dependency pattern elsewhere in the same module family — I have no source-level concern with it. The explicit flaky-test stability rating for this failover-scenario test file is Risk present (not Stable, not High risk): no sleeps, no order dependencies, no unguarded shared state, correct container/cluster lifecycle handling, but one real, reachable retry-semantics gap (Issue 3) on the file's busiest assertion helper. I'd like to see this exact head's CI run finish green before treating this as unconditionally mergeable, purely as a process matter — there is no outstanding source-level objection.
… after an all-node-down restart
testMysqlCdcStreamJobRestoreInAllNodeDown and
testMysqlCdcTwoPipelineStreamJobRestoreInAllNodeDown fail after ~34s
with SeaTunnelEngineRetryableException("Can not get coordinator service
from an active master node"), well inside awaitJobStatus's 3-minute
budget. Right after an all-node-down restart, the new master's
coordinator service is not immediately available, so
ClientJobProxy#getJobStatus() can legitimately throw that exception for
a few seconds while the cluster reforms. Awaitility's untilAsserted()
only retries on a failed assertion by default; without
ignoreExceptions() that transient exception aborts the wait on its
first occurrence instead of retrying, exactly the same class of problem
startNodeWithRetry (in this same file) already guards against with its
own ignoreExceptions() during the identical restart window.
Adds ignoreExceptions() to awaitJobStatus. This does not weaken the
check: it still requires clientJobProxy.getJobStatus() to equal
expectedStatus within the same 3-minute budget; it only lets the poll
survive a transient infrastructure exception instead of failing on the
first one. awaitJobStatus is called from every test in this file, not
only the two failing ones, but getJobStatus() cannot throw during a
stable, already-formed cluster, so this is a no-op for every other call
site and a correctness fix only for the two that poll immediately after
a full cluster restart.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
The Zeta engine's generic Hazelcast fault-injection harness (ClusterFaultToleranceIT, SplitClusterFaultToleranceIT) validates worker/master failover and all-node-down restart-from-persistent-state recovery only for plain Fake-source-to-local-file batch/streaming jobs — none of it exercises a real, stateful CDC source (binlog position, snapshot-vs-incremental phase, multi-table/multi-pipeline CDC state) under failover. This PR adds a new, self-contained MysqlCDCClusterFailoverIT combining that harness with a real MySQL CDC source and JDBC upsert sink, covering worker/master failover and all-node-down recovery across default and split cluster topologies, plus a two-pipeline scenario.
Re-review at the new head c8660753cd, one real commit since my last full review (2026-09-13 00:51 UTC, head 67c8f3c889). I re-read the entire diff against dev from scratch and re-walked the full 1539-line test file end to end, not just the delta this commit touches.
Simple example of what this closes. Kill the active master mid-stream on a plain Fake-source job and the generic harness proves the job recovers and keeps emitting. There was no equivalent proof for a MySQL CDC source — e.g. does the binlog position survive a master failover and an all-node-down restart without duplicating or dropping rows relative to what MySQL actually wrote? This suite answers that directly, with an ordered full-row diff against the sink.
0. Disposition of Prior Blockers, and a Miss on My Part
Issue 1 (High, setup.sql's unguarded CREATE DATABASE emptydb;) — still fixed, unchanged this round. git diff 67c8f3c889..c8660753cd -- '**/setup.sql' is empty; I re-fetched the file at the current head directly and it still carries the guard comment and no re-added CREATE DATABASE emptydb;. Already confirmed via live CI in an earlier round, nothing new to check.
Issue 2 (High, pom.xml missing the connector-cdc-base test dependency) — still fixed at the source level, and now CI-confirmed. I re-fetched pom.xml at the current head: the connector-cdc-base dependency block (with its explanatory comment) is still present, immediately before connector-cdc-mysql, unchanged since the fix commit. Last round I was withholding a clean "ready to merge" only because the fork run for that exact head (67c8f3c889) hadn't finished; I did not re-poll that older run further since this round's new commit supersedes it with a fresh run, addressed below under CI.
This round's actual commit — "Ignore transient exceptions while polling job status after an all-node-down restart" — fixes a real gap I should have caught myself two rounds ago, not something newly introduced. It adds .ignoreExceptions() to awaitJobStatus (MysqlCDCClusterFailoverIT.java:1228-1237), which is called from every one of this file's 8 test methods (24 call sites total) to poll ClientJobProxy#getJobStatus() for RUNNING/CANCELED immediately after node restarts and all-node-down recovery. Right after such a restart, getJobStatus() can legitimately throw SeaTunnelEngineRetryableException("Can not get coordinator service from an active master node") for a few seconds while the new master's coordinator service comes up (confirmed this message is real and thrown from CoordinatorService.java in the engine-server module, not fabricated for the commit message). Awaitility's untilAsserted only retries on AssertionError by default, not arbitrary exceptions, so without .ignoreExceptions() this aborts the wait on the very first occurrence instead of retrying within the 3-minute budget — exactly the anti-pattern startNodeWithRetry (same file, L1449-1465) already guards against, and exactly the anti-pattern I flagged as Issue 3 against awaitSourceAndSinkConsistent back in my 2026-08-24 review.
Sorry for missing this in the earlier rounds — that's on me. I explicitly praised startNodeWithRetry's .ignoreExceptions() usage in round 1 and flagged the identical gap in awaitSourceAndSinkConsistent as Issue 3 in round 2, but never generalized that same flaky-test check to awaitJobStatus even though it is the file's single most-called helper and the one that runs immediately after every all-node-down restart — arguably the single likeliest call site for exactly this race. This was caught by a real CI failure (testMysqlCdcStreamJobRestoreInAllNodeDown / testMysqlCdcTwoPipelineStreamJobRestoreInAllNodeDown failing ~34s in, well inside the 3-minute budget) rather than by my review. I'm marking it as a carryover I should have caught, not a new-version discovery, and confirming the fix now: .ignoreExceptions() only swallows Exception, not AssertionError, so Assertions.assertEquals(expectedStatus, clientJobProxy.getJobStatus()) still fails the poll (and eventually the test, if the status is genuinely wrong) — this does not weaken the check, it only lets the poll survive the transient infrastructure exception, identical in effect to the already-approved startNodeWithRetry pattern. I have no source-level objection to this fix.
One secondary, non-blocking observation on this same change: because ignoreExceptions() now retries silently for up to 3 minutes on any exception from getJobStatus(), a genuinely non-transient failure (e.g. a real serialization or RPC bug that throws on every poll, not just during cluster reformation) would take the full 3-minute budget to surface instead of failing fast, and depending on Awaitility's exact timeout-message content the very last swallowed exception may or may not be as prominent as an immediate stack trace would have been. This is the same tradeoff startNodeWithRetry already accepted and I already endorsed it there, so I'm not raising it as a new issue, just noting it for the record since it now applies more broadly (every test's every restart, not just node restart).
Issue 3 (Medium, awaitSourceAndSinkConsistent missing .ignoreExceptions()) — still open, not touched by this round's commit. git diff 67c8f3c889..c8660753cd --stat only shows MysqlCDCClusterFailoverIT.java with +10 -0, entirely inside awaitJobStatus's Javadoc/body (lines 1216-1232). I re-fetched the current file and confirmed awaitSourceAndSinkConsistent's two overloads (MysqlCDCClusterFailoverIT.java:1153-1166 and :1173-1196) are byte-identical to what I traced two rounds ago: still plain untilAsserted(...) with no .ignoreExceptions(), while queryRows (:1329-1341) still wraps any SQLException in a RuntimeException that this poll won't retry on. Given that this round's own fix commit independently proves the identical class of bug (a bare untilAsserted aborting on a transient non-assertion exception right after a cluster disruption) is real and reachable in this exact file, I'd treat Issue 3 as a stronger candidate for a pre-merge fix than a purely hypothetical one — it is the same anti-pattern, in the same file, now proven to actually fire at least once.
Issue 4 (Low, assertCheckpointIdsGrow single-pipeline check) — still open, unchanged. Confirmed byte-identical at MysqlCDCClusterFailoverIT.java:1285-1308.
1. Code Change Review
1.1 Core Logic Analysis
Unchanged in substance from earlier rounds — the core test design (real local-cluster fault injection via genuine SeaTunnelServerStarter members, a real submitted job through SeaTunnelClient, actual checkpoint-coordinator state via StateStoreCheckpointIDCounter/CounterStateStore, and CDC-appropriate ordered-content reconciliation against an upsert sink rather than a naive row-count compare) remains sound; see my 2026-08-24 review for the full line-level trace. This round's diff is scoped entirely to awaitJobStatus, discussed above.
1.2 Compatibility Impact
Fully compatible. Purely additive test-only changes across all four commits: one new test class, new test-only docker/config resources, two test-scope Maven dependencies, and this round's test-only Awaitility config tweak. No production code, config Option, public API, or checkpoint/serialization format touched.
1.3 Performance / Side-Effect Analysis
No production-path effects — test-only module. .ignoreExceptions() on awaitJobStatus only affects this test's own polling loop; it cannot mask a real assertion failure (see Issue 0 analysis above) and does not change the 3-minute budget. Sequential execution is still enforced by this module's junit-platform.properties (same_thread for both default and classes execution mode, unchanged, not part of this PR's diff), ruling out port/server-id collisions across this class's cluster bootstraps.
1.4 Error Handling and Logging
Unchanged from prior rounds otherwise: every test method wraps its body in try/finally with cleanup helpers that swallow-and-log.warn teardown failures so a real assertion isn't masked by secondary cleanup exceptions. See Issue 3 below for the one open gap in this area (already known, not new this round), and the secondary note above on awaitJobStatus's reduced fail-fast behavior for genuinely non-transient exceptions.
2. Code Quality Assessment
2.1 Coding Standards
Unchanged — ASF license header present, comprehensive Javadoc on new/modified methods. This round's change to awaitJobStatus adds a precise, accurate Javadoc block explaining exactly why .ignoreExceptions() is needed, citing the specific exception and the analogous existing pattern (startNodeWithRetry) — good practice, consistent with this file's existing documentation quality.
2.2 Test Coverage and Test Stability — explicit flaky-test rating, re-derived from a fresh read of the current head
Re-walked the flaky-test checklist against the full current file, not relying on prior passes:
- No
Thread.sleepanywhere in the file — confirmed via direct inspection of the current head; every wait is a boundedAwaitility.await()poll. - Container-readiness signal:
MYSQL_CONTAINERstartup is handled by Testcontainers' own wait-strategy machinery at@BeforeAll, not a custom sleep-based probe, and the same container instance is reused (not restarted) across all 8 test methods — correct, non-flaky. - Order dependency: none found. Every test method builds its own uniquely-suffixed cluster name and its own uniquely-named source/sink databases and tables, combined with the module's forced
same_threadsequential execution — no realistic interleaving hazard. - Shared mutable state: only the class-level
MYSQL_CONTAINER(expected, Testcontainers-managed) — no other shared mutable test-state fields. .ignoreExceptions()usage is now more consistent, but still incomplete.startNodeWithRetryand, as of this round,awaitJobStatusboth correctly use.ignoreExceptions()for polls that run immediately after a cluster disruption.awaitSourceAndSinkConsistent's two overloads (the file's other high-frequency assertion helper, called from all 8 test methods) still do not, and — as noted above — this round's own fix proves the underlying failure mode is real in this file, not hypothetical.
Explicit stability rating: Risk present. Not "Stable" — Issue 3 remains a genuine, now more strongly evidenced gap in retry semantics on awaitSourceAndSinkConsistent. Not "High risk" — no Thread.sleep, no order dependency, no unguarded shared mutable state, correct container/cluster lifecycle management throughout, and this round's fix closes one of the two known instances of the underlying anti-pattern. This is an improvement over last round (one of two known reachable retry-semantics gaps is now fixed with CI-pending confirmation), but the rating itself is unchanged because the remaining gap (Issue 3) is the same class of risk.
2.3 Documentation Updates
Not required — internal E2E test coverage only, no user-facing behavior or config semantics changed.
3. Architectural Soundness
3.1 Elegance of the Solution
Good reuse of the existing local-cluster fault-injection harness instead of inventing a new one, with the reconciliation strategy correctly adapted for CDC. All issues found across this PR's four rounds have been integration/robustness details (a Testcontainers/init-script collision, a Maven dependency-scope gap, and now two instances of one retry-semantics gap, one fixed) rather than design flaws in the test approach itself.
3.2 Maintainability
TableBinding/TwoTableBinding value objects and the NodeStarter functional interface keep the eight scenario methods readable and DRY. This round's added Javadoc on awaitJobStatus is a good maintainability addition that will help the next person understand why .ignoreExceptions() is there instead of "cleaning it up" as unnecessary.
3.3 Extensibility
The helper set generalizes well to future CDC-source failover scenarios beyond MySQL. I'd suggest closing Issue 3 before that reuse happens, so the pattern copied forward for future suites is the fully-consistent one (all disruption-adjacent polls using .ignoreExceptions()), not a partially-fixed one.
3.4 Historical-Version Compatibility
N/A — test-only addition, no checkpoint/savepoint format, serialization, or upgrade-path impact.
4. Issue Summary
| # | Issue | Location | Severity | Status |
|---|---|---|---|---|
| 1 | setup.sql's unguarded CREATE DATABASE emptydb; collided with the container's own auto-create, aborting container startup on every run |
mysql-cdc-failover/docker/setup.sql |
High | Fixed, previously confirmed via live CI, unchanged this round |
| 2 | pom.xml added connector-cdc-mysql without the connector-cdc-base test dependency it needs, breaking BaseChangeStreamTableSourceFactory resolution module-wide |
connector-seatunnel-e2e-base/pom.xml |
High | Fixed at the source level, mirrors the proven connector-cdc-mysql-e2e/pom.xml pattern; CI on the head that introduced it (67c8f3c889) had not finished, this round's new commit produces a fresh run (see CI section) |
| 3 | awaitSourceAndSinkConsistent's untilAsserted doesn't ignore the RuntimeException-wrapped SQLException that queryRows can throw |
MysqlCDCClusterFailoverIT.java:1153-1196 |
Medium | Still open; same anti-pattern this round's own commit just proved reachable elsewhere in this file |
| 4 | assertCheckpointIdsGrow only requires one of N tracked pipelines to advance (documented/intentional, compensated by data reconciliation) |
MysqlCDCClusterFailoverIT.java:1285-1308 |
Low | Still open |
| 5 | awaitJobStatus lacked .ignoreExceptions(), aborting on the transient SeaTunnelEngineRetryableException right after an all-node-down restart |
MysqlCDCClusterFailoverIT.java:1228-1237 |
Medium (as found; now fixed) | Fixed this round — this is the commit under re-review; I should have caught this myself in an earlier round (see Section 0) |
5. Merge Recommendation
Conclusion: Ready to merge after CI confirms
- Blockers — must be fixed: none remaining at the source level. All High-severity blockers found across this PR's rounds are fixed at the source level; I'm withholding a plain "Ready to merge" only pending a green CI run on this exact head, consistent with how I've handled every prior round's fix.
- Recommended fixes — non-blocking:
- Issue 3 (Medium): add
.ignoreExceptions()to bothawaitSourceAndSinkConsistentoverloads, for consistency withstartNodeWithRetryand (now)awaitJobStatus. Given this round's own commit independently proves the identical anti-pattern reachable in this file, I'd put a bit more weight behind fixing this before merge than I did last round, though I'm not escalating it to a hard blocker since the mechanism still requires an actual transient JDBC blip against a container that is never itself restarted mid-test. - Issue 4 (Low): optionally tighten
assertCheckpointIdsGrowto require growth across all tracked pipelines in the two-pipeline scenario.
- Issue 3 (Medium): add
CI status at review time. Apache-side Build check is pending (a pointer, not the real run). The fork run for this exact head (DanielLeens/seatunnel run 34743504745, head c8660753cd) is status: queued, conclusion: null as of this review — it had not started. I'm reporting that honestly rather than assuming this round's fix works because the diff and its stated root cause both check out — a plausible, well-evidenced diff still needs a real green run before I'd call this unconditionally mergeable. mergeStateStatus is BLOCKED (review-required, not a merge conflict) and mergeable is MERGEABLE; head is ahead_by=5, behind_by=212 relative to dev, worth a routine sync before merge given the size of the gap, though I have no specific evidence of a functional conflict from it.
Existing community reviews. All reviews and comments on this PR to date are mine (DanielLeens) across four rounds; there are no other reviewers' findings to reconcile in this round.
Overall assessment. This round's fix (awaitJobStatus .ignoreExceptions()) is correct, well-scoped, and well-documented, and closes a real gap that a CI failure caught before my own review did — my apology for that miss is in Section 0. Both prior High-severity blockers remain fixed at the source level. The explicit flaky-test stability rating is Risk present (not Stable, not High risk): one of two known instances of the missing-.ignoreExceptions() anti-pattern is now fixed, the other (Issue 3) remains open and is no longer purely hypothetical given this round's evidence.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: the Zeta engine's generic Hazelcast fault-injection harness (
ClusterFaultToleranceIT,SplitClusterFaultToleranceIT) validates worker/master failover and all-node-down restart-from-persistent-state recovery only for plain Fake-source-to-local-file batch/streaming jobs — none of it exercises a real, stateful CDC source (binlog position, snapshot-vs-incremental phase, multi-table/multi-pipeline CDC state) under failover. - Fix approach: adds a new, self-contained
MysqlCDCClusterFailoverITcombining that harness with a real MySQL CDC source and JDBC upsert sink, covering worker/master failover and all-node-down recovery across default and split cluster topologies, plus a two-pipeline scenario. - One-sentence summary: proves the binlog offset and multi-pipeline CDC state actually survive master failover and full-cluster restart, with an ordered full-row diff against the sink, not just a plain Fake-source smoke test.
Re-review at the new head e9483c1a7, one new commit since my last full review (2026-09-13 10:48 UTC, head c8660753cd). I re-read the entire diff against dev from scratch, not just the incremental delta.
0. Disposition of Prior Blockers
This round's only new commit is e9483c1a7, "Merge branch 'dev' into davidzollo_zeta_cdc_cluster_failover_20260823" — a plain merge, not new logic. I confirmed this directly: git diff c8660753cd e9483c1a7 -- MysqlCDCClusterFailoverIT.java mysql-cdc-failover/ connector-seatunnel-e2e-base/pom.xml is completely empty — none of this PR's own owned files (the test class, its Docker/SQL resources, or the pom.xml dependency fix) were touched by the merge. The merge brings in ~1300 unrelated dev files (new engine E2E regression tests from other already-merged PRs, format/transform changes, UI changes, benchmark tooling) with no overlap or conflict against this PR's own code.
Issue 1 (High, setup.sql's unguarded CREATE DATABASE emptydb;) — still fixed, byte-identical.
Issue 2 (High, pom.xml missing the connector-cdc-base test dependency) — still fixed, byte-identical, and now CI-confirmed (see below).
Issue 5 / this-round's-predecessor (awaitJobStatus missing .ignoreExceptions()) — fixed last round, now CI-confirmed for real (see CI section — MysqlCDCClusterFailoverIT passed all 12 cases on the current head, including the two all-node-down-restart scenarios this fix specifically targets).
Issue 3 (Medium, awaitSourceAndSinkConsistent missing .ignoreExceptions()) — still open, not touched by this round's merge. Re-confirmed byte-identical at MysqlCDCClusterFailoverIT.java:1153-1196.
Issue 4 (Low, assertCheckpointIdsGrow single-pipeline check) — still open, unchanged.
1. Code Change Review
1.1 Core Logic Analysis
Unchanged in substance — the core test design (real local-cluster fault injection via genuine SeaTunnelServerStarter members, a real submitted job through SeaTunnelClient, actual checkpoint-coordinator state, CDC-appropriate ordered-content reconciliation against an upsert sink) remains sound; see my earlier rounds for the full line-level trace. This round's diff is a merge commit only, with zero lines changed in any file this PR owns.
1.2 Compatibility Impact
Fully compatible. Purely additive test-only changes across all commits: one new test class, new test-only docker/config resources, two test-scope Maven dependencies. No production code, config Option, public API, or checkpoint/serialization format touched. This round's merge is itself a no-op for this PR's own surface.
1.3 Performance / Side-Effect Analysis
No production-path effects — test-only module, unchanged from prior rounds.
1.4 Error Handling and Logging
Unchanged from prior rounds. See Issue 3 below for the one open gap (carried over, not new).
2. Code Quality Assessment
2.1 Coding Standards
Unchanged — ASF license header present, comprehensive Javadoc on new/modified methods.
2.2 Test Coverage and Test Stability — explicit flaky-test rating, re-derived from a fresh read of the current head, now with CI evidence
Re-walked the flaky-test checklist against the full current file:
- No
Thread.sleepanywhere in the file — confirmed. - Container-readiness, order dependency, shared mutable state — all unchanged and clean, as assessed in prior rounds.
.ignoreExceptions()usage:startNodeWithRetryandawaitJobStatusboth correctly use it.awaitSourceAndSinkConsistent's two overloads still do not (Issue 3).
CI now provides real evidence, not just source-level confidence. I pulled the actual job log for the current head's engine-v2-it (8, ubuntu-latest) run (DanielLeens/seatunnel run 34763598435, job 103775004127) rather than trusting the green/red pointer:
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 486.35 s - in org.apache.seatunnel.engine.e2e.MysqlCDCClusterFailoverIT
All 12 test methods in this PR's own class pass cleanly on this exact head, including the all-node-down-restart scenarios that exercise the awaitJobStatus .ignoreExceptions() fix from last round — that fix is now CI-confirmed to work, not just source-verified.
The Build check on this head is red, but for a reason unrelated to this PR. The one test failure in the whole run is:
[ERROR] SplitClusterFaultToleranceIT.testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck:448->assertEventuallyCanceled:556 » ConditionTimeout
I traced SplitClusterFaultToleranceIT.java's history: its last modification is commit 20900262e, "[Test][E2E] Add regression coverage for task stuck in CANCELING when worker crashes mid-cancel (#12030)" — an already-merged, unrelated PR that reached this branch only because this round's commit merged in the latest dev. This PR's own diff never touches that file. The engine-v2-it (11, ubuntu-latest) leg (same module, JDK 11) completed with no failures at all, which is consistent with this being an isolated timing-sensitive flake in someone else's test rather than something this PR's changes caused.
Explicit stability rating: Risk present — unchanged from last round, but now backed by a real passing CI run for this PR's own test class. Not "Stable" because Issue 3 remains a genuine, open gap in retry semantics on awaitSourceAndSinkConsistent. Not "High risk" — no Thread.sleep, no order dependency, no unguarded shared mutable state, and the one known-and-previously-flagged retry-semantics gap that was reachable (awaitJobStatus) is now fixed and CI-verified.
2.3 Documentation Updates
Not required — internal E2E test coverage only, no user-facing behavior or config semantics changed.
3. Architectural Soundness
3.1 Elegance of the Solution
Good reuse of the existing local-cluster fault-injection harness instead of inventing a new one, with the reconciliation strategy correctly adapted for CDC. Unchanged assessment.
3.2 Maintainability
Unchanged — TableBinding/TwoTableBinding value objects and the NodeStarter functional interface keep the eight scenario methods readable and DRY.
3.3 Extensibility
Unchanged. I'd still suggest closing Issue 3 before this pattern is reused for future CDC-source failover suites, so the copied-forward pattern is the fully-consistent one.
3.4 Historical-Version Compatibility
N/A — test-only addition, no checkpoint/savepoint format, serialization, or upgrade-path impact.
4. Issue Summary
| # | Issue | Location | Severity | Status |
|---|---|---|---|---|
| 1 | setup.sql's unguarded CREATE DATABASE emptydb; collided with the container's own auto-create |
mysql-cdc-failover/docker/setup.sql |
High | Fixed, unchanged this round |
| 2 | pom.xml missing the connector-cdc-base test dependency |
connector-seatunnel-e2e-base/pom.xml |
High | Fixed, now CI-confirmed on this head |
| 3 | awaitSourceAndSinkConsistent's untilAsserted doesn't ignore the RuntimeException-wrapped SQLException that queryRows can throw |
MysqlCDCClusterFailoverIT.java:1153-1196 |
Medium | Still open, not touched this round |
| 4 | assertCheckpointIdsGrow only requires one of N tracked pipelines to advance (documented/intentional, compensated by data reconciliation) |
MysqlCDCClusterFailoverIT.java:1285-1308 |
Low | Still open |
| 5 | awaitJobStatus lacked .ignoreExceptions(), aborting on the transient SeaTunnelEngineRetryableException right after an all-node-down restart |
MysqlCDCClusterFailoverIT.java:1228-1237 |
Medium (as found) | Fixed last round, now CI-confirmed passing (12/12 tests) on this head |
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers — must be fixed: none. All High-severity issues are fixed at the source level, and this round's CI run independently confirms the PR's own test class (
MysqlCDCClusterFailoverIT, all 12 methods) passes cleanly, including the all-node-down scenarios that exercise last round's fix. - Recommended fixes — non-blocking:
- Issue 3 (Medium): add
.ignoreExceptions()to bothawaitSourceAndSinkConsistentoverloads, for consistency withstartNodeWithRetryandawaitJobStatus. Worth doing before this pattern gets copied into a future CDC-failover suite, but not blocking given the mechanism requires an actual transient JDBC blip against a container that is never itself restarted mid-test. - Issue 4 (Low): optionally tighten
assertCheckpointIdsGrowto require growth across all tracked pipelines in the two-pipeline scenario.
- Issue 3 (Medium): add
CI status. The apache-side Build check on this head is currently reporting FAILURE, but I traced the actual cause: the only test failure in the entire run is SplitClusterFaultToleranceIT.testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck (ConditionTimeout), in a test class last touched by an already-merged, unrelated PR (#12030) that reached this branch purely through this round's merge from dev. This PR's own diff does not touch that file, and the JDK 11 leg of the same job (engine-v2-it (11, ubuntu-latest)) completed with zero failures. I'd suggest re-running the failed job rather than treating this as a blocker for this PR — it isn't caused by anything in this diff.
Upstream sync. The branch is now ahead_by=6, behind_by=2 relative to dev (down from behind_by=212 two rounds ago) — effectively caught up; no further sync action needed before merge. mergeStateStatus is BLOCKED (review-required, not a merge conflict) and mergeable is MERGEABLE.
Existing community reviews. All reviews and comments on this PR to date are mine (DanielLeens); there are no other reviewers' findings to reconcile in this round.
Overall assessment. Both prior High-severity blockers remain fixed at the source level, and this round's CI run finally gives me the green result on the PR's own test class that I was withholding an unconditional recommendation for in the last two rounds — 12/12 tests pass, including the specific all-node-down scenarios the last fix targeted. The one red mark on this head's CI is a pre-existing, unrelated test brought in by the routine dev merge, not anything in this PR. I'm comfortable moving this to "Ready to merge" — the two remaining recommendations (Issues 3 and 4) are worth picking up but don't need to block. Thanks for staying with this through the iteration; this is solid coverage for a real gap in the CDC-under-failover story.
|
Synced |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the contribution! I reviewed the complete current diff and its actual callers.
What this PR solves
User pain: generic Fake-source failover tests do not exercise real CDC offsets and multiple pipeline states. Fix: add twelve MySQL-to-JDBC fault-injection cases covering worker/master removal and persistent all-node restart in combined and split clusters. In one sentence: verify that CDC rows still arrive after engine recovery. Example: insert rows before a master shutdown, restart, insert another batch, and compare every ordered source/sink row.
1. Code Change Review
1.1 Core Logic Analysis
The complete six-file diff adds test dependencies, one 1,539-line IT and four resources; it changes no production implementation. Before, the generic harness exercised Fake-source data. After, runTwoPipelineSplitClusterAllNodeDownTest submits two real CDC pipelines and checks both sinks. The key assertion is assertIterableEquals(queryRows(source), queryRows(sink)).
MySqlContainer readiness -> isolated source/sink databases -> generated job config
-> real SeaTunnelServerStarter members -> SeaTunnelClient execution
-> snapshot/binlog reader -> JDBC primary-key upsert sink
-> observe initial rows and checkpoint counters -> shut down selected members
-> reconnect/recreate members -> same jobId RUNNING -> counter progress
-> insert post-recovery rows -> ordered full-row reconciliation -> cancel -> cleanup
Key findings: normal test execution reaches genuine connector and coordinator code; all-node cases use FileMapStore with the same unique namespace across restart; two-pipeline cases reconcile both bindings; counter advancement measures ID allocation rather than independently proving durable checkpoint completion. Existing Issues 1/2/5 remain repaired: no duplicate emptydb creation, explicit provided CDC-base test dependency, and retrying job-status lookup. I re-read every scenario and helper, not only the latest merge delta.
Evidence: independent review branch seatunnel-review-11947, head 3b5dd6a08bd6b0ae60af4841fce313d006f26b75. Local Git fetch/diff and source/caller searches produced the complete changed-file evidence; I ran no local build, test, container or job.
1.2 Compatibility Impact
Fully compatible: test-only additions, test-scope dependencies, no public API/config/default/protocol or serialized state changes.
1.3 Performance / Side Effects
Production CPU, memory, GC, network, locking, retry and resource ownership are unaffected. CI starts real members and a shared MySQL container; method-unique database/cluster names isolate data, and finally blocks close clients/members. Container teardown closes the shared DB. Local persistence paths are cluster-qualified; this is not a production durability benchmark.
1.4 Error Handling and Logging
No source-level blocker found. Existing Issue 3 remains a nonblocking Medium stability recommendation: MysqlCDCClusterFailoverIT.java:1153 and :1173 retry assertion failures but not the RuntimeException-wrapped SQLException from queryRows at :1329. A transient JDBC error can abort reconciliation early; consider retrying narrowly classified transient SQL errors rather than masking all exceptions. Existing Issue 4 remains Low/nonblocking at :1285: grew becomes true when any tracked pipeline counter advances. Require all tracked pipelines, and ideally an actual completed-checkpoint signal, if claiming both have checkpointed. Both are previously raised by Daniel, not newly introduced findings; no other reviewer has duplicated them.
2. Code Quality Assessment
2.1 Coding Standards
New lifecycle/helpers and binding fields have explanatory Javadocs, ASF headers are present, dependencies are test-scoped and names follow the surrounding engine test conventions.
2.2 Test Coverage and Test Stability
Stability rating: At risk, specifically existing Issue 3 at lines 1153/1173. No Thread.sleep synchronization was found. Awaitility bounds readiness, data reconciliation, status and restart retries; SQL sorts by primary key, connections/statements/results close, and each test uses separate database names. The shared container is not restarted during fault injection, so the JDBC-blip risk is nonblocking. Twelve scenarios cover worker/master/all-node recovery across both topologies and both pipeline counts. These are source observations; old-head passing test logs are not current-head runtime evidence.
2.3 Documentation Updates
No user-facing behavior changes; bilingual product documentation is unnecessary for this additive internal IT. The config resources match their dynamic substitutions and use streaming mode and explicit checkpoint interval.
3. Architectural Soundness
3.1 Elegance
Focused reuse of actual server/client and CDC fixtures rather than a simulated offset-recovery implementation.
3.2 Maintainability
Binding objects and common helpers make the twelve cases comparable; preserving narrow exception handling keeps real failures visible.
3.3 Extensibility
The same reconciliation pattern can cover additional stateful connectors; strengthen per-pipeline checkpoint evidence before using it as a durability acceptance oracle.
3.4 Historical-Version Compatibility
No migration or checkpoint-format change. The suite exercises recovery of jobs created by the same build, not a cross-version upgrade.
4. Issue Summary
| No. | Issue | Location | Severity |
|---|---|---|---|
| 3 | Transient SQL exceptions escape reconciliation wait | MysqlCDCClusterFailoverIT.java:1153,1173 | Medium, nonblocking |
| 4 | Counter check accepts progress in only one pipeline | MysqlCDCClusterFailoverIT.java:1285 | Low, nonblocking |
All existing reviews/discussion records are Daniel's; there is no independent maintainer approval to infer. Earlier issue numbers are preserved; resolved Issues 1/2/5 are not repeated as active blockers.
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers, must fix: No source blocker found. Repository CI and a write-capable maintainer's review remain merge gates.
- Suggested improvements, nonblocking: Issues 3 and 4 above, for the conditional transient-JDBC and checkpoint-evidence limitations described.
The earlier Build-failure claim is obsolete: the current-head fork Build is completed successfully at https://github.com/DanielLeens/seatunnel/actions/runs/41162877118. Apache currently exposes no adopted Build check for this SHA; fork success is separate from Apache's required check. Behind dev is recorded as metadata, with no unrelated current failing check established and no new sync request justified.
Overall, the suite is useful real CDC failover coverage and the prior blockers remain closed. The best improvement is to strengthen these existing test oracles, not change production checkpoint behavior to accommodate the tests.
Daniel has READ permission. This technical conclusion does not dismiss historical requested changes or satisfy a write-reviewer gate. GitHub does not permit me to approve my own PR.
Snapshot 2026-11-01T14:07:35.434983+00:00: head 3b5dd6a08bd6b0ae60af4841fce313d006f26b75, base dev; compare diverged, ahead 9 / behind 9; merge blocked / BLOCKED, review decision REVIEW_REQUIRED. Drift is recorded separately; it does not itself request synchronization.
|
Thanks @davidzollo for the independent approval! I checked the current head No new source finding or CI retry is requested. The branch's behind/diverged fact remains recorded independently; GitHub currently reports This replies to the new approval on an already reviewed, unchanged head. No new full source review or local runtime validation is claimed. |
Summary
Coverage
Validation