Skip to content

[Improve][E2E] Replace fixed sleeps with condition-based waits - #11842

Closed
nzw921rx wants to merge 12 commits into
apache:devfrom
nzw921rx:feature/e2e-replace-thread-sleep
Closed

nzw921rx wants to merge 12 commits into
apache:devfrom
nzw921rx:feature/e2e-replace-thread-sleep

Conversation

@nzw921rx

@nzw921rx nzw921rx commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

Purpose

SeaTunnel E2E tests contain fixed waits for many different reasons. Some of them wait for an observable asynchronous state, while others intentionally model elapsed time or create a timing boundary required by the scenario.

Treating both kinds of waits as interchangeable causes two problems:

  • readiness waits are slow on fast runners and flaky on loaded runners;
  • blindly replacing semantic timing windows can change what a test exercises and introduce regressions.

This PR is therefore a focused cleanup of historical E2E timing debt, not a goal to remove every time-based wait. It replaces fixed waits when a reliable condition exists and explicitly documents the cases where elapsed time is part of the test semantics.

Changes

Replace readiness waits with observable conditions

  • Use Awaitility to poll container, external service, job, checkpoint, metric, cluster, CDC, schema, file, connector output, and retry state.
  • Use bounded timeouts so a healthy test completes as soon as its condition is satisfied while a loaded CI runner has a clear deadline.
  • Use stability windows when a state must remain true for a period, instead of sleeping and checking it only once.
  • Keep polling assertions focused on the state that the test actually depends on, with transient exceptions ignored only where the resource can legitimately be unavailable during startup.

Preserve intentional time semantics

Time-based waits are retained when no independent readiness signal exists or when elapsed time is itself part of the tested behavior. These cases include:

  • crossing MySQL binlog or file-mtime timestamp granularity boundaries;
  • allowing a checkpoint opportunity before deliberately terminating embedded cluster nodes;
  • allowing Hazelcast membership, partition, and socket cleanup to settle before reusing an embedded-cluster configuration;
  • synthetic source pacing and polling cadence;
  • deliberate writer blocking, commit failure, and checkpoint latency injection;
  • sampling the transient metrics interval before the first checkpoint.

Every retained wait now uses an explicit TimeUnit and has a nearby comment explaining why a condition-based wait would not preserve the scenario. There are no remaining Thread.sleep(...) calls under seatunnel-e2e.

Avoid blocking checkpoint snapshots

Synthetic source delays in CheckpointableSequenceSourceReader and InMemorySourceReader are performed outside output.getCheckpointLock(). Source pacing therefore no longer blocks checkpoint snapshots.

Review follow-up

The initial fault-tolerance conversion attempted to wait for completed checkpoints through SeaTunnelClient#getCheckpointOverview. CI showed that this path is unsafe in the embedded node-failure tests: server-side GetCheckpointOverviewOperation can perform a nested blocking Hazelcast IMap#get on an operation thread during partition changes and fail with Waiting for response on this thread is illegal.

Using a separate client-side polling executor cannot fix that server-side operation-thread constraint. The REST checkpoint counter used by some container tests is also unavailable here because HTTP is intentionally disabled in these embedded-cluster test configurations.

Those tests therefore retain a documented checkpoint opportunity window until the embedded engine exposes a safe checkpoint-completion signal. This preserves the original fault-tolerance scenario without relying on the unsafe RPC path.

Expected impact

  • Observable asynchronous states are checked directly instead of after an arbitrary delay.
  • Fast runners avoid unnecessary waiting, while slow runners can converge within explicit deadlines.
  • Timeout failures identify the unmet condition more clearly.
  • Timing-sensitive tests retain their original intent and explain the remaining time dependency.
  • The change is limited to E2E tests and does not affect production APIs, configuration, or runtime behavior.

Validation

  • Spotless applied successfully to the affected E2E modules.
  • git diff --check passed.
  • The complete seatunnel-e2e tree was checked and contains no remaining Thread.sleep(...) calls.
  • ./mvnw verify was not run locally; the full test matrix is left to GitHub Actions.

@github-actions github-actions Bot added the e2e label Aug 17, 2026

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What Problem Does This PR Solve?

SeaTunnel's E2E suite leans heavily on fixed Thread.sleep(...) calls to wait for asynchronous state (container readiness, job reaching RUNNING, CDC propagation, index refresh, checkpoint commits, cluster membership, etc.). A fixed sleep is either too short on a loaded CI runner (flaky failure) or wastes time on a fast one. This PR sweeps ~58 E2E files and replaces most of these sleeps with Awaitility await()/during() polling on the actual condition, and keeps a documented sleep only where elapsed time really is part of the test semantics (retry backoff, timestamp-granularity spacing, deliberate latency injection).

The intent is good and most of the mechanical conversions are done correctly — e.g. await().during(20, SECONDS).atMost(2, MINUTES) for "job must stay RUNNING" (MySQL/Postgres/Oracle/SqlServer CDC ITs) is a real upgrade over the old "sleep then snapshot-check once" pattern, and moving Thread.sleep outside the synchronized (output.getCheckpointLock()) block in CheckpointableSequenceSourceReader/InMemorySourceReader is a genuine correctness fix (pacing no longer blocks checkpoint snapshotting).

However, this PR's own fork CI run is red across almost every job category it touches (elasticsearch-connector-it, paimon-connector-it, jdbc-connectors-it-part-2/3/6, oracle-cdc-connector-it, engine-v2-it, all-connectors-it-1/4/5/6/7), and I traced four of these failures directly to logic introduced by this diff, not environment flakiness. Details below.

1. Code Change Review

1.1 Core Logic Analysis

The mechanical pattern (Thread.sleep(N) → Awaitility.await().atMost(...).until(...)) is correct in the large majority of the ~58 files. A few examples of genuinely good conversions:

  • SystemLoadAllocateStrategyIT.java / SlotRatioAllocateStrategyIT.java: replaced a blind sleep(10000)("waiting for worker heartbeat registration") with polling resourceManager.getRegisterWorker().containsKey(nodeAddress) for both nodes — this checks the actual terminal condition instead of guessing a duration.
  • AbstractDorisIT.isBeReady: moved the per-poll delay out of the readiness-check method (which previously slept unconditionally even when already ready) and into Awaitility's pollInterval — correct idiom.
  • CDC "job stays running after upsert" checks (MySQL/Postgres/Oracle/SqlServer): await().during(20s).atMost(2m).pollInterval(2s) now requires the RUNNING status to hold continuously for the full window, which is strictly stronger than the old "sleep 20s, check once."

But four call sites where a fixed sleep was removed introduce a real, CI-reproduced regression rather than just closing a flakiness gap. Each is backed by an actual failing job in this PR's own fork CI run at head cc667fb94c32988bb90b4a17334efe4d2f45d0b3 (run 32034402067), not a hypothetical.

Issue 1 — Aerospike container-ready race, no replacement wait at all (High)

seatunnel-e2e/seatunnel-connector-v2-e2e/connector-aerospike-e2e/.../AbstractAerospikeIT.java:82

container.start();
// [removed: Thread.sleep(5000) with no replacement of any kind]
ClientPolicy policy = new ClientPolicy();
...
client = new AerospikeClient(policy, hosts);

The Testcontainers wait strategy is Wait.forLogMessage(".*service ready: soon.*\n", 1) — note the log line itself says "ready: soon," i.e. it fires before the Aerospike node has actually finished cluster initialization. The old Thread.sleep(5000) was compensating for exactly that gap. This PR deletes the sleep and adds no condition-based wait in its place — not even a retry around the AerospikeClient construction.

CI proof: fork run job Run / all-connectors-it-7, Aerospike6IT, fails in 5.6s at AbstractAerospikeIT.startUp:93:

com.aerospike.client.AerospikeException$Connection: Error -8: Failed to connect...
Error -3: Node BB94D3496AE5692 127.0.0.1 32873 is not yet fully initialized

This is exactly the "container up vs. service ready" race category. Fix: wrap the AerospikeClient construction/connect in Awaitility.await().atMost(...).until(() -> { try { client = new AerospikeClient(...); return client.isConnected(); } catch (Exception e) { return false; } }), or wait on a later, truly-ready log line if the Aerospike image emits one.

Issue 2 — await().untilAsserted(...) without .ignoreExceptions() around a query that can legitimately throw before setup finishes (High, hits 2 files)

Both cases follow the same shape: a fixed "give the job time to create the table" sleep was deleted, and the downstream await() block that's supposed to absorb the timing gap does not call .ignoreExceptions(). Awaitility's untilAsserted only auto-retries AssertionError; any other exception (here, a RuntimeException wrapping SQLException, which every query() helper in this codebase throws) escapes immediately on the very first poll — zero retries, regardless of the configured atMost.

a) OracleCDCWithSchemaChangeIT.testOracleCdc2OracleWithSchemaEvolutionCase (seatunnel-e2e/.../connector-cdc-oracle-e2e/.../OracleCDCWithSchemaChangeIT.java:152-168): the removed code was explicitly labeled // Waiting to job running for auto create sink table / Thread.sleep(10000L). It's gone, and assertSchemaEvolution (line 211) does await().atMost(300, SECONDS).untilAsserted(() -> checkData(...)) with no .ignoreExceptions(). Compare with the other test in the same class, testOracleCdc2MysqlWithSchemaEvolutionCase (line 189), which correctly waits for RUNNING status before calling assertSchemaEvolution — that pattern was not applied to the first test.

CI proof: Run / oracle-cdc-connector-it, OracleCDCWithSchemaChangeIT.testOracleCdc2OracleWithSchemaEvolutionCase, fails in 10.3s (not anywhere near the 300s budget — proof of zero retries):

java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
  at AbstractOracleCDCIT.query(AbstractOracleCDCIT.java:226)
  at OracleCDCWithSchemaChangeIT.checkData(OracleCDCWithSchemaChangeIT.java:475)

Reproduced identically 3 times across the same CI run.

b) StarRocksSchemaChangeIT.verifyDataConsistency (seatunnel-e2e/.../connector-starrocks-e2e/.../StarRocksSchemaChangeIT.java:204,278): the removed TimeUnit.SECONDS.sleep(20) before verifyDataConsistency("orders") gave the job time to auto-create the sink table; verifyDataConsistency's await().atMost(2, MINUTES).pollInterval(1, SECONDS).untilAsserted(...) has no .ignoreExceptions().

CI proof: Run / all-connectors-it-6, StarRocksSchemaChangeIT.testStarRocksSinkWithSchemaEvolutionCase, fails in 9.7s:

java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: ... Unknown table 'shop.orders'.
  at StarRocksSchemaChangeIT.query(StarRocksSchemaChangeIT.java:480)

Fix for both: add .ignoreExceptions() (or .ignoreException(RuntimeException.class)) to these await() chains so the poll actually retries through the table-not-yet-created window, the same way EasysearchIT.awaitIndexDocsCount and several other conversions in this same PR already do correctly.

Issue 3 — EasysearchIT.awaitIndexDocsCount called with the wrong expected count; deterministic failure (High)

seatunnel-e2e/.../connector-easysearch-e2e/.../EasysearchIT.java:171, 186, 327

readSinkData() and readSinkDataFromIndex() call awaitIndexDocsCount(indexName, testDataset.size()), i.e. they wait for the sink index to contain the full 100-row dataset. But both jobs under test (easysearch_source_and_sink.conf, easysearch_source_and_sink_with_save_mode.conf) read from st_index with a source-side filter query = {"range": {"c_int": {"gte": 10, "lte": 20}}}, which matches exactly 11 rows (c_int ∈ [10,20]), and write only those 11 rows into st_index2 / st_index_save_mode. The awaited condition (docsCount == testDataset.size() i.e. == 100) can never be true, so every call times out at the full 2-minute budget.

CI proof: Run / all-connectors-it-5, EasysearchIT, all 14 parameterized instances of testEasysearch and testEasysearchWithSaveMode fail identically after ~150-167s each:

org.awaitility.core.ConditionTimeoutException: ... expected: <100> but was: <11> within 2 minutes.
  at EasysearchIT.awaitIndexDocsCount(EasysearchIT.java:390)
  at EasysearchIT.readSinkData(EasysearchIT.java:327)

<11> is exactly the count of the [10,20] inclusive range, confirming the diagnosis. This isn't flakiness — it fails 100% of the time as written. Prior to this PR, the code just slept 2s and read whatever was there (no doc-count precondition), so this specific regression was introduced by the new helper, not merely exposed by it. Fix: pass the actual expected filtered count (11) at these two call sites, or compute it from mapTestDatasetForDSL()'s filter instead of testDataset.size().

Issue 4 — CommittedMetricsIT checkpoint-interval widening breaks the "second checkpoint commits more" assumption (High)

seatunnel-e2e/.../connector-seatunnel-e2e-base/src/test/resources/stream_fake_multi_table_to_console_with_checkpoint.conf:23 bumps checkpoint.interval from 10000 to 60000, with the stated goal of giving the first await block (pre-checkpoint metrics) more headroom on a slow runner. That block is fine. But the two FakeSources in this conf (row.num=150/split.num=5, row.num=90/split.num=5, split.read-interval=3000) are a finite source: FakeSourceSplitEnumerator.discoverySplits() computes a fixed split set once, and FakeSourceReader.pollNext processes one split per poll gated by minSplitReadInterval=3000ms. With 10 total splits, all data (240 rows) is fully drained in roughly 30s — well before the new 60s checkpoint interval elapses.

Consequence: checkpoint #1 (~t=60s) commits everything the source ever produces; checkpoint #2 (~t=120s) has nothing new to commit. The third await() block in CommittedMetricsIT.java:177-186 (committedCount > committedCountAfterFirstCP, atMost(3, MINUTES)) can therefore never succeed.

CI proof: Run / engine-v2-it, CommittedMetricsIT.testCommittedMetricsWithCheckpoint, fails after 242.7s:

org.awaitility.core.ConditionTimeoutException: ... expected: <true> but was: <false> within 3 minutes.
  at CommittedMetricsIT.testCommittedMetricsWithCheckpoint(CommittedMetricsIT.java:180)
Caused by: AssertionFailedError at CommittedMetricsIT.java:185 (committedCount > committedCountAfterFirstCP)

Fix: either raise row.num/lower split.read-interval so the source keeps producing across at least two checkpoint intervals, or scale checkpoint.interval down again (e.g. 20000-30000) rather than 60000 — the goal of "wide headroom before the first checkpoint" doesn't require a 60s interval, just an interval comfortably larger than typical CI scheduling jitter for the first await, which had a much smaller (30s) budget anyway.

1.2 Compatibility Impact

Test-only change; no production code, public API, SPI, or config-option changes. Two test .conf files change checkpoint.interval (Milvus: 30000→180000, engine base: 10000→60000) — these are internal to specific ITs and not user-facing defaults, so no docs/en/docs/zh update is required.

1.3 Performance / Side-Effect Analysis

Net effect on green runs should be positive (tests finish as soon as the condition is met instead of always paying the fixed delay). On timeout/failure paths, several atMost bounds were raised generously (2min→5min in many places, 60s→2-5min elsewhere), which is a reasonable trade for reliability but does mean a genuinely broken build will take noticeably longer to fail in CI (e.g. CommittedMetricsIT now burns 3 extra CI-minutes hitting the widened timeout before reporting the Issue 4 regression above). Not a blocker, just worth knowing the failure-detection latency went up in several spots.

CheckpointableSequenceSourceReader/InMemorySourceReader: moving Thread.sleep out of synchronized (output.getCheckpointLock()) is a genuine concurrency improvement — it stops the pacing delay from blocking checkpoint barrier processing on that lock. Good catch, no downside I can see.

1.4 Error Handling and Logging

The systemic gap is Issue 2 above: several converted await() blocks don't call .ignoreExceptions() even though the wrapped call can throw a non-AssertionError during the exact window the poll is supposed to absorb. This isn't a logging problem, it's a "the retry loop doesn't actually retry" problem, and it's worth a project-wide grep (await().*untilAsserted without .ignoreExceptions() where the body does a JDBC/HTTP/client call) beyond just the two instances I found broken by CI.

2. Code Quality Assessment

2.1 Coding Standards

Consistent with existing style; retained sleeps are commented with the reason (retry backoff, timestamp granularity, deliberate fault injection) as the PR description promises. I didn't find any stray System.out.println or wildcard imports introduced by this diff.

2.2 Test Coverage and Test Stability

Explicit stability rating: High risk. Per the review guidance, this is a formal High-severity blocking finding. Evidence: AbstractAerospikeIT.java:82 (Issue 1), OracleCDCWithSchemaChangeIT.java:152-168,211 and StarRocksSchemaChangeIT.java:204,278 (Issue 2), EasysearchIT.java:171,186,327 (Issue 3), stream_fake_multi_table_to_console_with_checkpoint.conf:23 + CommittedMetricsIT.java:177-186 (Issue 4) — all four are reproduced in this PR's own fork CI run (nzw921rx/seatunnel run 32034402067, head cc667fb94c3298), not theoretical. Three of the four (Issues 1-3) fail deterministically/near-instantly, not as a timing-dependent flake, which means they will fail on essentially every run, not just loaded runners.

Elsewhere in the diff the "verify condition-based waits check the right terminal condition" bar is met well — the .during() conversions for "stays RUNNING" checks, the resourceManager-registration polls, and the checkpoint-lock fix are all correct and are real flakiness reductions, not just code motion.

2.3 Documentation Updates

Not applicable — E2E test-only change.

3. Architectural Soundness

3.1 Elegance of the Solution

The overall approach (condition-based waits, .during() for "must stay stable" checks, comments on retained sleeps) is the right shape for this problem and most of the ~58 files are done well. The four regressions above are localized logic mistakes in specific conversions, not a flaw in the overall approach.

3.2 Maintainability

The new small awaitXxx/helper methods (awaitJobRunning, awaitIndexDocsCount, assertWildcardTablesSynchronized, getRunningJobIds, queryMetrics, getJobInfo) are a nice de-duplication and make the intent of each wait self-documenting. Once Issues 2-3 are fixed, this should meaningfully reduce future flaky-CI triage effort, which is the entire point of the PR.

3.3 Extensibility

No concerns.

3.4 Historical-Version Compatibility

N/A — test-only, no serialization/checkpoint-format/config changes.

4. Issue Summary

  • Issue 1 (High) — AbstractAerospikeIT.java:82: container.start() readiness sleep removed with no replacement; CI-reproduced connection failure ("Node ... is not yet fully initialized"). Raised by another reviewer: No.
  • Issue 2 (High) — OracleCDCWithSchemaChangeIT.java:152-168,211 and StarRocksSchemaChangeIT.java:204,278: await().untilAsserted(...) lacks .ignoreExceptions(), so removing the setup sleep exposes an unretried RuntimeException on the first poll. CI-reproduced in both files (fails in ~10s, not near the configured timeout). Raised by another reviewer: No.
  • Issue 3 (High) — EasysearchIT.java:171,186,327: awaitIndexDocsCount(indexName, testDataset.size()) awaits the wrong (unfiltered) count against sink indices populated by a range-filtered source; deterministically times out. CI-reproduced across all 14 parameterized instances. Raised by another reviewer: No.
  • Issue 4 (High) — stream_fake_multi_table_to_console_with_checkpoint.conf:23 + CommittedMetricsIT.java:177-186: widened checkpoint.interval (10000→60000) outlasts the finite FakeSource's data-emission window, so the "second checkpoint commits more" assertion can never succeed. CI-reproduced. Raised by another reviewer: No.
  • Minor (Low, non-blocking) — MilvusIT.java (countCollectionEntities(...) >= 9 then a separate assertEquals(9, ...) re-query): still a non-atomic two-read race in principle; the checkpoint-interval widening to 180000 in streaming-fake-to-milvus.conf makes it very unlikely to trigger in practice, but combining it into a single untilAsserted (as the very next block in the same method already does) would remove the residual gap entirely.

5. Merge Recommendation

Conclusion: Not recommended for merge

Blockers (must fix):

  1. Issue 1 — add a real readiness wait (or retrying client-connect) after container.start() in AbstractAerospikeIT.
  2. Issue 2 — add .ignoreExceptions() (or equivalent) to the await() blocks in OracleCDCWithSchemaChangeIT.assertSchemaEvolution and StarRocksSchemaChangeIT.verifyDataConsistency so they actually retry through the "table not yet created" window.
  3. Issue 3 — fix the expected doc count passed to awaitIndexDocsCount for st_index2 / st_index_save_mode in EasysearchIT to match the source's range-filtered row count, not the full dataset size.
  4. Issue 4 — reconcile checkpoint.interval in stream_fake_multi_table_to_console_with_checkpoint.conf with the FakeSource's actual data-emission duration so a second checkpoint has new data to commit.

Recommended fixes (non-blocking): tighten the MilvusIT count-then-reread pattern into a single atomic untilAsserted, as already done elsewhere in this same PR.

Overall assessment: the conversion strategy is sound and the majority of the ~58 files are converted correctly and are a real improvement — several conversions (the .during() "stays RUNNING" pattern, the checkpoint-lock fix, the resourceManager-registration polls) are genuinely better than what they replace, not just less flaky. But the PR's own fork CI is red specifically because of logic mistakes in four of the conversions, all confirmed by reading the actual failure stack traces down to the line, not just "CI is red." Given the stated goal of this PR is CI stability, merging while it demonstrably breaks 4 previously-passing (or previously more-resilient) IT suites would be counterproductive. Once the four blockers above are addressed and a clean fork CI run confirms it, this should be in good shape.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What Problem Does This PR Solve?

Same PR as before: sweeping ~58 E2E files to replace fixed Thread.sleep(...) calls with Awaitility condition-based waits, to reduce both false-negative flakiness (sleep too short) and wasted CI time (sleep too long). This is a full re-review of the follow-up commit f998f943944759da244b5c0e457ccf15d39d0466 ([Fix][E2E] Address condition wait review feedback), pushed on top of the previously-reviewed cc667fb9 in response to my 2026-08-18T02:01:48Z review, which listed 4 High blockers and 1 Low nit, all CI-reproduced.

Verdict up front: 3 of the 4 previous blockers are now genuinely fixed and CI-confirmed. The 4th (CommittedMetricsIT) is still broken — the new value chosen still doesn't work, and CI proves it. In addition, re-reviewing the diff surfaced a fifth, previously-missed site (PaimonSinkCDCIT.java) with the exact same defect pattern as the already-flagged Issue 2, also CI-confirmed failing. This is not a case of "CI is red for unrelated reasons" — I traced both remaining failures to the specific lines in this diff.

1. Code Change Review

1.1 Core Logic Analysis

Site 1 — AbstractAerospikeIT.java:82 (previously Issue 1) — FIXED

Before (cc667fb9, flagged):

client = new AerospikeClient(policy, hosts);
if (!client.isConnected()) {
    throw new IllegalStateException("Failed to connect to Aerospike server");
}

After (f998f943):

Awaitility.await()
        .atMost(Duration.ofMinutes(2))
        .pollInterval(Duration.ofSeconds(1))
        .until(() -> {
            try {
                AerospikeClient candidate = new AerospikeClient(policy, hosts);
                if (!candidate.isConnected()) {
                    candidate.close();
                    return false;
                }
                client = candidate;
                return true;
            } catch (AerospikeException e) {
                return false;
            }
        });

This retries client construction/connect itself (not a proxy signal), only assigns the client field on success, closes rejected candidates (no leak), and catches the exact exception class the container's "ready: soon" race throws. CI proof: fork run 32101352561, job all-connectors-it-7 (11), Aerospike6IT: 42 tests run, 0 failures, 0 errors (previously failed in 5.6s on every run).

Site 2a — OracleCDCWithSchemaChangeIT.java:211 (assertSchemaEvolution's first await(), previously Issue 2) — FIXED for this specific site, but see Site 2b below

.ignoreExceptions() was added to the await().atMost(300, SECONDS).untilAsserted(() -> checkData(QUERY, ...)) block. This is the correct fix — it now retries through the "sink table not yet created" SQLSyntaxErrorException window instead of dying on the first poll.

Site 2b — OracleCDCWithSchemaChangeIT.java:236-245 (same method, "case1 add columns" data-verification block) — NOT FIXED, CI-reproduced failure, same defect as Issue 2

This is a sibling await() block a few lines below the one that was fixed, inside the same assertSchemaEvolution method, and it has the identical defect: it wraps a query that can legitimately throw before setup finishes, with no .ignoreExceptions().

Before (cc667fb9, i.e. before this PR started removing sleeps, comparing against dev):

createAndInitialize("add_columns", CONNECTOR_USER, CONNECTOR_PWD);
Thread.sleep(40 * 1000);                                   // <-- 40s upfront buffer
if (!oracle2Mysql) {
    await().atMost(300, TimeUnit.SECONDS).untilAsserted(() -> checkSchema(...));
    with().pollInterval(TWO_SECONDS)
            .pollDelay(10, TimeUnit.SECONDS)                // <-- +10s delay before first poll
            .and().await().atMost(20, TimeUnit.MINUTES)
            .untilAsserted(() -> { checkData(PROJECTION_QUERY_ADD_COLUMN3, ...); ... });

After (f998f943, current head):

createAndInitialize("add_columns", CONNECTOR_USER, CONNECTOR_PWD);
if (!oracle2Mysql) {
    await().atMost(300, TimeUnit.SECONDS).untilAsserted(() -> checkSchema(...));
    with().pollInterval(TWO_SECONDS)
            .and().await().atMost(20, TimeUnit.MINUTES)
            .untilAsserted(() -> { checkData(PROJECTION_QUERY_ADD_COLUMN3, ...); ... });   // no .ignoreExceptions()

Both the 40s upfront Thread.sleep and the 10s pollDelay before the first poll were removed by this PR's original commit, with nothing added to absorb the "DDL hasn't propagated to the sink table yet" window — checkData queries a column (add_column3) that the schema-evolution DDL hasn't necessarily added to the sink yet, and untilAsserted doesn't retry a raw RuntimeException.

CI proof: fork run 32101352561, job oracle-cdc-connector-it (11), OracleCDCWithSchemaChangeIT.testOracleCdc2OracleWithSchemaEvolutionCase, fails in 23.6s (nowhere near the 20-minute budget — zero-retry signature, same as the original Issue 2 evidence):

java.lang.RuntimeException:
java.sql.SQLSyntaxErrorException: ORA-00904: "ADD_COLUMN3": invalid identifier
  at OracleCDCWithSchemaChangeIT.checkData(OracleCDCWithSchemaChangeIT.java:476)
  at OracleCDCWithSchemaChangeIT.lambda$assertSchemaEvolution$6(OracleCDCWithSchemaChangeIT.java:243)

Reproduced identically 3 times in this run. Fix: add .ignoreExceptions() to this with()...await() chain too (same treatment as the sibling block a few lines above it).

Site 3 — StarRocksSchemaChangeIT.java:278 (verifyDataConsistency, previously Issue 2) — FIXED

.ignoreExceptions() added to await().atMost(2, MINUTES).pollInterval(1, SECONDS).untilAsserted(...). CI proof: job all-connectors-it-6 (11), StarRocksSchemaChangeIT: 1 test run, 0 failures, 0 errors (previously failed in 9.7s on every run).

Site 4 — EasysearchIT.java:171,186,327 (awaitIndexDocsCount, previously Issue 3) — FIXED

Before: awaitIndexDocsCount(indexName, testDataset.size()) (unfiltered 100). After: awaitIndexDocsCount(indexName, mapTestDatasetForDSL().size()) — reuses the same source-side-filter helper (c_int in [10,20]) that the final assertIterableEquals(mapTestDatasetForDSL(), sinkData) already uses, so the awaited count and the asserted count are now derived from the same computation instead of a hardcoded/wrong constant. This is a clean fix (better than hardcoding 11, since it stays correct if testDataset ever changes). CI proof: job all-connectors-it-5 (11), EasysearchIT: 15 tests run, 0 failures, 0 errors (previously 100% deterministic timeout across all 14 parameterized instances).

Site 5 — stream_fake_multi_table_to_console_with_checkpoint.conf:23 + CommittedMetricsIT.java:177-186 (previously Issue 4) — STILL BROKEN, different failure mode, CI-reproduced

The fix lowers checkpoint.interval from 60000 back to 20000 (within the range I suggested — "20000-30000"). This does not work: CI shows the two finite FakeSources (240 rows total) fully drain and get committed by the first checkpoint, at essentially the same wall-clock point the 20s interval fires, so there is nothing left for a second checkpoint to commit and the "second checkpoint commits more" assertion can never succeed.

CI proof (job engine-v2-it (11), CommittedMetricsIT.testCommittedMetricsWithCheckpoint):

  • Job is running log at 05:55:24.139.
  • Metrics before checkpoint (first await, succeeds fast): 05:55:27.302 — SinkWriteCount=18, SinkCommittedCount=0. Fine.
  • Metrics after first checkpoint (second await, waiting for committedCount>0): 05:55:44.628 — SinkWriteCount=240, SinkCommittedCount=240 i.e. by the time the second await first observes any commit, the entire dataset (100% of both sources) has already been written and committed in a single checkpoint.
  • Third await (committedCount > committedCountAfterFirstCP, atMost(3, MINUTES)) times out after the full 3 minutes:
org.awaitility.core.ConditionTimeoutException: ... expected: <true> but was: <false> within 3 minutes.
  at CommittedMetricsIT.testCommittedMetricsWithCheckpoint(CommittedMetricsIT.java:180)

My original review's estimate that the source takes "~30s to drain" (based on split.num=5 × split.read-interval=3000ms per source) turns out to be optimistic for a 20s interval — the observed drain completes at or before ~20-22s, i.e. within the first checkpoint window, not between checkpoints 1 and 2 as the 20000 value assumed. checkpoint.interval=20000 is still not comfortably below the actual drain time; it needs to be low enough that checkpoint 1 fires before the source finishes, not merely "lower than 60000". Fix: either lower checkpoint.interval further (e.g. 5000-8000, well under the observed ~20s full-drain time) or, more robustly, increase the data volume / split.read-interval on the source side so draining genuinely spans multiple 20s checkpoint windows regardless of runner speed.

Site 6 — MilvusIT.java (previously the Low/non-blocking nit) — FIXED

countCollectionEntities(...) >= 9 + separate assertEquals(9, ...) re-query collapsed into a single untilAsserted(() -> Assertions.assertEquals(9, countCollectionEntities(...))), exactly as recommended — removes the residual non-atomic two-read race.

Site 7 (NEW, not caught in the first review) — PaimonSinkCDCIT.java:561-568, 583-594, 645-654 — same defect pattern as Issue 2, CI-reproduced, untouched by the fix commit

This file is part of the original cc667fb9 sleep-removal commit and was not touched at all by the f998f943 follow-up, so it never got the .ignoreExceptions() treatment. It has three Awaitility.await()...untilAsserted(...) blocks, all calling loadPaimonData(dbName, tbName), which throws a raw RuntimeException("table not exist") (via getTable(...)) if the sink table hasn't been auto-created yet by the just-submitted CDC job. None of the three have .ignoreExceptions():

// testChangelogLookup, line 561 — replaced `Thread.sleep(10)` before the first DML wave
Awaitility.await().atMost(5, MINUTES).pollInterval(1, SECONDS)
        .untilAsserted(() -> Assertions.assertEquals(
                3, loadPaimonData("seatunnel_namespace", "st_test_lookup").size()));

// testChangelogLookup, line 583 — replaced `Thread.sleep(60)` ("stream job running 60 seconds")
Awaitility.await().atMost(5, MINUTES).pollInterval(1, SECONDS)
        .untilAsserted(() -> {
            Assertions.assertEquals(8, loadPaimonData("seatunnel_namespace", "st_test_sink").size());
            Assertions.assertEquals(2, loadPaimonData("seatunnel_namespace", "st_test_lookup").size());
        });

// testChangelogFullCompaction, line 645 — replaced `Thread.sleep(20)` ("stream job running 20 seconds")
Awaitility.await().atMost(5, MINUTES).pollInterval(1, SECONDS)
        .untilAsserted(() -> Assertions.assertEquals(
                2, loadPaimonData("seatunnel_namespace", "st_test_full").size()));

CI proof (job paimon-connector-it (11)): the third one fails deterministically:

[ERROR] testChangelogFullCompaction{TestContainer}[1]  Time elapsed: 9.007 s  <<< ERROR!
java.lang.RuntimeException: table not exist
  at PaimonSinkCDCIT.loadPaimonData(PaimonSinkCDCIT.java:669)
  at PaimonSinkCDCIT.lambda$testChangelogFullCompaction$29(PaimonSinkCDCIT.java:652)

9.0s elapsed against a 5-minute budget is the same zero-retry signature seen in every other instance of this bug class. The first two occurrences (testChangelogLookup, lines 561/583) share the exact same defect — loadPaimonData can throw before the table exists there too — and happened not to trigger a failure in this particular run, but that is a timing-window escape (this method runs later in the class after other jobs have already warmed up the namespace), not evidence the code is correct. All three need .ignoreExceptions().

This is precisely the systemic gap I called out in my first review ("worth a project-wide grep... beyond just the two instances I found broken by CI") — it wasn't done, and a third instance of the same bug class surfaced on the very next CI run.

1.2 Compatibility Impact

Unchanged from the prior review: test-only change, no production code/API/SPI/config-option changes. No docs/en/docs/zh update required.

1.3 Performance / Side-Effect Analysis

For the sites that are now genuinely fixed (Aerospike, StarRocks, Easysearch, Milvus), net effect is strictly positive: tests pass on the first meaningful attempt instead of timing out or failing instantly.

For the two still-broken sites, the performance picture is worse than before this fix commit, not just "still broken":

  • CommittedMetricsIT now burns the full 3-minute atMost budget on every run before reporting failure (previously it failed after a fixed ~25s of sleeps in the un-converted code, and after the cc667fb9 regression it burned less time before this iteration widened the relevant window). This is a real CI-time regression on top of being functionally broken.
  • OracleCDCWithSchemaChangeIT's Site 2b now fails fast (23.6s) rather than burning its 20-minute budget, which is at least a smaller time cost than before, but it is still a hard failure on every run, not a flake.

1.4 Error Handling and Logging

The ConditionTimeoutException/RuntimeException messages surfaced by both still-broken sites are reasonably actionable (they include the actual vs. expected values, or the underlying SQL error), so once the root causes are fixed there's no separate logging gap. The systemic issue remains the same one flagged last round: await().untilAsserted(...) wrapping a call that can throw a non-AssertionError needs .ignoreExceptions(), and this sweep still hasn't been applied project-wide — it's been applied reactively, one CI-reported failure at a time, which is how PaimonSinkCDCIT got missed.

  • Issue 4 (High, unresolved) — stream_fake_multi_table_to_console_with_checkpoint.conf:23 + CommittedMetricsIT.java:177-186: checkpoint.interval lowered to 20000 is still not comfortably below the FakeSource's actual drain time (~20-22s observed), so the second checkpoint has nothing new to commit. CI-reproduced (ConditionTimeoutException after the full 3 minutes). Raised by another reviewer: No.
  • Issue 5 (High, unresolved — sibling of previously-fixed Issue 2) — OracleCDCWithSchemaChangeIT.java:236-245: the "case1 add columns" data-verification await() block lacks .ignoreExceptions(); the 40s Thread.sleep and 10s pollDelay that used to buffer this window were both removed with nothing replacing them. CI-reproduced (fails in 23.6s against a 20-minute budget, ORA-00904: "ADD_COLUMN3": invalid identifier, reproduced 3x in the same run). Raised by another reviewer: No.
  • Issue 6 (High, new — missed in the first review) — PaimonSinkCDCIT.java:561-568,583-594,645-654: three await().untilAsserted() blocks wrapping loadPaimonData(), which throws a raw RuntimeException("table not exist") before the sink table is auto-created; none have .ignoreExceptions(). CI-reproduced for the testChangelogFullCompaction occurrence (fails in 9.0s against a 5-minute budget); the other two occurrences share the identical defect. This file was untouched by the f998f943 fix commit. Raised by another reviewer: No.

2. Code Quality Assessment

2.1 Coding Standards

Consistent with the prior review's assessment; the fix commit itself is clean and minimal (imports added where needed, no stray formatting changes, comments explain the conf change).

2.2 Test Coverage and Test Stability

Per-site ratings (evidence above):

Site File:Line Status CI Evidence
1 AbstractAerospikeIT.java:82 Stable 42/42 pass
2a OracleCDCWithSchemaChangeIT.java:211 Stable (for this call site) passes within the same run that fails at 2b
2b OracleCDCWithSchemaChangeIT.java:236-245 High risk — still broken fails deterministically, 23.6s/20min budget
3 StarRocksSchemaChangeIT.java:278 Stable 1/1 pass
4 EasysearchIT.java:171,186,327 Stable 15/15 pass (1 skipped, unrelated)
5 stream_fake_multi_table_to_console_with_checkpoint.conf:23 + CommittedMetricsIT.java:180 High risk — still broken fails deterministically, full 3-minute timeout
6 MilvusIT.java (untilAsserted merge) Stable source-verified atomic fix, low blast radius
7 (new) PaimonSinkCDCIT.java:561-568,583-594,645-654 High risk — newly discovered, still broken fails deterministically, 9.0s/5min budget for the 3rd occurrence; 1st/2nd share the defect

Overall rating: High risk. Two of the four originally-flagged blockers remain unresolved (one with a materially different failure signature than before), and this re-review's independent trace of the fork CI run surfaced a fifth, structurally identical defect in a file the fix commit never touched. This is not "CI is flaky" — every failure discussed above is a deterministic, sub-timeout, first-poll-escape failure with a traceable root cause in this diff.

2.3 Documentation Updates

Not applicable — E2E test-only change.

3. Architectural Soundness

3.1 Elegance of the Solution

The overall conversion strategy remains sound, and this iteration correctly fixed 3 of 4 blockers plus the minor nit using exactly the recommended approaches (retry-the-connect for Aerospike, .ignoreExceptions() for the query-race sites, reusing the existing filtered-count helper for Easysearch, atomic untilAsserted for Milvus). The two remaining problems are narrow, mechanical: one missed sibling call site with the identical known defect, and one config value that wasn't lowered enough. Neither points at a flaw in the overall approach — but they do point at the fixes being applied reactively per-CI-failure rather than via the systemic sweep I suggested in the first review, which is exactly why a fifth instance of the same known bug class (PaimonSinkCDCIT) surfaced on this pass.

3.2 Maintainability

Unchanged assessment — the new small helper methods are good de-duplication. Worth noting: .ignoreExceptions() is not a decision that should be made file-by-file after each CI failure; every await().untilAsserted(...) in this diff that wraps a JDBC/HTTP/client call capable of throwing before setup completes should get the same treatment in one pass, rather than continuing to whack individual moles as CI reports them (this is now the third time this exact class of bug has surfaced: Oracle/StarRocks in round 1, the Oracle sibling site and Paimon in round 2).

3.3 Extensibility

No shared helper/util was introduced for the "poll a query that may legitimately throw before setup finishes" pattern, despite this exact pattern recurring across at least 4 files (Oracle CDC ×2 sites, StarRocks, Paimon ×3 sites) now. A small awaitIgnoringExceptions(...) wrapper (or just a project convention to always chain .ignoreExceptions() on untilAsserted blocks that call JDBC/HTTP helpers) would have prevented at least 3 of the 6 CI-observed failures across both review rounds. Not a blocker, but a concrete improvement opportunity given how many times this exact mistake has recurred in this PR specifically.

3.4 Historical-Version Compatibility

N/A — test-only, no serialization/checkpoint-format/config changes.

4. Issue Summary

# Severity Location Problem Status
1 High (prior) AbstractAerospikeIT.java:82 Container-ready race, no wait Fixed, CI-confirmed
2 High (prior) OracleCDCWithSchemaChangeIT.java:211 untilAsserted without .ignoreExceptions() Fixed for this site
2b High (unresolved) OracleCDCWithSchemaChangeIT.java:236-245 Sibling await() block, same defect, previously masked by 40s sleep + 10s pollDelay that this PR removed Still broken, CI-confirmed
2 High (prior) StarRocksSchemaChangeIT.java:278 Same defect Fixed, CI-confirmed
3 High (prior) EasysearchIT.java:171,186,327 Wrong expected doc count Fixed, CI-confirmed
4 High (unresolved) stream_fake_multi_table_to_console_with_checkpoint.conf:23 checkpoint.interval=20000 still not below actual source drain time (~20-22s observed) Still broken, CI-confirmed
5/Low (prior) Low MilvusIT.java Non-atomic count-then-reread Fixed
6 (new) High PaimonSinkCDCIT.java:561-568,583-594,645-654 Same .ignoreExceptions() gap, 3 call sites, untouched by the fix commit Newly found, CI-confirmed (1 of 3 sites)

5. Merge Recommendation

Conclusion: Not recommended for merge

Blockers (must fix):

  1. OracleCDCWithSchemaChangeIT.java:236-245 — add .ignoreExceptions() to the "case1 add columns" data-verification await() block (the sibling of the block already fixed at line 211 in the same method).
  2. stream_fake_multi_table_to_console_with_checkpoint.conf:23 — checkpoint.interval=20000 is still not reliably below the FakeSource's actual full-drain time; lower it further (comfortably under the observed ~20s drain, e.g. 5000-8000) or restructure the source so draining genuinely spans two checkpoint windows regardless of runner speed. Re-verify against fork CI, not just local reasoning, since the first attempt at "make it lower" also missed.
  3. PaimonSinkCDCIT.java:561-568,583-594,645-654 — add .ignoreExceptions() to all three await().untilAsserted() blocks that call loadPaimonData(...), which can legitimately throw RuntimeException("table not exist") before the CDC job auto-creates the sink table. This file was not part of the follow-up fix commit at all.

Recommended (non-blocking): given this is now the third round where the same "await().untilAsserted needs .ignoreExceptions()" mistake has been found via CI rather than by inspection, a project-wide grep for await().*untilAsserted bodies that call JDBC/HTTP/client helpers (as suggested in the first review) would be worth doing before the next CI round, to avoid a fourth occurrence surfacing on the next push.

Overall assessment: Good, substantive progress — the author correctly diagnosed and fixed 3 of the 4 originally-flagged blockers using the exact recommended approaches, confirmed by a clean, CI-verified pass on Aerospike (42/42), StarRocks (1/1), and Easysearch (15/15). However, the PR's own fork CI is still red, and I traced the remaining redness to two mechanisms already known from round 1 (a missed sibling call site and an under-tuned config value) plus a third file with the identical, previously-flagged defect pattern that the fix commit didn't touch. Given the stated goal of this PR is CI stability, and it is still demonstrably breaking 3 previously-passing/more-resilient test classes (Oracle CDC schema-change, CommittedMetrics, Paimon changelog) via deterministic (not flaky) failures, this needs one more iteration. Noting the PR is still marked draft — these findings are intended to help close it out before it moves to ready-for-review.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What Problem Does This PR Solve?

Same PR: sweeping ~58 E2E files to replace fixed Thread.sleep(...) calls with Awaitility condition-based waits, to reduce both false-negative flakiness (sleep too short) and wasted CI time (sleep too long). This is a full re-review of the current head 0d2b7f585148c5fa57dcbf43313a8594e34cf303, which adds two more commits on top of the f998f943 follow-up I reviewed on 2026-08-18T10:41:05Z:

  • dbda11194 — [Fix][E2E] Address remaining wait regressions (adds .ignoreExceptions() to the still-broken Oracle sibling site and all three Paimon sites; widens CommittedMetricsIT's FakeSource split.num 5→10; adds interrupt handling in BigQueryCDCIT)
  • 0d2b7f585 — [Fix][E2E] Preserve timing semantics in sleep replacements (reverts CommittedMetricsIT's pre-checkpoint metrics wait and 3 MongodbCDCIT waits back to documented Thread.sleeps; tightens Milvus timeouts/checkpoint interval; adds message-visibility assertions to RabbitmqIT; adds a brand-new FaultToleranceFakeSourceAssertions.awaitCompletedCheckpoint() helper used by 3 cluster-fault-tolerance test classes)

Verdict up front: real progress on the previously-flagged issues (4 of 5 are now genuinely fixed and CI-confirmed), but this re-review's independent trace of the fork CI run for the current head found the PR's own CI is still red, and two of the failures are brand-new regressions introduced by the very last commit (0d2b7f585) — not carryovers, not environment flakiness. A third previously-flagged site is still broken, now with a different, deeper failure signature.

All CI evidence below is from fork run nzw921rx/seatunnel workflow run 32140393043 (job IDs 95722627254/627733/627880/627899/627904/627921/628037 and 95721398642), which is the run for the exact current head SHA — verified via repos/nzw921rx/seatunnel/actions/workflows/245741265/runs.

1. Code Change Review

1.1 Core Logic Analysis

Re-verified from round 2 (all still holding, CI-confirmed clean this round)

  • AbstractAerospikeIT.java (Issue 1) — still fixed, no failures.
  • StarRocksSchemaChangeIT.java:278 (Issue 2) — still fixed, no failures.
  • EasysearchIT.java:171,186,327 (Issue 3) — still fixed, no failures.
  • MilvusIT.java untilAsserted merge — still fixed, structure unchanged.

Newly fixed since round 2

PaimonSinkCDCIT.java:562,586,650 (previously Issue 6) — FIXED. .ignoreExceptions() added to all three Awaitility.await()...untilAsserted(...) blocks wrapping loadPaimonData(...). CI proof: paimon-connector-it (8) and paimon-connector-it (11) both success in this run (previously testChangelogFullCompaction failed deterministically in 9.0s).

CommittedMetricsIT.java (previously Issue 4) — FIXED, via a different strategy than either of my two suggested fixes. After two failed attempts at retuning checkpoint.interval/split.num to make the Awaitility conversion of the "metrics before checkpoint" wait work, the author reverted that specific wait to the original Thread.sleep(5000), with a new comment explaining why:

// This assertion intentionally samples the transient interval after writes begin but before
// the first 10-second checkpoint. A condition that waits for both values can miss that
// interval once the first checkpoint has committed, so preserve the original sampling
// window and use adaptive waits only for the later completed-checkpoint states.
Thread.sleep(5000);
Response responseBeforeCheckpoint = getJobInfo();

This is the right call — some sleeps genuinely encode "sample this transient window," not "wait for readiness," and no condition-based rewrite can substitute for that. checkpoint.interval/split.num were also reverted to their original 10000/5 values. CI proof: engine-v2-it — CommittedMetricsIT does not appear in this run's failures at all (previously failed deterministically at the full 3-minute budget in round 2).

MongodbCDCIT.java (3 sites, not previously flagged as broken but touched again this round) — the original f998f943/cc667fb9 commits had already converted 3 fixed sleeps here to condition-based polling on final-state convergence. 0d2b7f585 reverts them back to TimeUnit.SECONDS.sleep(10/20/20), each with a comment explaining that "final data convergence alone cannot distinguish an initial snapshot from change-stream capture" across Flink/Spark/Zeta. Same category of fix as CommittedMetricsIT above — a sound admission that not every sleep in this sweep was a pure readiness-wait candidate.

STILL BROKEN — carryover, new failure signature (previously Issue 5 / round-2 "Site 2b")

OracleCDCWithSchemaChangeIT.java:237-247 — the "case1 add columns" data-verification block in assertSchemaEvolution. dbda11194 added .ignoreExceptions():

with().ignoreExceptions()
        .pollInterval(TWO_SECONDS)
        .and()
        .await()
        .atMost(20, TimeUnit.MINUTES)
        .untilAsserted(() -> { checkData(PROJECTION_QUERY_ADD_COLUMN3, ...); ... });

This does fix the retry-escape defect I flagged last round (the block no longer dies on the first SQLSyntaxErrorException poll). But the test still fails, every time, in this run — now via a genuine ConditionTimeoutException after the full 20-minute budget, not an instant escape:

org.awaitility.core.ConditionTimeoutException: ... iterable contents differ at index [1][0], expected: <4> but was: <7> within 20 minutes.
  at OracleCDCWithSchemaChangeIT.assertSchemaEvolution(OracleCDCWithSchemaChangeIT.java:242)
Caused by: org.opentest4j.AssertionFailedError: iterable contents differ at index [1][0], expected: <4> but was: <7>
  at OracleCDCWithSchemaChangeIT.checkData(OracleCDCWithSchemaChangeIT.java:465)

Reproduced identically in all 3 job re-attempts in this workflow run (oracle-cdc-connector-it (11), elapsed 1220s/1221s/1219s — i.e. it never converges, it just burns the whole budget). This is testOracleCdc2OracleWithSchemaEvolutionCase specifically; the sibling testOracleCdc2MysqlWithSchemaEvolutionCase passes cleanly in the same run.

This is a genuine data-content mismatch, not a retry-mechanics bug — .ignoreExceptions() was the correct fix for the symptom I found in round 2, but it exposed (rather than resolved) a deeper problem: the original code's 40-second upfront Thread.sleep and the 10-second pollDelay before the first poll (both removed by this PR's first commit, never restored) were apparently also load-bearing for ordering/dedup between the "add_columns" DDL+DML batch and the CDC pipeline's processing of the prior batch, not just for "table doesn't exist yet." Since .ignoreExceptions() was already applied and the failure mode changed from "instant escape" to "genuine non-convergence," the fix needs to go further than exception handling — either restore some form of the removed startup buffer before this block, or determine why the projected row set stabilizes at a different value (7) than expected (4) and whether that's a duplicate-application/ordering artifact from CDC catching up faster than before with the original throttle removed.

NEW — introduced by the latest commit (0d2b7f585), not present in any prior round

Issue A (High, NEW): FaultToleranceFakeSourceAssertions.awaitCompletedCheckpoint() throws on every poll in the fault-tolerance suites it was added to

seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/.../FaultToleranceFakeSourceAssertions.java:43-67 (new method), called from:

  • ClusterFaultToleranceIT.java:456,851
  • SplitClusterFaultToleranceIT.java:514,967
  • ClusterFaultToleranceTwoPipelineIT.java:495
static void awaitCompletedCheckpoint(
        SeaTunnelClient engineClient, long jobId, int expectedPipelineCount) {
    Awaitility.await().atMost(2, TimeUnit.MINUTES).pollInterval(1, TimeUnit.SECONDS)
            .ignoreExceptions()
            .until(() -> {
                CheckpointOverview overview =
                        engineClient.createJobClient().getCheckpointOverview(jobId);
                return overview.getPipelines().size() >= expectedPipelineCount
                        && overview.getPipelines().values().stream()
                                .allMatch(p -> p.getCounts().getCompleted() > 0L);
            });
}

This new helper's intent is good (wait for a durable checkpoint before deliberately killing cluster nodes, instead of racing the kill against checkpoint completion) — but calling engineClient.createJobClient().getCheckpointOverview(jobId) from inside the Awaitility poll fails on every single poll attempt in these particular test classes, because these tests run the cluster members embedded in the same JVM as the test/client:

org.awaitility.core.ConditionTimeoutException: Condition ... was not fulfilled within 2 minutes.
  at ClusterFaultToleranceIT.testStreamJobRestoreInAllNodeDown(ClusterFaultToleranceIT.java:851)
Caused by: org.apache.seatunnel.engine.common.exception.SeaTunnelEngineException: java.lang.AssertionError: Waiting for response on this thread is illegal
Caused by: java.lang.AssertionError: Waiting for response on this thread is illegal

.ignoreExceptions() correctly retries through this every second for the full 2 minutes (so it's not a first-poll escape), but the underlying RPC never succeeds even once, so the condition never converges and every call site times out. CI proof — 5 test methods fail identically in this run:

  • ClusterFaultToleranceIT.testStreamJobRestoreInAllNodeDown — 136.3s
  • ClusterFaultToleranceIT.testStreamJobRestoreIn2NodeWorkerDown — 133.9s
  • SplitClusterFaultToleranceIT.testStreamJobRestoreInWorkerDown — 144.1s
  • SplitClusterFaultToleranceIT.testStreamJobRestoreInAllNodeDown — 145.8s
  • ClusterFaultToleranceTwoPipelineIT.testTwoPipelineStreamJobRestoreIn2NodeWorkerDown — 133.7s

Notably, this exact package already has two working examples of "wait for a completed checkpoint" that this PR left untouched: CheckpointRestoreWithStopIT.java:129 and SavepointRestoreIT.java:127, both of which poll a REST/HTTP endpoint instead (getPipelineCounter(jobId, "completed") via getJobInfo()/RestAssured), not the SeaTunnelClient RPC path:

private void awaitCompletedCheckpoint(long jobId) {
    Awaitility.await().atMost(2, TimeUnit.MINUTES)
            .untilAsserted(() -> Assertions.assertTrue(getCompletedCheckpointCount(jobId) > 0));
}

Fix: reimplement FaultToleranceFakeSourceAssertions.awaitCompletedCheckpoint on top of the same REST-based pattern instead of engineClient.createJobClient().getCheckpointOverview(...).

Issue B (High, NEW): RabbitmqIT message-visibility check is a bare, non-retrying assertion racing broker propagation

seatunnel-e2e/seatunnel-connector-v2-e2e/connector-rabbitmq-e2e/.../RabbitmqIT.java:218-222 and :388-392:

initSourceData(sourceClient);
Assertions.assertTrue(
        sourceClient.getChannel().queueDeclarePassive(sourceQueueName).getMessageCount()
                >= TEST_DATASET.getValue().size(),
        "Source messages must be visible to the broker before the job starts");

and (in the multi-table sendData helper):

Assertions.assertTrue(
        rabbitmqClient.getChannel().queueDeclarePassive(queueName).getMessageCount()
                >= count,
        "Published messages must be visible before starting the multi-table job");

Both are single-shot Assertions.assertTrue calls, not wrapped in any wait/retry — despite asserting a condition (broker-side message count visibility right after basicPublish, with no publisher-confirms) that is not guaranteed to be instantaneously consistent. This is the mirror image of the anti-pattern this PR is supposed to be eliminating: instead of "sleep blindly," it's now "assert instantly, no retry at all." CI proof — all-connectors-it-2, RabbitmqIT: 10 of 21 parameterized test instances fail, most directly on these two assertions:

org.opentest4j.AssertionFailedError: Source messages must be visible to the broker before the job starts ==> expected: <true> but was: <false>
  at RabbitmqIT.testRabbitMQ(RabbitmqIT.java:219)
org.opentest4j.AssertionFailedError: Published messages must be visible before starting the multi-table job ==> expected: <true> but was: <false>
  at RabbitmqIT.sendData(RabbitmqIT.java:389)

(the remaining 2 failures are downstream "job should finish with exit code 0" failures likely caused by the same race feeding a partial dataset into the job). Fix: wrap both checks in Awaitility.await().atMost(...).untilAsserted(...) instead of a bare assertTrue.

1.2 Compatibility Impact

Confirmed via gh pr diff — all 57 changed files are under seatunnel-e2e/**. Test-only change; no production code, public API, SPI, or config-option changes. No docs/en/docs/zh update required.

1.3 Performance / Side-Effect Analysis

For the newly-fixed sites (Paimon, CommittedMetricsIT, MongodbCDCIT reverts), net effect is positive or neutral — either genuinely faster convergence or a deliberate, well-justified return to a fixed sleep where that's the correct semantics.

MilvusIT.java + streaming-fake-to-milvus.conf: checkpoint.interval tightened 180000→30000 (6x) and the two Awaitility.await() budgets around it tightened 2min→60s and 5min→2min, in the same commit that removed the original comment explaining why the wide interval/timeout mattered ("This test observes a full batch before checkpoint flushes the final buffered row. Keep a wide interval so a busy CI runner has enough time to observe that intermediate state."). This run's Milvus-touching jobs passed clean, so it isn't currently causing failures, but the margin has been cut substantially with no new comment justifying the tighter values, unlike every other timing change in this same commit (which are all carefully commented). Not blocking, but worth re-confirming isn't marginal under a loaded runner before merge.

The two new-regression sites (Issue A, Issue B) both make CI slower to fail, not faster: the fault-tolerance tests now burn the full 2-minute atMost on every run before reporting failure, versus a much faster failure before this helper existed.

1.4 Error Handling and Logging

Issue A's exception is well-formed and points at the real problem once you read past ConditionTimeoutException to its cause (AssertionError: Waiting for response on this thread is illegal), so diagnosis is reasonably fast. Issue B's AssertionFailedError message is clear but the pattern itself (assert-without-retry) is the actual defect — no logging fix substitutes for adding a wait.

  • Issue A (High, new) — FaultToleranceFakeSourceAssertions.java:43-67, used by ClusterFaultToleranceIT.java:456,851, SplitClusterFaultToleranceIT.java:514,967, ClusterFaultToleranceTwoPipelineIT.java:495: the new checkpoint-completion helper's RPC call throws AssertionError: Waiting for response on this thread is illegal on every poll in these embedded-cluster test classes; CI-reproduced, 5/5 exercised call sites fail deterministically at the full 2-minute budget. Raised by another reviewer: No.
  • Issue B (High, new) — RabbitmqIT.java:218-222,388-392: bare, non-retrying Assertions.assertTrue on broker message-count visibility immediately after publish; CI-reproduced, 10/21 parameterized instances fail. Raised by another reviewer: No.
  • Issue 5 (High, unresolved, carryover) — OracleCDCWithSchemaChangeIT.java:237-247: .ignoreExceptions() fix from round 2 resolved the retry-escape defect, but the block still fails deterministically at the full 20-minute budget with a genuine data-content mismatch (expected: <4> but was: <7>), reproduced identically 3x in this run. Raised by another reviewer: No.

2. Code Quality Assessment

2.1 Coding Standards

Consistent with prior rounds. The reverts in 0d2b7f585 (CommittedMetricsIT, MongodbCDCIT) are well-commented and explain why a sleep is being kept rather than converted — this is exactly the right way to close out a sleep that turns out to encode real timing semantics, not just readiness.

2.2 Test Coverage and Test Stability

Per-site status table for everything touched across all 4 commits (evidence above and in prior rounds):

Site File:Line Status CI Evidence (this run, 32140393043)
Aerospike AbstractAerospikeIT.java:82 Stable not in failure list
Oracle sibling A OracleCDCWithSchemaChangeIT.java:211 Stable passes in same run that fails at 237-247
Oracle sibling B OracleCDCWithSchemaChangeIT.java:237-247 High risk — still broken, new signature deterministic ConditionTimeout at full 20min budget, 3x reproduced
StarRocks StarRocksSchemaChangeIT.java:278 Stable not in failure list
Easysearch EasysearchIT.java:171,186,327 Stable not in failure list
Milvus MilvusIT.java (untilAsserted merge) Stable, reduced margin clean this run; timeouts/interval tightened without new justifying comment
Paimon PaimonSinkCDCIT.java:562,586,650 Stable paimon-connector-it (8 & 11) both success
CommittedMetricsIT CommittedMetricsIT.java (reverted to sleep) Stable not in failure list
MongodbCDCIT MongodbCDCIT.java (3 sites, reverted to sleep) Stable (sound revert) not exercised in this run's failures
NEW FaultTolerance helper FaultToleranceFakeSourceAssertions.java:43-67 + 5 call sites High risk — new, broken 5/5 exercised call sites fail deterministically, AssertionError: Waiting for response on this thread is illegal on every poll
NEW RabbitmqIT assertions RabbitmqIT.java:218-222,388-392 High risk — new, broken 10/21 parameterized instances fail

Overall rating: High risk. One previously-flagged issue remains genuinely unresolved (now with a deeper root cause than originally diagnosed), and the latest commit introduces two brand-new, CI-reproduced, deterministic regressions in code this PR itself added (the checkpoint-wait helper and the RabbitMQ visibility checks did not exist before this PR). This is the third consecutive round where fixing previously-reported issues has surfaced or introduced new failures in the same sweep, which reinforces my round-2 recommendation: this needs a full, deliberate pass (ideally with a project convention/helper for "poll a call that can legitimately throw before setup completes," and a firm rule of "every new condition-check must itself be an Awaitility poll, never a bare single-shot assertion") rather than continuing to fix one CI-reported failure at a time.

2.3 Documentation Updates

Not applicable — E2E test-only change.

3. Architectural Soundness

3.1 Elegance of the Solution

The core strategy remains sound, and this round shows real judgment improvements: recognizing that CommittedMetricsIT's and MongodbCDCIT's original sleeps encoded genuine timing semantics (not just readiness) and reverting them with clear comments, rather than forcing a condition-based rewrite that can't express "sample this specific transient window," is exactly the right call and a good sign for the PR's trajectory. The two new regressions are narrow and mechanical (a client-API choice mismatch in one, a missing wait wrapper in the other), not evidence the overall approach is wrong.

3.2 Maintainability

The new FaultToleranceFakeSourceAssertions.awaitCompletedCheckpoint helper is a good idea in principle — deliberately waiting for a durable checkpoint before killing nodes is more correct than the old "watch line count grow" pattern it partially supplements — but it was implemented without checking that the exact same requirement (awaitCompletedCheckpoint) was already solved correctly, twice, in sibling files in the same package (CheckpointRestoreWithStopIT, SavepointRestoreIT). Reusing or generalizing one of those existing implementations rather than introducing a third, RPC-based variant would have avoided this regression entirely.

3.3 Extensibility

Still no shared helper for "poll a call that can legitimately throw before setup finishes" (the pattern behind Oracle/StarRocks/Paimon in earlier rounds) or for "poll a call that isn't safe to invoke synchronously from this thread context" (the pattern behind Issue A here). Both are now confirmed to recur across multiple files; a documented project convention would reduce the odds of a 4th occurrence.

3.4 Historical-Version Compatibility

N/A — test-only, no serialization/checkpoint-format/config changes.

4. Issue Summary

# Severity Location Problem Status
1 (prior) High AbstractAerospikeIT.java:82 Container-ready race, no wait Fixed, CI-confirmed
2a (prior) High OracleCDCWithSchemaChangeIT.java:211 untilAsserted without .ignoreExceptions() Fixed, CI-confirmed
5 (prior, unresolved) High OracleCDCWithSchemaChangeIT.java:237-247 Sibling block: .ignoreExceptions() now applied, but test still fails deterministically — genuine data mismatch, not retry-escape Still broken — new failure signature, CI-confirmed
2b (prior) High StarRocksSchemaChangeIT.java:278 Same defect as 2a Fixed, CI-confirmed
3 (prior) High EasysearchIT.java:171,186,327 Wrong expected doc count Fixed, CI-confirmed
4 (prior) High CommittedMetricsIT.java + conf checkpoint.interval tuning couldn't make the conversion work Fixed — reverted to documented Thread.sleep, CI-confirmed
6 (prior) High PaimonSinkCDCIT.java:562,586,650 Missing .ignoreExceptions(), 3 sites Fixed, CI-confirmed
Low (prior) Low MilvusIT.java Non-atomic count-then-reread Fixed
A (new) High FaultToleranceFakeSourceAssertions.java:43-67 + 5 call sites New checkpoint-wait helper's RPC call throws on every poll in embedded-cluster tests New regression, CI-confirmed (5/5 exercised sites)
B (new) High RabbitmqIT.java:218-222,388-392 Bare non-retrying assertion races broker message-count visibility New regression, CI-confirmed (10/21 instances)
Note (non-blocking) Low MilvusIT.java / streaming-fake-to-milvus.conf Checkpoint interval/timeouts tightened 6x/2-2.5x without new justifying comment Clean this run, reduced margin

5. Merge Recommendation

Conclusion: Not recommended for merge

Blockers (must fix):

  1. OracleCDCWithSchemaChangeIT.java:237-247 — the "case1 add columns" verification block still fails deterministically at the full 20-minute budget with a genuine data mismatch (expected: <4> but was: <7>); .ignoreExceptions() fixed the retry mechanics but not the underlying race/ordering issue that the removed 40s upfront sleep + 10s pollDelay were apparently also covering.
  2. FaultToleranceFakeSourceAssertions.awaitCompletedCheckpoint (FaultToleranceFakeSourceAssertions.java:43-67) — reimplement on the existing REST/HTTP-based pattern already used correctly by CheckpointRestoreWithStopIT.awaitCompletedCheckpoint/SavepointRestoreIT.awaitCompletedCheckpoint in the same package, instead of the SeaTunnelClient RPC call that fails on every poll in these embedded-cluster test classes.
  3. RabbitmqIT.java:218-222,388-392 — wrap both message-visibility checks in Awaitility.await().untilAsserted(...) instead of a bare Assertions.assertTrue; the current single-shot check races broker propagation and fails ~50% of the time in this run.

Recommended (non-blocking): re-confirm MilvusIT's tightened checkpoint.interval/timeouts aren't marginal under a loaded runner, and add a comment explaining the new values the way every other timing change in this commit does; consider a shared helper/convention for "poll a call that may legitimately throw" and "poll a call that isn't safe to invoke synchronously from this thread" given both patterns have now caused regressions more than once in this same PR.

Overall assessment: Genuine, substantive progress again this round — 6 of 7 previously-flagged High issues are now fixed and CI-confirmed clean, including two (CommittedMetricsIT, MongodbCDCIT) resolved by the more mature move of reverting to a well-justified Thread.sleep rather than forcing an ill-fitting condition-based rewrite. However, the PR's own fork CI is still red for this head, and this round's newest commit — intended to close out the remaining issues — introduced two new, deterministic, CI-confirmed regressions of its own (the checkpoint-wait helper and the RabbitMQ visibility checks), on top of leaving one previously-flagged site still broken with a now-different root cause. Given the PR's explicit goal is CI stability, and every regression discussed above is deterministic (not a flaky/one-off failure) and traced to a specific line in this diff, one more iteration is needed before this is ready to come off draft.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the continued iteration on this — re-reviewed the current head 57ea7356c13f3da2d40c724613639d8799ac20fa, which adds one new commit (57ea7356c — [Fix][E2E] Fix condition-based wait failures) on top of the previously-reviewed 0d2b7f585 (my 2026-08-19T04:30:34Z review, which left 3 High blockers open). The 6 commits in between are just dev catching up (merged in via 88cc80342) plus the new fix commit itself; the PR's own diff footprint against dev is unchanged at 57 files, still entirely under seatunnel-e2e/**.

Verdict up front: 2 of the 3 previous blockers are now genuinely fixed and CI-confirmed clean. The 3rd (FaultToleranceFakeSourceAssertions.awaitCompletedCheckpoint) is still broken — same 5 call sites, identical error message, CI-reproduced again on this head — and tracing the failure into seatunnel-engine-server shows the client-side fix in this commit could not have worked, because the "illegal wait" is thrown on the server side, inside the operation itself, not on whatever thread the client polls from.

All CI evidence below is from the fork's own workflow run for this exact head (nzw921rx/seatunnel, run 32218637781), cross-checked job-by-job via the Actions API and job logs, not just the top-level pass/fail badge.

What Problem Does This PR Solve?

  • User pain point: the E2E suite relies heavily on fixed Thread.sleep(...) to wait for async state (container readiness, job RUNNING, CDC propagation, checkpoint commits, cluster membership, etc.), which is either too short on a loaded CI runner (flaky failure) or wastes CI time when the runner is fast.
  • Fix approach: replace most of these sleeps across ~58 E2E files with Awaitility condition-based waits (await()/during()), keeping a sleep only where elapsed time is genuinely part of the test semantics.
  • One-sentence summary: a large, mostly-correct mechanical sweep that is being iteratively hardened round by round as fork CI exposes the handful of conversions that don't yet capture the real readiness signal.

1. Code Change Review

1.1 Core Logic Analysis

This commit targets exactly the 3 blockers from my previous review, one file each.

Site A — OracleCDCWithSchemaChangeIT.java:210-223 (previously "Oracle sibling / Issue 5") — FIXED, CI-confirmed

Before (0d2b7f585, still broken — expected: <4> but was: <7> at the full 20-minute timeout):

await().ignoreExceptions()
        .atMost(300, TimeUnit.SECONDS)
        .untilAsserted(() -> checkData(QUERY, sourceJdbcUrl, sinkJdbcUrl, sinkSchemaName, sinkTableName, oracle2Mysql));
// case1 add columns with cdc data at same time
createAndInitialize("add_columns", CONNECTOR_USER, CONNECTOR_PWD);

After (57ea7356c):

// Matching snapshot rows alone does not guarantee that Oracle LogMiner has entered the
// streaming phase. Keep the initial state stable before issuing the first DDL batch so
// changes made between snapshot completion and streaming startup are not missed.
await().ignoreExceptions()
        .during(10, TimeUnit.SECONDS)
        .atMost(300, TimeUnit.SECONDS)
        .untilAsserted(() -> checkData(QUERY, sourceJdbcUrl, sinkJdbcUrl, sinkSchemaName, sinkTableName, oracle2Mysql));
// case1 add columns with cdc data at same time
createAndInitialize("add_columns", CONNECTOR_USER, CONNECTOR_PWD);

This doesn't touch the actually-failing "case1 add columns" verification block at lines 237-247 at all — instead it makes the initial snapshot-match check require the condition to hold continuously for 10 seconds before the test proceeds to issue the add_columns DDL. That's the correct diagnosis I hypothesized last round: the removed 40s upfront sleep and 10s pollDelay weren't (only) buffering "table not created yet," they were also giving Oracle LogMiner time to actually enter streaming/log-mining mode before the next DDL+DML batch landed. A single-shot match doesn't prove that; requiring the match to be stable for 10s is a reasonable proxy for "the pipeline isn't still catching up." CI proof: oracle-cdc-connector-it job — both matrix shards (JDK 8 and 11) report Tests run: 2, Failures: 0, Errors: 0 for OracleCDCWithSchemaChangeIT (166.5s and 201.3s respectively), where the same class previously failed deterministically in ~1220s (full 20-minute budget) with the row-count mismatch. This is a real fix, not just a longer timeout — the test now converges well inside the original budget.

Site B — RabbitmqIT.java:218-231, 397-410 (previously "Issue B") — FIXED, CI-confirmed

Before:

initSourceData(sourceClient);
Assertions.assertTrue(
        sourceClient.getChannel().queueDeclarePassive(sourceQueueName).getMessageCount()
                >= TEST_DATASET.getValue().size(),
        "Source messages must be visible to the broker before the job starts");

After:

initSourceData(sourceClient);
Awaitility.await()
        .atMost(Duration.ofSeconds(30))
        .pollInterval(Duration.ofMillis(200))
        .untilAsserted(
                () -> Assertions.assertTrue(
                        sourceClient.getChannel().queueDeclarePassive(sourceQueueName).getMessageCount()
                                >= TEST_DATASET.getValue().size(),
                        "Source messages must be visible to the broker before the job starts"));

(same pattern applied to the multi-table sendData helper's message-visibility check). This wraps what was previously a bare, non-retrying assertion racing broker propagation in a proper poll. Unlike the Oracle/Paimon .ignoreExceptions() cases from earlier rounds, this one doesn't need .ignoreExceptions(): queueDeclarePassive is called against a queue that was already actively declared earlier in the same method (RabbitmqIT.java:216/:373), so it isn't racing "does the queue exist yet" the way the Oracle/Paimon table-creation checks were — it's purely waiting for the already-existing queue's message count to catch up, which is exactly what assertTrue+untilAsserted is designed for. CI proof: all-connectors-it-2 — both shards report Tests run: 21, Failures: 0, Errors: 0 — in RabbitmqIT (previously 10/21 failed on this exact assertion).

Site C — FaultToleranceFakeSourceAssertions.java:53-79 (previously "Issue A") — STILL BROKEN, CI-reproduced, root cause misdiagnosed by the fix

Before:

Awaitility.await()
        .atMost(2, TimeUnit.MINUTES).pollInterval(1, TimeUnit.SECONDS).ignoreExceptions()
        .until(() -> {
            CheckpointOverview overview = engineClient.createJobClient().getCheckpointOverview(jobId);
            return overview.getPipelines().size() >= expectedPipelineCount
                    && overview.getPipelines().values().stream().allMatch(p -> p.getCounts().getCompleted() > 0L);
        });

After:

ExecutorService checkpointPoller = Executors.newSingleThreadExecutor();
try {
    // Hazelcast client RPC blocks while waiting for the response and must not run on a
    // Hazelcast-managed thread.
    Awaitility.with()
            .pollExecutorService(checkpointPoller)
            .atMost(2, TimeUnit.MINUTES).pollInterval(1, TimeUnit.SECONDS).ignoreExceptions()
            .until(() -> { /* same body */ });
} finally {
    checkpointPoller.shutdownNow();
}

The intent is reasonable (isolate the RPC-issuing poll onto a plain, non-Hazelcast thread, cleaned up correctly in finally — no executor leak), but it treats the wrong side of the problem. I re-ran the fork CI for this exact head and the failure is byte-for-byte identical to last round:

[ERROR] Tests run: 9, Failures: 0, Errors: 2, ... in ClusterFaultToleranceIT
[ERROR] testStreamJobRestoreInAllNodeDown  Time elapsed: 137.151 s  <<< ERROR!
[ERROR] testStreamJobRestoreIn2NodeWorkerDown  Time elapsed: 133.822 s  <<< ERROR!
...
[ERROR] Tests run: 8, Failures: 0, Errors: 2, ... in SplitClusterFaultToleranceIT
[ERROR] Tests run: 7, Failures: 0, Errors: 1, ... in ClusterFaultToleranceTwoPipelineIT

5/5 exercised call sites still fail, all ConditionTimeout at the full 2-minute budget. Reading the server-side log (not just the client stack trace) shows exactly where this actually breaks:

[localhost]:5801 [...] ERROR org.apache.seatunnel.engine.server.operation.GetCheckpointOverviewOperation - Waiting for response on this thread is illegal
java.lang.AssertionError: Waiting for response on this thread is illegal

This is logged by the server, from inside GetCheckpointOverviewOperation.run() (seatunnel-engine/seatunnel-engine-server/.../operation/GetCheckpointOverviewOperation.java:47-53), which calls CheckpointMonitorService.getOverview(jobId) → HazelcastCheckpointOverviewStateStore.get(Long) (.../statestore/checkpoint/hazelcast/HazelcastCheckpointOverviewStateStore.java:63-64), which does overviewMap.get(jobId) on a Hazelcast IMap. IMap.get() is itself a synchronous Hazelcast invocation: if the calling node isn't the partition owner for that key, it has to make a remote call and block for the response — which is precisely what Hazelcast's "must not block on this thread" guard exists to prevent when the caller is already an operation-execution thread. In other words: the assertion fires because GetCheckpointOverviewOperation (a Hazelcast Operation) does a nested blocking IMap.get() from inside its own run(), and during these specific fault-tolerance tests (which are deliberately killing/restarting cluster nodes) the target partition is frequently not locally owned. This is a characteristic of production code this PR doesn't touch (GetCheckpointOverviewOperation/HazelcastCheckpointOverviewStateStore), not of which thread the client happens to poll from — so moving the client-side poll to a dedicated ExecutorService cannot fix it, and CI now proves that directly (identical failure, same error, same 5 sites, before and after this fix attempt).

The two sibling helpers already in the same package avoid this entirely by not going through this RPC path at all:

// CheckpointRestoreWithStopIT.java:129 / SavepointRestoreIT.java:127 (untouched by this PR)
Awaitility.await().atMost(2, TimeUnit.MINUTES)
        .untilAsserted(() -> Assertions.assertTrue(getCompletedCheckpointCount(jobId) > 0));

where getCompletedCheckpointCount goes through the REST endpoint instead of engineClient.createJobClient().getCheckpointOverview(...). This is still the right direction (as I said last round), and now there's direct server-log evidence for why it's the right direction, not just "it happens to work elsewhere."

1.2 Compatibility Impact

Fully compatible. Test-only change; confirmed via git diff --stat against dev that all 57 changed files remain under seatunnel-e2e/**. No production code, public API, SPI, or config-option changes. No docs/en/docs/zh update required.

1.3 Performance / Side-Effect Analysis

Sites A and B are net positive: Oracle CDC schema-change now converges well inside its budget instead of burning the full 20 minutes, and RabbitMQ message-visibility now resolves in well under its 30s budget on a healthy run instead of failing instantly. Site C is unchanged in failure cost — still burns the full 2-minute atMost on every one of the 5 exercised call sites before reporting failure. The ExecutorService in Site C is properly scoped and shut down in finally, so there's no thread leak from the fix attempt itself, just no functional improvement.

1.4 Error Handling and Logging

Nothing new to flag beyond Issue 1 below — the systemic .ignoreExceptions() gap flagged in earlier rounds appears fully closed now (Oracle, StarRocks, Easysearch, Paimon all confirmed clean this round).

Issue 1 (High, unresolved carryover — corrected diagnosis) — seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/FaultToleranceFakeSourceAssertions.java:53-79, used by ClusterFaultToleranceIT.java:456,851, SplitClusterFaultToleranceIT.java:514,967, ClusterFaultToleranceTwoPipelineIT.java:495: the new awaitCompletedCheckpoint RPC path still fails deterministically in these embedded-cluster fault-tolerance tests. The pollExecutorService change addresses the wrong thread — the "Waiting for response on this thread is illegal" assertion is thrown server-side inside GetCheckpointOverviewOperation.run() (production code, not touched by this PR) when its nested IMap.get() call has to block for a non-locally-owned partition, not by whichever thread issues the client-side poll. CI-reproduced identically to the previous round: 5/5 exercised call sites, ConditionTimeout at the full 2-minute budget. Raised by another reviewer: No.

2. Code Quality Assessment

2.1 Coding Standards

Clean, minimal, well-commented fix commit — the Oracle comment explains the LogMiner-streaming rationale, the RabbitMQ change is a straightforward wrap, and the FaultToleranceFakeSourceAssertions change is at least commented with its (incorrect, but reasonable-looking) hypothesis, which made it easy to check against the server log.

2.2 Test Coverage and Test Stability

Per-site status, all backed by this round's fork CI run (32218637781) unless noted:

Site File:Line Status CI Evidence
Oracle CDC schema-change OracleCDCWithSchemaChangeIT.java:210-223 Stable both shards: Tests run: 2, Failures: 0, Errors: 0
RabbitMQ visibility RabbitmqIT.java:218-231,397-410 Stable both shards: Tests run: 21, Failures: 0, Errors: 0
Fault-tolerance checkpoint wait FaultToleranceFakeSourceAssertions.java:53-79 High risk — still broken 5/5 exercised call sites fail deterministically, server-side AssertionError: Waiting for response on this thread is illegal reproduced
Everything from earlier rounds (Aerospike, StarRocks, Easysearch, Milvus, Paimon, CommittedMetricsIT, MongodbCDCIT) — Stable, unchanged not touched by this commit; not in this run's failure list

Overall rating: High risk, carried forward from the previous two rounds — Site C remains a formal blocker. Everything else in this large diff continues to check out cleanly.

Two additional CI observations from this run, not part of this PR's diff and not counted as blockers, disclosed for transparency since the fork's overall CI is still red:

  • jdbc-connectors-it-ddl (8): DmSchemaChangeIT failed; that file is untouched by this PR, and the sibling shard (jdbc-connectors-it-ddl (11)) passed clean — looks like unrelated flakiness.
  • all-connectors-it-7 (11): PostgresCDCIT.testPostgresCdcSnapshotOnlyAndCommittedOffsetStartupModes failed, but the actual failure (PostgresCDCIT.java:489/491) is inside a pre-existing await().atMost(30000, MILLISECONDS) block waiting for replication-slot LSN catch-up — a block this PR does not touch at all (the PR's own change to this method is a different block, a few lines earlier, and that one is fine). The sibling shard passed clean. Looks like unrelated LSN-catchup timing flakiness under a loaded runner, not a regression from this diff.

Also note: elasticsearch-connector-it and jdbc-connectors-it-part-1 — both host files this PR does touch (ElasticsearchIT, ElasticsearchAuthIT, ElasticsearchSchemaChangeIT, JdbcSinkBatchIntervalIT) — were cancelled, not completed, in this run (both matrix shards, for reasons outside this diff — most likely the fork's workflow-level job orchestration/timeout given engine-v2-it failed and other jobs ran for hours). That means this round has no fresh pass/fail signal for those files; they weren't flagged as broken in any earlier round either, so I'm not treating the cancellation itself as a regression signal, just noting it so a clean run there isn't assumed without evidence.

2.3 Documentation Updates

Not applicable — E2E test-only change.

3. Architectural Soundness

3.1 Elegance of the Solution

Sites A and B are precise, well-targeted fixes that match the actual failure mechanism (a stability window for the LogMiner race, a proper poll for broker propagation). Site C is a plausible-looking fix for the wrong layer — the underlying assumption ("the calling thread must be a Hazelcast-managed thread") wasn't verified against the actual server-side stack trace before landing, which is exactly the kind of thing this round's CI check was for.

3.2 Maintainability

Once Site C is corrected, this file is in the same good shape as the rest of the sweep. Worth flagging for whoever picks this up: the fix should follow the existing, already-working pattern in CheckpointRestoreWithStopIT/SavepointRestoreIT in the same package rather than a fourth attempt at the RPC path — those two helpers already solve "wait for a durable checkpoint" for the exact same class of test.

3.3 Extensibility

No change from last round's note — a shared awaitCompletedCheckpoint helper reused across ClusterFaultToleranceIT, SplitClusterFaultToleranceIT, ClusterFaultToleranceTwoPipelineIT, CheckpointRestoreWithStopIT, and SavepointRestoreIT (there are effectively two competing implementations of the same wait right now) would prevent this exact defect from being reintroduced a second time.

3.4 Historical-Version Compatibility

N/A — test-only, no serialization/checkpoint-format/config changes.

4. Issue Summary

# Severity Location Problem Status
Oracle (prior, unresolved) High OracleCDCWithSchemaChangeIT.java:210-223 Sibling "case1 add columns" data mismatch Fixed, CI-confirmed (2/2 both shards)
RabbitMQ (prior "Issue B") High RabbitmqIT.java:218-231,397-410 Bare non-retrying assertion races broker propagation Fixed, CI-confirmed (21/21 both shards)
1 (prior "Issue A", unresolved) High FaultToleranceFakeSourceAssertions.java:53-79 Checkpoint-wait RPC throws AssertionError: Waiting for response on this thread is illegal; fix targeted the wrong thread (server-side operation thread, not client poll thread) Still broken, CI-confirmed (5/5 exercised sites)

5. Merge Recommendation

Conclusion: Not recommended for merge

Blockers (must fix):

  1. FaultToleranceFakeSourceAssertions.awaitCompletedCheckpoint (FaultToleranceFakeSourceAssertions.java:53-79) — the pollExecutorService change doesn't address the actual failure. The "illegal wait" assertion fires server-side, inside GetCheckpointOverviewOperation.run() → HazelcastCheckpointOverviewStateStore.get() → IMap.get(), when the target partition isn't locally owned during these node-kill scenarios. Reimplement on the same REST-based pattern already used successfully by CheckpointRestoreWithStopIT.awaitCompletedCheckpoint/SavepointRestoreIT.awaitCompletedCheckpoint in the same package, rather than the SeaTunnelClient RPC call — no client-side threading change can work around a server-side operation-thread guard.

Recommended (non-blocking, carried over from earlier rounds, still unaddressed): MilvusIT's tightened checkpoint.interval/timeouts (6x/2-2.5x tighter than the original values) still don't have a comment explaining the new margin the way every other timing change in this sweep does; consider a shared awaitCompletedCheckpoint helper across the 5 fault-tolerance/checkpoint-restore test classes mentioned above to prevent a second implementation of the same wait from drifting again.

Overall assessment: genuine, continued progress — this round correctly closes out 2 of the last 3 blockers, both confirmed by a clean CI pass (Oracle CDC schema-change 2/2, RabbitMQ 21/21), and the Oracle fix in particular reflects a deeper, correct diagnosis of the LogMiner-streaming race rather than a superficial timeout bump. The one remaining item just needs to go through the same REST-based mechanism that's already proven out twice in the same test package — that should be a small, mechanical change given the pattern already exists. Also worth being aware of, though not part of this PR's diff: elasticsearch-connector-it and jdbc-connectors-it-part-1 (both host files this PR touches) were cancelled rather than completed in this run, so they don't currently carry a fresh clean signal either way, and DmSchemaChangeIT/one PostgresCDCIT case failed in blocks outside this PR's changes, most likely flakiness unrelated to this diff. Once Site C is fixed and a clean fork CI run confirms it, this looks close to ready to come off draft.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the continued iteration — re-reviewed the current head 3967ffd6b, which adds one new content commit (b37e087bc — [Improve][E2E] Clarify intentional time-based waits) on top of the previously-reviewed 57ea7356c (my 2026-08-19T10:48:50Z review, which left the FaultToleranceFakeSourceAssertions.awaitCompletedCheckpoint issue open as the 3rd blocker). The rest of the diff footprint against that head is just dev catching up via a merge commit (Neo4j close-on-failure fix, Milvus JSON-root fix, decimal-transform precision fix, CI fail-fast flag, CDC field-ordering fix, Parquet/ORC writer-close-on-roll fix, Jackson-shading revert) — none of it is this PR's own content, so I've excluded it from this review, consistent with prior rounds.

Verdict up front: the 3rd blocker is now resolved — but not by making the broken condition-based wait work. Instead, the commit removes awaitCompletedCheckpoint entirely and reverts the 5 call sites to the exact same fixed-duration sleep that dev already uses today, byte-for-byte, at the same logical position. I verified this precisely against origin/dev below. Given the constraint I identified last round (the "illegal wait" is thrown server-side, inside the Hazelcast operation itself, not reachable from a client-side executor fix), reverting to the known-stable dev baseline is the right call, not a regression.

What Problem Does This PR Solve?

  • User pain point: the E2E suite relies heavily on fixed Thread.sleep(...) to wait for async state, which is flaky under CI load or wastes CI time when the runner is fast.
  • Fix approach: replace most such sleeps across ~58 E2E files with Awaitility condition-based waits, keeping a sleep only where elapsed time is genuinely part of the test semantics or where a safe condition doesn't exist.
  • This round: give up on converting the awaitCompletedCheckpoint spots to a condition-based wait (the underlying RPC has a real server-side incompatibility with the caller context, diagnosed last round) and instead cleanly revert those 5 call sites to dev's original fixed-sleep values, with explanatory comments replacing the removed helper.

1. Code Change Review

1.1 Core Logic Analysis

FaultToleranceFakeSourceAssertions.java: awaitCompletedCheckpoint(SeaTunnelClient, long) and its 3-arg overload are deleted outright (44 lines removed), along with their now-unused imports (SeaTunnelClient, CheckpointOverview, Awaitility, ExecutorService/Executors). Nothing else in the file changes — the unrelated sleep(long) private helper used by the output-stability polling loop keeps its exact behavior, just with a clarifying comment and TimeUnit.MILLISECONDS.sleep(...) instead of Thread.sleep(...) (functionally identical).

5 call sites updated (ClusterFaultToleranceIT.java x3, ClusterFaultToleranceTwoPipelineIT.java x1, SplitClusterFaultToleranceIT.java x2 — one of the two SplitClusterFaultToleranceIT hunks also touches the trailing "settle after full shutdown" sleep): each FaultToleranceFakeSourceAssertions.awaitCompletedCheckpoint(...) call is replaced with TimeUnit.SECONDS.sleep(5) (functionally Thread.sleep(5000)), plus, at the 3 "shut down all nodes and recreate them" spots, an additional TimeUnit.SECONDS.sleep(10) after the "All node is done" log line, before the replacement SeaTunnelServerStarter.createHazelcastInstance/createMasterHazelcastInstance calls.

I diffed every touched line against origin/dev directly (not just against the previous PR round) to confirm this is a true revert, not a new value:

$ git show origin/dev:.../ClusterFaultToleranceIT.java | grep -n 'Thread.sleep'
461:            Thread.sleep(5000);
850:            Thread.sleep(5000);
858:            Thread.sleep(10000);
1073:           Thread.sleep(5000);
1080:           Thread.sleep(10000);

$ git show origin/dev:.../ClusterFaultToleranceTwoPipelineIT.java | grep -n 'Thread.sleep'
500:            Thread.sleep(5000);

$ git show origin/dev:.../SplitClusterFaultToleranceIT.java | grep -n 'Thread.sleep'
517:            Thread.sleep(5000);
966:            Thread.sleep(5000);
976:            Thread.sleep(10000);
1003:           Thread.sleep(10000);

Every duration and position in the new commit matches these dev values exactly (5000ms before shutting down a worker/all nodes, 10000ms after "All node is done" before recreating instances). The awaitCompletedCheckpoint helper never existed on dev at all — it was introduced earlier in this PR's own history as an attempted improvement, turned out to be broken (server-side IllegalStateException/blocking-IMap-lookup-on-a-Hazelcast-operation-thread, as I traced last round), and this commit's fix is to cleanly back it out rather than patch around a constraint that can't be safely worked around from the client side.

Why this is the correct fix, not a punt that reintroduces risk: my initial reaction to a fixed sleep(5) immediately preceding a checkpoint.interval = 5000 job (confirmed in cluster_batch_fake_to_localfile_template.conf and cluster_batch_fake_to_localfile_two_pipeline_template.conf, both used by these 3 test classes) was that a 5-second wait with zero margin against a 5-second checkpoint interval looks race-prone. But since this exact value, exact duration, and exact position already exists on dev today — unchanged by this PR — it carries no additional risk versus the status quo. If this timing were genuinely unreliable, that would be a pre-existing dev flakiness issue orthogonal to this PR, not something introduced here. This PR is not obligated to fix everything; reverting a broken new mechanism back to a known, currently-stable baseline is the conservative, correct choice.

The comments explaining why a condition can't replace the sleep here are accurate and specific: HTTP is disabled in these embedded tests (so the REST checkpoint-overview endpoint isn't available), and the RPC path (engineClient.createJobClient().getCheckpointOverview(jobId)) is what triggered the illegal blocking IMap lookup when polled from certain call contexts — consistent with what I traced last round.

1.2 Compatibility Impact

Fully compatible — this is a test-only revert to pre-existing dev runtime behavior for these 5 sites, plus comment-only clarifications everywhere else in this commit (MysqlCDCSpecificStartingOffsetIT, MysqlCDCStopModeSpecificIT, LocalFileIT, InMemorySinkWriter, CheckpointableSequenceSourceReader, InMemorySourceReader, CommittedMetricsIT — all Thread.sleep(x) → TimeUnit.<UNIT>.sleep(x), which is functionally identical, plus explanatory comments). No production code touched.

1.3 Performance / Side-Effect Analysis

No new side effects. Total elapsed time for the affected fault-tolerance tests is unchanged from dev (same sleep durations, same positions).

1.4 Error Handling and Logging

No new issues this round. The one open item from earlier rounds (Site A, Oracle CDC snapshot-stability wait) was already confirmed fixed in the prior round and is untouched by this commit.

2. Code Quality Assessment

2.1 Coding Standards

Clean, minimal diff. Removed imports are genuinely unused (SeaTunnelClient, CheckpointOverview, Awaitility, Executors/ExecutorService no longer referenced in FaultToleranceFakeSourceAssertions.java after the deletion). Comments are specific and explain why a sleep is unavoidable rather than restating what the code does — good practice for exactly the kind of "why can't this be a condition" question a future maintainer would ask.

2.2 Test Coverage and Test Stability

Stable, matching dev's existing behavior exactly for the 5 reverted call sites — no new flakiness risk introduced, and the previous round's CI-reproduced failure (the illegal-wait exception from the broken awaitCompletedCheckpoint) is eliminated by removing the mechanism that caused it. The other 7 files in this commit are comment/API-cosmetic only (Thread.sleep → TimeUnit.X.sleep), zero behavioral change, zero new risk.

I was not able to fully confirm CI green for this exact head at review time — the fork's own Actions run for 3967ffd6b (nzw921rx/seatunnel, run 32333874247) was still in_progress when I checked. Given the change here is either an exact revert to already-passing dev behavior or a pure comment/API-cosmetic edit, I have high confidence it will pass, but worth a final glance once it completes.

2.3 Documentation Updates

N/A — no user-facing behavior change.

3. Architectural Soundness

3.1 Elegance of the Solution

Correct engineering judgment: rather than continuing to chase a client-side fix for a server-side constraint, this commit removes the broken abstraction and falls back to the known-good baseline, with clear comments documenting why. It's honest about not achieving "condition-based" for this specific spot, which is the right call given the underlying engine limitation (HTTP disabled + RPC-thread-context incompatibility) rather than a gap in this PR's effort.

3.2 Maintainability

Improved via the explanatory comments — a future contributor attempting to "fix" this sleep again will immediately understand why a naive condition-based replacement was already tried and reverted, saving them from re-diagnosing the same server-side issue.

3.3 Extensibility

N/A for this narrow fix; if the engine ever exposes a safe, non-HTTP, non-operation-thread-blocking way to query checkpoint completion, these 5 sites are the natural candidates to revisit (the comments say so explicitly).

3.4 Historical-Version Compatibility

Unaffected — no production code, no serialization/checkpoint/state format touched, purely test-code timing/comments.

4. Issue Summary

No open issues this round. Previous rounds' 3 blockers are now all resolved:

  1. Oracle CDC snapshot-stability wait (Site A) — fixed in prior round, confirmed again this round (untouched).
  2. (other prior-round site, already confirmed fixed last round, untouched this round).
  3. FaultToleranceFakeSourceAssertions.awaitCompletedCheckpoint — resolved this round by reverting to dev's exact known-stable fixed-sleep baseline rather than continuing to chase the broken RPC-based condition.

5. Merge Recommendation

Conclusion: Ready to merge

Blockers — must be fixed: none remaining that I can find. All 3 blockers from my previous rounds are now resolved, the last one via a well-reasoned, precisely-verified revert to dev's existing stable behavior rather than a genuine (but currently unsafe) condition-based replacement.

Recommended fixes — non-blocking:

  • None from me. If a future engine change exposes a safe way to observe checkpoint completion without HTTP and without the Hazelcast-operation-thread constraint, the 5 reverted sites in ClusterFaultToleranceIT/ClusterFaultToleranceTwoPipelineIT/SplitClusterFaultToleranceIT would be worth revisiting — but that's future work, not a gap in this PR.

This is a draft PR and CI (Build) was still in progress on this head at review time — since the substantive content here is either an exact revert to already-green dev behavior or comment/API-cosmetic only, I'd expect it to pass, but please confirm green before flipping out of draft. Really solid iteration across all the review rounds — good call giving up on the broken client-side fix and being upfront about the engine-level constraint instead of forcing a fragile workaround.

@nzw921rx
nzw921rx marked this pull request as ready for review August 20, 2026 10:41
@nzw921rx nzw921rx self-assigned this Aug 20, 2026
@nzw921rx
nzw921rx requested a review from davidzollo August 20, 2026 10:47
@nzw921rx
nzw921rx marked this pull request as draft August 20, 2026 12:47

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What Problem Does This PR Solve?

  • User pain point: the E2E suite relies heavily on fixed Thread.sleep(...) to wait for async state (container readiness, job RUNNING, CDC propagation, checkpoint commits, cluster membership, etc.), which is either too short on a loaded CI runner (flaky failure) or wastes CI time when the runner is fast.
  • Fix approach: replace most of these sleeps across ~59 E2E files with Awaitility condition-based waits, keeping a sleep only where elapsed time is genuinely part of the test semantics (documented case by case).
  • One-sentence summary: a large, iteratively-hardened mechanical sweep of E2E timing debt that has already gone through 6 review rounds; this is round 7, re-reviewing the 2 newest commits on top of my prior APPROVED review.

1. Code Change Review

1.1 Core Logic Analysis

This is a re-review after a new commit. I previously reviewed and APPROVED this PR at head 3967ffd6b (2026-08-20T10:40:18Z), noting CI was still in_progress at that time and asking for a green confirmation before it comes off draft. Since then, two more commits landed and the current head is 8b46105071:

  • 686e90f3b7 — [Fix][E2E] fix flaky test (widens PostgresCDCIT's savepoint-restore wait 120s→5min; adds TestContainerId.FLINK_1_18 to DatabendCDCSinkIT's existing @DisabledOnContainer)
  • 8b46105071 — [Fix][E2E] Fix Elasticsearch condition waits (fixes wrong expected doc counts in ElasticsearchIT/ElasticsearchAuthIT, widens ElasticsearchSchemaChangeIT's wait)

I re-verified these two commits from scratch rather than trusting the prior approval, and separately spot-checked that the already-approved parts of the diff (Aerospike, StarRocks, Easysearch, Paimon, Oracle CDC, RabbitMQ, CommittedMetricsIT, MongodbCDCIT, the fault-tolerance checkpoint-wait revert) are untouched by these 2 commits, so I'm not re-flagging any of that — all of it remains correctly resolved per my last 4 rounds of review.

PostgresCDCIT.java:611 — timeout widen, correct and low-risk

await().atMost(120, SECONDS) → await().atMost(5, MINUTES) for the savepoint-restore-then-reconnect-replication-slot wait, with a comment explaining the rationale (pipeline rebuild + replication reconnect can exceed 2 minutes on a shared runner). This is a pure timeout widening on an already condition-based wait — no logic change, no correctness risk, consistent with the pattern used elsewhere in this PR.

DatabendCDCSinkIT.java:75 — @DisabledOnContainer widened to include FLINK_1_18 (Medium, non-blocking, needs evidence)

dev already disables this test for FLINK_1_15 with reason "the CDC job can exit successfully while sink_table remains empty." This commit adds FLINK_1_18 with an analogous but more specific reason ("the CDC writer can finish successfully while the global committer does not execute the final MERGE"). I checked: none of this PR's earlier commits touch the CDC/commit logic in this test or in the Databend sink itself — the only prior change to this file (cc667fb94c) touched MinIO bucket-creation waiting and teardown ordering, unrelated to the commit path. So this disable is very plausibly pre-existing Flink 1.18 flakiness that surfaced independently, not a regression introduced by this PR. That said, the review body/commit message doesn't cite a CI run or failure log for the 1.18 case the way most other fixes in this PR do, so I can't independently confirm it the way I could for the other ~10 issues raised across previous rounds (all of which had CI-log citations). Non-blocking, but worth a one-line pointer to the failing run in the PR description for traceability.

ElasticsearchAuthIT.java — awaitIndexDocsCount → awaitIndexDocsCountAtLeast (Fixed, correct)

Renamed and changed the predicate from == expectedCount to >= minimumCount for the 4 call sites that seed data via direct index inserts. This is the right fix: an exact-equality wait on a "did my setup write land" check is fragile if the target index already has leftover documents from a previous parameterized run or if ES briefly over-reports during a refresh; >= correctly expresses "at least my batch has landed" without weakening the assertions that actually check business correctness (those still use exact assertEquals/assertIterableEquals downstream, unaffected by this rename).

ElasticsearchIT.java — FILTERED_DOCUMENT_COUNT = 11 (Fixed, correct, same defect class as the Easysearch/StarRocks/Oracle bugs found in rounds 1-2)

Six call sites (readSinkDataWithSchema, readSinkDataWithOutSchema x2, and the multi-source-by-filter test) previously awaited testDataset1.size()/testDataset2.size() (the full, unfiltered dataset size) against sink indices that are actually populated by a source-side range filter (c_int in [10,20], confirmed by reading mapTestDatasetForDSL(), which applies cInt >= 10 && cInt <= 20 — exactly 11 rows for a contiguous 0-99 dataset). This is the identical bug pattern to Issue 3 (EasysearchIT) that I flagged and confirmed fixed back in round 2 — same root cause (awaiting the wrong, unfiltered count), just a different connector's test file that wasn't touched until now. Replacing the wrong testDataset1.size() with the correct, constant 11 fixes a condition that could previously never converge and would always burn the full 2-minute budget before continuing (silently) to assert against whatever partial/stale data happened to be present.

One maintainability nit carried over from my round-2 suggestion for the sibling EasysearchIT fix: FILTERED_DOCUMENT_COUNT is a hardcoded magic constant duplicated across 6 call sites, rather than being derived from mapTestDatasetForDSL().size() the way EasysearchIT's equivalent fix was done. If generateTestDataSet1()'s value range or the query's gte/lte bounds ever change, this constant will silently drift out of sync. Non-blocking, but the more robust version already exists in this same PR as a template (EasysearchIT.awaitIndexDocsCount(indexName, mapTestDatasetForDSL().size())).

ElasticsearchIT.java:810 — readSinkDataWithNestSchema: awaitIndexDocsCount(index, 1) → awaitIndexDocsCount(index, 3) (Correct semantic fix, but still failing in fork CI — see below)

New comment: "Elasticsearch's docs.count includes the root document and its two nested documents." I confirmed this against the test's own assertion — testElasticsearchWithNestSchema expects a single logical row containing 2 nested address entries, and Elasticsearch's nested field type indexes each nested object as its own hidden Lucene document alongside the root, so docs.count for one logical row genuinely is 3. dev's original code didn't await any count at all here (just Thread.sleep(INDEX_REFRESH_MILL_DELAY)); this PR's first sweep commit introduced the wrong constant (1), and this commit's fix to 3 is the logically correct value.

However, this exact test is still failing in the PR's own fork CI on the current head, and not with an off-by-one on the threshold — with expected: <3> but was: <0> (ElasticsearchIT.java:1146/810/452, testElasticsearchWithNestSchema[2,3,4], ConditionTimeoutException after the full 2-minute budget). testElasticsearchWithoutSchema fails the same way at the corrected FILTERED_DOCUMENT_COUNT=11 threshold (expected: <11> but was: <0>, one instance <11> but was: <10>). "Was 0" means no documents were ever observed in the target index for that run, not a threshold miscalculation — i.e., this specific fix commit does not yet make its own target test suite pass. See Issue 1 below.

1.2 Compatibility Impact

Fully compatible. git diff --stat against dev confirms every changed file across the full PR (including both new commits) is under seatunnel-e2e/**; no production code, public API, SPI, or config-option changes. No docs/en/docs/zh update required.

1.3 Performance / Side-Effect Analysis

The two timeout widenings (PostgresCDCIT 120s→5min, ElasticsearchSchemaChangeIT 2min→5min) are consistent with the established pattern in this PR: correctly-shaped condition waits that just need more headroom on shared runners. Net effect on healthy runs is unchanged (condition still resolves as soon as met); on a genuinely broken build these two spots will now take longer to report failure, which is the same trade-off already accepted and reviewed for a dozen other spots in this PR.

1.4 Error Handling and Logging

No new gaps introduced by these 2 commits — the .ignoreExceptions() systemic issue that recurred across rounds 1-3 is not present in either commit (neither adds a new await().untilAsserted() around a call that can legitimately throw).

Issue 1 (High) — elasticsearch-connector-it is still red on the current head, on the exact tests this commit targeted

Location: ElasticsearchIT.java:810 (readSinkDataWithNestSchema) and ElasticsearchIT.java:768 (readSinkDataWithOutSchema).

Fork CI run nzw921rx/seatunnel workflow run for head 8b46105071 (jobs elasticsearch-connector-it (8, ubuntu-latest) id 96715937015 and (11, ubuntu-latest) id 96715937069) — both JDK matrices fail:

[ERROR] Tests run: 94, Failures: 0, Errors: 7, ... <<< FAILURE! - in ...ElasticsearchIT
testElasticsearchWithNestSchema{TestContainer}[2]  ... ConditionTimeoutException: expected: <3> but was: <0> within 2 minutes.
testElasticsearchWithNestSchema{TestContainer}[3]  ... expected: <3> but was: <0> within 2 minutes.
testElasticsearchWithNestSchema{TestContainer}[4]  ... expected: <3> but was: <0> within 2 minutes.
testElasticsearchWithoutSchema{TestContainer}[1]   ... expected: <11> but was: <0> within 2 minutes.
testElasticsearchWithoutSchema{TestContainer}[2]   ... expected: <11> but was: <0> within 2 minutes.
testElasticsearchWithoutSchema{TestContainer}[3]   ... expected: <11> but was: <10> within 2 minutes.
testElasticsearchWithoutSchema{TestContainer}[4]   ... expected: <11> but was: <0> within 2 minutes.

(also ElasticsearchAuthIT and ElasticsearchSchemaChangeIT each show 1 error earlier in the same job, before this commit's changes are reached in the retry sequence.)

The corrected count values (3, 11) are logically right (verified above), but the observed count is 0 (or 10, one short) after the full 2-minute wait — i.e., either the write path silently produced nothing for those parameterized container variants on this run, or the class's cumulative runtime (ElasticsearchIT alone took 6,173s / ~103 minutes across 94 parameterized tests in this run) is exhausting CI-runner resources (disk/heap/container health) by the time these later-running methods execute. I can't fully distinguish "genuine remaining defect in this fix" from "environmental degradation from an extremely long-running test class" from the log alone, but either way: this fix commit's own stated goal — making elasticsearch-connector-it pass — is not yet achieved on its own fork CI. Please re-run and, if it reproduces, capture whether the target ES index exists at all at failure time (vs. exists-but-empty) to narrow this down; if it's the resource-exhaustion theory, splitting ElasticsearchIT's parameterized instances or trimming unrelated per-instance container reuse may be needed independent of the threshold-value fix already made here.

Raised by another reviewer: No.

Issue 2 (High) — PR now has a real merge conflict with dev, independent of CI

gh pr view 11842 reports mergeStateStatus: DIRTY, mergeable: CONFLICTING as of this review. This wasn't true at my last review (head 3967ffd6b, where the PR merged cleanly with dev). This alone blocks merging regardless of the code-review outcome and needs a rebase/merge onto current dev before this can come off draft. Raised by another reviewer: No.

2. Code Quality Assessment

2.1 Coding Standards

Consistent with the rest of the PR — both commits are small, focused, and the non-obvious ones (FILTERED_DOCUMENT_COUNT, the nested-doc-count comment, the Postgres/Elasticsearch timeout comments) are explained inline. No stray formatting, no wildcard imports, no System.out.println.

2.2 Test Coverage and Test Stability

Per-site status for the two new commits:

Site File:Line Status Evidence
Postgres savepoint restore PostgresCDCIT.java:611 Stable pure widen of an already-correct condition wait
Databend Flink 1.18 disable DatabendCDCSinkIT.java:75 Not evaluable from this diff alone plausible pre-existing flakiness; no CI citation in the PR
ES setup-wait rename ElasticsearchAuthIT.java Stable correct >= semantics, downstream assertions still exact
ES filtered-count fix ElasticsearchIT.java (6 sites) High risk — still failing in fork CI testElasticsearchWithoutSchema errors, expected: <11> but was: <0>/<10>
ES nested-doc-count fix ElasticsearchIT.java:810 High risk — still failing in fork CI testElasticsearchWithNestSchema errors, expected: <3> but was: <0>
ES schema-change timeout widen ElasticsearchSchemaChangeIT.java Not clean this run 1 error present in the same job run, though not necessarily attributable to this specific widen

Overall rating for this round's delta: High risk. The corrected threshold values are logically right, but the fork's own CI for the exact test suite this commit targeted (elasticsearch-connector-it) is still red on both JDK matrices on the current head, with a "wrote/observed zero documents" failure signature that this fix does not explain or resolve on its own.

Other CI redness observed in the same fork run, checked against this PR's file list and judged not attributable to this diff: doris-connector-it (11) (no Doris file touched by this PR), unit-test (8) (JdbcHanaIT fails in jdbc-connectors-it-part-6, not this PR's JdbcSinkBatchIntervalIT/JdbcYashanDbIT), all-connectors-it-7 (testFakeSourceToCouchbaseSink — Couchbase is not in this PR's diff and matches known pre-existing CI-infra flakiness), and all-connectors-it-3 (FtpFileIT.testFtpBinaryUpdateModeContinuousDiscoveryWithNonRecursiveScan fails inside the untouched waitContinuousJobExit helper, on a checkpoint-coordinator-thread-still-running condition unrelated to the two assertions this PR's earlier commit did touch in the same test method). None of these are called out as new blockers, but they mean the overall fork CI signal is noisy and the Elasticsearch failures above needed to be traced individually to confirm they're real, which I did.

2.3 Documentation Updates

Not applicable — E2E test-only change.

3. Architectural Soundness

3.1 Elegance of the Solution (Precise fix / Temporary workaround / Long-term solution)

The two threshold/count corrections in ElasticsearchIT/ElasticsearchAuthIT are precise fixes for genuinely wrong values, following the same well-established pattern (filtered-count-aware waits) already proven correct elsewhere in this PR. The Databend disable is a reasonable temporary workaround for what looks like pre-existing flakiness, consistent with how FLINK_1_15 was already handled on dev.

3.2 Maintainability

Same assessment as prior rounds — good, self-documenting comments throughout. The one recurring nit (hardcoded FILTERED_DOCUMENT_COUNT vs. deriving it from mapTestDatasetForDSL().size(), as EasysearchIT already does in this same PR) is a small, easy follow-up.

3.3 Extensibility

No new concerns from this round's delta.

3.4 Historical-Version Compatibility

N/A — test-only, no serialization/checkpoint-format/config changes.

4. Issue Summary

# Issue Location Severity
1 elasticsearch-connector-it still fails on both JDK matrices on the current head, on exactly the tests this commit's fix targeted (expected N but was 0, not a threshold error) ElasticsearchIT.java:768,810 High
2 PR now has a real merge conflict with dev (mergeStateStatus: DIRTY, mergeable: CONFLICTING) N/A (branch state) High
3 (non-blocking) DatabendCDCSinkIT's new FLINK_1_18 disable has no CI citation in the PR description, unlike every other fix in this PR DatabendCDCSinkIT.java:75 Low
4 (non-blocking, carried over from round 2) FILTERED_DOCUMENT_COUNT is a hardcoded magic constant rather than derived from the existing filter helper ElasticsearchIT.java Low

5. Merge Recommendation

Conclusion: Not recommended for merge

This supersedes my prior APPROVED review at head 3967ffd6b — two things changed since then that reopen the merge decision: the PR's own fork CI is freshly red on the exact suite the newest commit set out to fix, and the branch now has a real conflict against dev.

Blockers (must fix):

  1. Re-run/investigate elasticsearch-connector-it on fork CI until testElasticsearchWithNestSchema and testElasticsearchWithoutSchema pass clean on both JDK 8 and 11 — the corrected threshold values (3, 11) are right, but something is still causing 0 (or 10/11) documents to be observed; confirm whether this is a remaining logic gap or CI-runner resource exhaustion from this very long test class before calling it fixed.
  2. Rebase/merge onto current dev to resolve the CONFLICTING merge state.

Recommended fixes (non-blocking):

  • Add a CI-run citation for the DatabendCDCSinkIT FLINK_1_18 disable, matching the evidentiary standard used everywhere else in this PR.
  • Derive FILTERED_DOCUMENT_COUNT from the existing mapTestDatasetForDSL().size() helper instead of hardcoding 11, for the same robustness reason already applied to EasysearchIT in this PR.

Overall assessment: This continues to be a well-executed, iteratively-hardened cleanup, and the specific logic in this round's two commits (Postgres/Elasticsearch timeout widenings, the >=-vs-== setup-wait fix, and both Elasticsearch count corrections) is sound and, in the case of the count corrections, fixes a real, previously-wrong condition. But "the fix is logically correct" and "the target suite is green" are two different bars, and this round doesn't clear the second one yet — plus the new merge conflict is an independent, unrelated blocker that needs to be resolved either way. Once elasticsearch-connector-it is confirmed clean and the branch is rebased onto dev, I'd expect this to be very close to mergeable again.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What Problem Does This PR Solve?

  • User pain point: the E2E suite relies heavily on fixed Thread.sleep(...) to wait for async state (container readiness, job RUNNING, CDC propagation, checkpoint commits, cluster membership, etc.), which is either too short on a loaded CI runner (flaky failure) or wastes CI time when the runner is fast.
  • Fix approach: replace most of these sleeps across dozens of E2E files with Awaitility condition-based waits, keeping a sleep only where elapsed time is genuinely part of the test semantics (documented case by case).
  • One-sentence summary: a large, iteratively-hardened mechanical sweep of E2E timing debt that has already gone through 6 review rounds; this is round 7, re-reviewing everything from scratch after a large dev sync since my last CHANGES_REQUESTED review.

There's no new reply from you to acknowledge this round — the only thing that happened since my last review (head 8b46105071, 2026-08-21) is code: one small fix commit followed by a big dev merge (1f29112aa, +11/-2 commits vs dev). I re-reviewed the whole PR from scratch rather than just the delta, and I also went back and specifically re-verified whether my two previous blockers are actually resolved rather than trusting that time passing fixed them — one is, one isn't (details below), and the merge also introduced a new problem of its own that's worth flagging clearly since it's not something you wrote by hand: it came in through a conflict-resolution choice during the dev merge.

1. Code Change Review

1.1 Core Logic Analysis

What changed since my last review. I restricted the diff to the files this PR actually owns (git diff origin/dev...HEAD --stat, still 59 files) and compared against my last-reviewed head:

git diff 8b46105071..1f29112aa --stat -- <the 59 PR-owned files>
  PostgresCDCIT.java            | 23 +-
  FtpFileIT.java                 | 293 ++++++++++++++++-----
  LocalFileWithMetadataIT.java   |  7 +-
  PaimonSinkCDCIT.java           |  7 +-
  ClusterFailureNoRestoreIT.java | 48 ++--
  JobLogIT.java                  |  9 +-
  6 files changed, 282 insertions(+), 105 deletions(-)

Everything else in the 59-file diff is byte-identical to what I traced across rounds 1–6. I did not re-derive that work from zero; I spot-checked several of the previously-confirmed fixes (the Easysearch/Oracle/StarRocks filtered-count corrections, the .ignoreExceptions() removals, the fault-tolerance checkpoint-wait revert) directly on the current head and they're unchanged.

For the 6 files above, I traced each one individually rather than assuming the dev merge was a no-op:

ClusterFailureNoRestoreIT.java — genuine improvement, not a regression. The old check only asserted sourceReadCount > 0 before killing a worker node — which could spuriously pass even if the bounded source had already finished reading all rows by the time the check ran, silently turning a "kill mid-flight" test into "kill after completion." The new awaitSourceProgressBeforeShutdown (ClusterFailureNoRestoreIT.java:184-201) adds an upper bound: sourceReadCount < expectedSourceReadCount (120,000 for a 6-way-parallel, 20,000-row-per-parallelism batch). Since a 120K-row job can't realistically drain within the 30s window this check runs in, the upper bound is safe in practice and meaningfully strengthens what the test actually proves. Good change.

LocalFileWithMetadataIT.java / JobLogIT.java — cosmetic, unrelated to this PR's goal. Both just switch a hardcoded Hadoop-uber-jar path to MavenJarUtil.getHadoop3UberJarPath(), brought in from dev's shade-module refactor (#9993). No wait/timing logic touched.

PaimonSinkCDCIT.java — cosmetic. Extracts a conf-file-name string into a named constant. No behavior change.

PostgresCDCIT.java — a real timeout change, but it came from dev, not from this PR's own commits (informational, not a blocker). git log 8b46105071..1f29112aa -- PostgresCDCIT.java shows only the merge commit and dev's own 577032fb5 ("[Test][E2E] Give PostgresCDCIT post-restore assertions their own budget" — co-authored by danielnadean/DanielLeens identities, landed independently on dev, PR #11644). It introduces RESTORE_ASSERT_TIMEOUT_MILLIS = 180000L (3 minutes) and applies it at three call sites (PostgresCDCIT.java:624,925,1027). Two of those sites are correctly widened (60s → 3min). The third — the exact savepoint-restore wait I reviewed and approved as "correct and low-risk" at 5 minutes in my last round — is narrowed from 5 minutes to 3 minutes by this consolidation. I'm not flagging this as a blocker for this PR: it's an upstream dev decision (with its own PR and its own review trail) that this branch inherited via merge, not something the author of this PR wrote, and the fork CI for the shard containing PostgresCDCIT passed clean on the current head, so there's no live evidence it's insufficient. But since I was the one who specifically validated 5 minutes as necessary last round, I want it on record: if PostgresCDCIT's post-restore assertions start flaking again on a loaded runner, this consolidation from 5min→3min is the first place to look.

FtpFileIT.java — a real regression, and it's the one that matters (Issue 1 below). Unlike the files above, this one isn't a clean cosmetic pass-through of a dev change: it's a case where your own merge-conflict resolution silently discarded a fix you yourself already had on this branch, in favor of dev's independently-written (and structurally different) version of the same test method. Full trace in Issue 1.

1.2 Compatibility Impact

Fully compatible. git diff origin/dev...HEAD --stat still touches only files under seatunnel-e2e/**; no production code, public API, SPI, or config-option changes. No docs/en/docs/zh update required.

1.3 Performance / Side-Effect Analysis

Unchanged from prior rounds for the bulk of the diff: condition-based waits resolve as soon as their condition is met on a healthy runner, and the widened timeouts only cost extra wall time on an already-broken build. The ClusterFailureNoRestoreIT upper-bound check adds negligible cost (one more field read per poll).

1.4 Error Handling and Logging

Issue 1 (High) — your own dev-merge conflict resolution silently reverted an already-fixed assertion back to Thread.sleep, on the exact test this PR's title is about

  • Location: seatunnel-e2e/seatunnel-connector-v2-e2e/connector-file-ftp-e2e/src/test/java/org/apache/seatunnel/e2e/connector/file/ftp/FtpFileIT.java:534, inside testFtpBinaryUpdateModeContinuousDiscoveryWithNonRecursiveScan (FtpFileIT.java:501).
  • Problem description: At your own last-reviewed head (8b46105071), this method already had the correct fix — a stability-window Awaitility wait proving the nested file never appears within a bounded window, not just at one instant:
    Awaitility.await()
            .during(3, TimeUnit.SECONDS)
            .atMost(1, TimeUnit.MINUTES)
            .untilAsserted(
                    () -> Assertions.assertFalse(
                            isFtpFileExists(CONTINUOUS_NON_RECURSIVE_PATH + "/dst/subdir/nested.bin")));
    dev independently rewrote this same test method in commit 847b51e39 (#10925, itself co-authored by DanielLeens) with a different, less-polished version that still used a raw sleep:
    Thread.sleep(3000);
    Assertions.assertFalse(isFtpFileExists(CONTINUOUS_NON_RECURSIVE_PATH + "/dst/subdir/nested.bin"));
    When you merged dev into this branch (1f29112aa), this was a genuine textual conflict — dev's version restructured the whole method (added try/catch/finally, testFailure tracking, cleanupContinuousJob, changed the throws clause to Throwable) while your branch had the surgical one-hunk Awaitility fix. The resolution kept dev's full method rewrite, which means it took dev's side of this specific assertion too, and the Awaitility.await().during(3, SECONDS)... block is gone from the current head. I confirmed with a repo-wide search: FtpFileIT.java:534 is now the only Thread.sleep(...) call left anywhere under seatunnel-e2e (grep -rn "Thread\.sleep" --include='*.java' seatunnel-e2e), which means the PR description's own claim — "There are no remaining Thread.sleep(...) calls under seatunnel-e2e" — is no longer true on the current head.
  • Potential risk: Functionally this specific assertion still "works" (it will still catch a genuinely broken non-recursive scan), but it's exactly the anti-pattern this PR exists to eliminate: a single point-in-time check after a fixed delay, rather than a continuously-verified stability window. On a slow/loaded runner, 3 seconds may not be enough for a wrongly-synced file to actually appear before the check runs, which is precisely the flakiness class the rest of this PR fixes. It also means anyone reviewing or citing this PR's "zero remaining sleeps" claim (including my own last-round review, which I now need to correct) is working from stale information.
  • Best improvement: Re-apply the Awaitility.await().during(3, TimeUnit.SECONDS).atMost(1, TimeUnit.MINUTES).untilAsserted(...) version from your own 8b46105071 head at this exact spot. This is a one-hunk fix — you don't need to touch anything else dev's rewrite added (the try/catch/finally/cleanupContinuousJob restructuring is fine and orthogonal to this).
  • Severity: High — it directly contradicts this PR's own stated and previously-verified deliverable.
  • Raised by another reviewer: No.

No other error-handling gaps found. The .ignoreExceptions() systemic issue from rounds 1–3 remains absent on the current head (spot-checked, unchanged).

Issue 2 (High, carried over from my last review — still not resolved) — elasticsearch-connector-it is still red on the current head, on the same tests

  • Location: ElasticsearchIT.java:768 (readSinkDataWithOutSchema), ElasticsearchIT.java:810 (readSinkDataWithNestSchema), and now also ElasticsearchSchemaChangeIT.java:158 (testSchemaChange).
  • Problem description: I flagged this exact failure signature last round and it has not been resolved on the current head. I re-ran the check against the fork's live CI for 1f29112aa (nzw921rx/seatunnel run 32921631383, jobs elasticsearch-connector-it (8, ubuntu-latest) and (11, ubuntu-latest), both failure) rather than trusting that the branch fixed it since I last checked:
    ElasticsearchSchemaChangeIT.testSchemaChange       expected: <9>  but was: <0>  within 5 minutes.
    ElasticsearchIT.testElasticsearchWithNestSchema[4]  expected: <3>  but was: <0>  within 2 minutes.
    ElasticsearchIT.testElasticsearchWithoutSchema[4]   expected: <11> but was: <0>  within 2 minutes.
    Tests run: 116, Failures: 0, Errors: 3
    
    Same signature as last round: "was 0" (or in one prior run, "was 10"), not an off-by-one on the corrected threshold values, which I already independently verified as logically correct (3 for a nested doc, 11 for the filtered dataset). ElasticsearchIT alone still runs ~84 minutes across 94 parameterized tests in this class in this run, which keeps my prior "resource exhaustion on a very long test class" theory alive as one plausible explanation, alongside a genuine remaining logic gap in setup/write timing for the later-running parameterized instances. I can't fully distinguish the two from the log alone, same as last round.
  • Potential risk: Same as before — the class this PR's Elasticsearch fixes specifically targeted is not passing its own test suite. Merging on a "the corrected values are logically right" basis without a green run risks landing a fix that still doesn't fix the class it targets.
  • Best improvement: Same ask as last round: get elasticsearch-connector-it clean on both JDK matrices before merge. If it reproduces again, capture whether the ES index exists-but-empty vs. doesn't-exist-at-all at failure time, and consider whether ElasticsearchIT's ~84-minute single-class runtime is itself contributing (splitting the parameterized instances across more than one class, independent of any threshold fix, would at least rule that variable out).
  • Severity: High — carried over, unresolved.
  • Raised by another reviewer: No.

Issue 3 (resolved since last round) — merge conflict with dev

My last review's other High blocker was mergeStateStatus: DIRTY / mergeable: CONFLICTING. That's fixed: the current head shows mergeStateStatus: BLOCKED / mergeable: MERGEABLE (BLOCKED here is branch-protection review/status gating, not a conflict — confirmed via gh pr view --json mergeStateStatus,mergeable). No further action needed on this one, though see Issue 1 above for what the conflict-resolution itself introduced.

2. Code Quality Assessment

2.1 Coding Standards

Consistent with the rest of the PR — the two genuinely new-to-this-round hunks (the ClusterFailureNoRestoreIT upper-bound helper and its Javadoc) are well-commented and explain the "why," matching the standard set elsewhere in this PR. No stray formatting, no wildcard imports, no System.out.println.

2.2 Test Coverage and Test Stability

Per-file status for this round's delta:

File Status Evidence
ClusterFailureNoRestoreIT.java Stable, improved new upper-bound check strengthens the scenario, no new race (120K-row job can't drain in the 30s check window)
LocalFileWithMetadataIT.java / JobLogIT.java Stable, cosmetic jar-path helper only, no timing logic touched
PaimonSinkCDCIT.java Stable, cosmetic constant extraction only
PostgresCDCIT.java Stable in this run, worth watching 60s→3min widenings are safe; the 5min→3min narrowing at PostgresCDCIT.java:624 is inherited from dev, not introduced by this PR's author, and the relevant CI shard passed clean this run
FtpFileIT.java Risk present Issue 1 — a previously-fixed Awaitility stability-window check was reverted to Thread.sleep(3000) during this branch's own dev-merge conflict resolution

Overall stability rating for this PR: High risk. Both a High-severity carryover (Issue 2, elasticsearch-connector-it still red on the exact suite this PR's fixes targeted) and a newly-introduced High-severity regression (Issue 1, the Thread.sleep reintroduced via merge) are open on the current head. Neither is present in the bulk of the previously-reviewed 53 files, which remain stable and unchanged — the risk is narrowly scoped to these two spots, but both are concrete and must-fix before merge.

Carryover, non-blocking (unchanged from last round):

  • DatabendCDCSinkIT.java:75 — the FLINK_1_18 @DisabledOnContainer addition still has no CI-run citation in the PR description, unlike every other fix in this PR. Low.
  • ElasticsearchIT.java — FILTERED_DOCUMENT_COUNT (ElasticsearchIT.java:90) is still a hardcoded magic constant rather than derived from mapTestDatasetForDSL().size(), the way the sibling EasysearchIT fix in this same PR already does it. Low.

2.3 Documentation Updates

Not applicable — E2E test-only change.

3. Architectural Soundness

3.1 Elegance of the Solution (Precise fix / Temporary workaround / Long-term solution)

The overall approach — condition-based waits where an observable signal exists, documented time-based waits where elapsed time is part of the scenario — remains the right shape and is unchanged from prior rounds. This round's genuinely new work (ClusterFailureNoRestoreIT's upper bound) is a precise fix. Issue 1 is not a design problem; it's a merge-hygiene problem — the design was already correct at 8b46105071 and got clobbered by a conflict resolution that favored dev's independently-written version of the same method.

3.2 Maintainability

Good, with one process note: this PR has now absorbed several large dev syncs across 7 rounds, and at least twice (this round's FtpFileIT, and the earlier SeaTunnelContainer.java conflict in the companion container-reuse PR #11626) dev has independently rewritten the same test files this PR is also fixing — sometimes with DanielLeens/danielnadean co-authorship on the dev side too, suggesting some of this PR's own findings are being fixed piecemeal upstream in parallel. That's good in that the destination state converges, but it makes every merge a re-conflict risk for exactly the hunks this PR cares most about. Worth double-checking git diff around any e2e test file touched by both branches after future syncs, specifically for reintroduced Thread.sleep.

3.3 Extensibility

No new concerns from this round's delta.

3.4 Historical-Version Compatibility

N/A — test-only, no serialization/checkpoint-format/config changes.

4. Issue Summary

# Issue Location Severity
1 Own dev-merge conflict resolution reverted an already-fixed assertion back to Thread.sleep, contradicting this PR's "zero remaining sleeps" claim FtpFileIT.java:534 High
2 (carryover, unresolved) elasticsearch-connector-it still fails on both JDK matrices, on the exact tests this PR's fixes targeted ElasticsearchIT.java:768,810; ElasticsearchSchemaChangeIT.java:158 High
3 (informational, not this PR's doing) Post-restore savepoint wait narrowed 5min→3min via an inherited dev commit, not this PR's own author work; no live CI failure this run PostgresCDCIT.java:624 Low
4 (non-blocking, carried over) DatabendCDCSinkIT's FLINK_1_18 disable has no CI citation in the PR description DatabendCDCSinkIT.java:75 Low
5 (non-blocking, carried over) FILTERED_DOCUMENT_COUNT is a hardcoded magic constant rather than derived from the existing filter helper ElasticsearchIT.java:90 Low

Merge-conflict blocker from last round (mergeStateStatus: DIRTY) is resolved — not carried forward.

5. Merge Recommendation

Conclusion: Not recommended for merge

Blockers (must fix):

  1. Issue 1 — restore the Awaitility.await().during(3, TimeUnit.SECONDS).atMost(1, TimeUnit.MINUTES).untilAsserted(...) check at FtpFileIT.java:534 that was present at your own 8b46105071 head before the dev merge. This is a small, localized fix — one hunk, no interaction with the rest of dev's restructuring of that method.
  2. Issue 2 — get elasticsearch-connector-it passing clean on both JDK 8 and 11 in fork CI. This has now been open across two consecutive rounds with the same "observed 0 documents" signature; please capture whether the target ES index exists-but-empty vs. doesn't-exist-at-all at failure time so we can tell a remaining logic gap apart from CI-runner resource pressure from the ~84-minute ElasticsearchIT class.

Recommended fixes — non-blocking:

  • Issue 4 — cite the CI run backing the DatabendCDCSinkIT FLINK_1_18 disable.
  • Issue 5 — derive FILTERED_DOCUMENT_COUNT from mapTestDatasetForDSL().size() instead of hardcoding 11.
  • Keep an eye on PostgresCDCIT.java:624 (Issue 3) if post-restore assertions start flaking — it's now on a 3-minute budget instead of the 5 minutes I validated last round, via an inherited dev change rather than anything in this PR.

Overall assessment. The core design and the large majority of this PR (53 of 59 files, everything I traced across rounds 1–6) remain sound and unchanged. This round's own new work (ClusterFailureNoRestoreIT's upper-bound strengthening) is good. But two High-severity items are open on the current head: one is a carryover CI failure that hasn't moved since I flagged it last round, and the other is a new, self-inflicted regression where this branch's own merge with dev silently threw away a fix that was already correct on this branch — on the exact class of bug (Thread.sleep instead of a condition-based wait) this PR exists to eliminate. Both are narrowly scoped and should be quick to close out; I'd expect this to come back clean on the next round.

On CI: the apache-side Build check is in_progress on the current head (1f29112aa) at the time of this review. I went to the fork's own run for the real per-job signal (per my usual practice on this PR) rather than waiting on the apache-side pointer, and that's where Issue 2's elasticsearch-connector-it failures come from — live, not historical.

@github-actions github-actions Bot removed the reviewed label Aug 26, 2026

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the continued iteration on this — re-reviewed the current head df8625496, which adds one new commit (df8625496 — [Fix][E2E] Stabilize Elasticsearch condition waits) on top of the previously-reviewed 1f29112aa (my 2026-08-26T07:12:31Z review, which left 2 High items open: the FtpFileIT Thread.sleep reintroduced by a dev-merge conflict resolution, and elasticsearch-connector-it still failing on ElasticsearchIT/ElasticsearchSchemaChangeIT). There's no new reply to answer in this round — nobody commented since my last review, so this is a pure code re-review.

Verdict up front: both previously-open items are addressed by this commit, but with different confidence levels. The FtpFileIT fix is an exact, byte-for-byte restoration of the version I already validated on CI in an earlier round — I'm confident in it. The Elasticsearch fix is a materially different, more thorough attempt than the last two rounds (it changes the test's container lifecycle, not just a threshold value again), and my source-level trace of the mechanism is convincing — but the fork's own CI for this exact head was still queued (not yet run) when I checked, and this is the third consecutive round targeting elasticsearch-connector-it, after two previous "this should fix it" attempts both failed CI with the identical "observed 0 documents" signature. Given that specific track record, I want to see this exact head's CI pass before calling it resolved, rather than approving on inspection alone a third time.

What Problem Does This PR Solve?

  • User pain point: the E2E suite relies heavily on fixed Thread.sleep(...) to wait for async state (container readiness, job RUNNING, CDC propagation, checkpoint commits, cluster membership, etc.), which is either too short on a loaded CI runner (flaky failure) or wastes CI time when the runner is fast.
  • Fix approach: replace most of these sleeps across ~59 E2E files with Awaitility condition-based waits, keeping a sleep only where elapsed time is genuinely part of the test semantics. This round's commit specifically targets the two items still open from the last review.
  • One-sentence summary: round 9 of an iteratively-hardened sweep — a clean revert closes out the FtpFileIT regression, and a real architectural change (not just another threshold tweak) attempts to finally close out the elasticsearch-connector-it instability that has survived two previous "logically correct" fixes.

1. Code Change Review

1.1 Core Logic Analysis

I diffed this commit directly against my last-reviewed head (git diff 1f29112aa..df8625496 --stat): exactly 3 files touched, all under seatunnel-e2e/** — FtpFileIT.java (+8/-4), ElasticsearchIT.java (+31/-14), ElasticsearchSchemaChangeIT.java (+16/-9). No other files in the 59-file PR diff are touched, so everything I traced and confirmed clean across rounds 1–8 (Aerospike, Oracle CDC, StarRocks, Easysearch, Paimon, CommittedMetricsIT, MongodbCDCIT, the fault-tolerance checkpoint-wait revert, ElasticsearchAuthIT) is unchanged and I'm not re-flagging any of it.

Site 1 — FtpFileIT.java:534-542 (previously Issue 1 from my last review) — FIXED, exact restoration

Before (1f29112aa, the regression I flagged — reintroduced via a dev-merge conflict resolution):

Thread.sleep(3000);
Assertions.assertFalse(
        isFtpFileExists(CONTINUOUS_NON_RECURSIVE_PATH + "/dst/subdir/nested.bin"));

After (df8625496):

Awaitility.await()
        .during(3, TimeUnit.SECONDS)
        .atMost(1, TimeUnit.MINUTES)
        .untilAsserted(
                () ->
                        Assertions.assertFalse(
                                isFtpFileExists(
                                        CONTINUOUS_NON_RECURSIVE_PATH
                                                + "/dst/subdir/nested.bin")));

This is character-for-character the same fix I already validated on fork CI in an earlier round (before it got clobbered by the dev merge) — a stability-window check ("this file must stay absent for 3 continuous seconds", not just "was absent at one instant 3 seconds after the job started"). No new analysis needed here; I'm confident in this one.

Site 2 — ElasticsearchSchemaChangeIT.java:143-183 — new failFast guard on the async job future

Before:

CompletableFuture.runAsync(
        () -> {
            try {
                container.executeJob(jobConfigFile, jobId);
            } catch (Exception e) {
                log.error("Commit task exception :" + e.getMessage());
                throw new RuntimeException(e);
            }
        });
...
await().atMost(5, TimeUnit.MINUTES)
        .ignoreExceptions()
        .untilAsserted(() -> Assertions.assertEquals(9, esRestClient.getIndexDocsCount("schema_change_index").get(0).getDocsCount()));

After:

CompletableFuture<Void> jobFuture =
        CompletableFuture.runAsync(
                () -> {
                    try {
                        Container.ExecResult result = container.executeJob(jobConfigFile, jobId);
                        Assertions.assertEquals(0, result.getExitCode(), result.getStderr());
                    } catch (Exception e) {
                        log.error("Elasticsearch schema-change job failed", e);
                        throw new RuntimeException(e);
                    }
                });

await().atMost(5, TimeUnit.MINUTES)
        .failFast("The streaming job finished before the initial snapshot was indexed", jobFuture::isDone)
        .ignoreExceptions()
        .untilAsserted(() -> Assertions.assertEquals(9, ...));
...
await().atMost(120, TimeUnit.SECONDS).pollInterval(3, TimeUnit.SECONDS)
        .failFast("The streaming job finished before the schema change was indexed", jobFuture::isDone)
        .ignoreExceptions()
        .untilAsserted(() -> { ... });

This is a diagnostic/defensive improvement, not a root-cause fix for the "expected N but was 0" symptom by itself: testSchemaChange runs a streaming CDC job (executeJob blocks for the life of the job), so under normal operation jobFuture.isDone() stays false for the whole test and the failFast guard never fires. What it does fix is a real blind spot — if the job container crashes or the SeaTunnel job exits early (e.g. the newly-added Assertions.assertEquals(0, result.getExitCode(), ...) trips), the two await() blocks previously had no way to know that and would burn their full 5-minute / 120-second budget polling an index that will obviously never reach the target count, since nothing is writing to it anymore. Now that failure surfaces immediately with a clear message instead of a generic ConditionTimeoutException. This is correct and safe (the isDone() supplier can't produce a false positive against a genuinely still-running streaming job), but it's worth being precise that it improves diagnosability, not the underlying "why did ES end up with 0 docs" question — see Site 3 below for where I think the real fix for that lives.

One related gap I want to flag (Issue 1 below): if failFast does trigger, Awaitility surfaces its own message ("streaming job finished before X was indexed"), not the actual exception from inside the CompletableFuture (the AssertionError from the exit-code check, or the underlying IOException/InterruptedException from executeJob). The real root cause is swallowed inside the future and never joined/logged anywhere. Low-severity, easy to improve.

Site 3 — ElasticsearchIT.java — container lifecycle changed from per-test to per-class (the substantive attempt at the actual "observed 0 documents" root cause)

This is the significant change in this commit. Before:

@BeforeEach
@Override
public void startUp() throws Exception {
    container = new ElasticsearchContainer(...);
    Startables.deepStart(Stream.of(container)).join();
    ...
    esRestClient = EsRestClient.createInstance(config);
    testDataset1 = generateTestDataSet1();
    testDataset2 = generateTestDataSet2();
    createIndexForResourceNull("st_index");
    createIndexDocs();
    createIndexWithFullType();
}
...
@AfterEach
@Override
public void tearDown() {
    if (Objects.nonNull(esRestClient)) esRestClient.close();
    container.close();
}

After (ElasticsearchIT.java:101-145):

@BeforeAll
@Override
public void startUp() throws Exception {
    container = new ElasticsearchContainer(...);
    Startables.deepStart(Stream.of(container)).join();
    ...
    esRestClient = EsRestClient.createInstance(config);
    testDataset1 = generateTestDataSet1();
    testDataset2 = generateTestDataSet2();
}

@BeforeEach
public void initializeTestData() throws Exception {
    // Reuse the Elasticsearch process across this large parameterized suite, while keeping
    // every invocation isolated from indices created by the preceding invocation.
    esRestClient.listIndex().stream()
            .filter(index -> !index.startsWith("."))
            .forEach(esRestClient::dropIndex);
    createIndexForResourceNull("st_index");
    createIndexDocs();
    createIndexWithFullType();
}
...
@AfterAll
@Override
public void tearDown() {
    if (Objects.nonNull(esRestClient)) esRestClient.close();
    if (Objects.nonNull(container)) container.close();
}

ElasticsearchIT runs ~94 parameterized @TestTemplate invocations (multiple engines × multiple test methods) and, per Daniel's own round-7/8 CI observations, takes roughly 84–103 minutes end to end. Under the old @BeforeEach/@AfterEach pattern, the class was tearing down and starting a brand-new ElasticsearchContainer 94 times in that window. @BeforeAll/@AfterAll is legal here without making startUp/tearDown static because TestSuiteBase (the common parent, seatunnel-e2e-common/.../TestSuiteBase.java:49) is already annotated @TestInstance(Lifecycle.PER_CLASS) — I checked this specifically since a naive @BeforeAll on a non-static instance method under the JUnit5 default (PER_METHOD) lifecycle would fail at runtime, and confirmed it's fine here.

Why this plausibly explains the "expected N but was 0" failures from rounds 7–8, not just moves the goalposts: the earlier rounds' fixes (correcting FILTERED_DOCUMENT_COUNT, the nested-doc count) were logically right — I verified that myself in both prior rounds — yet the tests kept observing 0 documents, not a threshold miscount. "0 documents observed after the full timeout" is the same failure signature as the container-not-fully-ready races flagged and fixed for Aerospike/Oracle/StarRocks in rounds 1–2 of this same PR: a Testcontainers-reported "started" state that doesn't yet mean the service is fully serving writes. Restarting the ES container 94 times in the same CI job, under Docker-daemon load shared with every other parallel *-connector-it job in the matrix, is exactly the kind of repeated-restart scenario where that race gets more chances to fire — and removing 93 of those 94 restart opportunities removes 93 of those chances. I also confirmed the mechanics are safe for test isolation: executeJob(...) (TestContainer.java:42) is synchronous — it blocks until the job container process exits — so by the time any @TestTemplate method returns, its own job has fully finished; there's no async fire-and-forget write left in flight that could race against the next test's initializeTestData() index-drop. And EsRestClient (the reused client) has no per-call caching (getFieldTypeMapping and friends build fresh local maps every call — I checked the client source directly), so nothing about reusing it across tests can serve stale schema/mapping data.

I want to be precise about what I can and can't confirm here: the reasoning above is a real trace through the actual code, not a guess, but it is unproven on this exact head — the fork's CI run for df8625496496 (nzw921rx/seatunnel, run 33040533660) was still queued, not started, when I checked. I'd rather say that plainly than either fabricate a pass or reflexively assume it works, especially given this exact suite's history in this exact PR.

Site 4 — ElasticsearchIT.java:503,505,778,789,797 — hardcoded FILTERED_DOCUMENT_COUNT replaced with a derived count (closes a Low, non-blocking nit from round 7)

Before: awaitIndexDocsCount("read_filter_index1_copy", FILTERED_DOCUMENT_COUNT) / awaitIndexDocsCount(indexName, FILTERED_DOCUMENT_COUNT) (a single hardcoded 11 reused for both testDataset1 (c_int) and testDataset2 (c_int2)).

After: a new countDocumentsMatchingRange(dataset, fieldName) helper (ElasticsearchIT.java:1168-1176) recomputes the count per dataset and per field:

private long countDocumentsMatchingRange(List<String> dataset, String fieldName) {
    return dataset.stream()
            .map(JsonUtils::parseObject)
            .filter(document -> {
                JsonNode field = document.get(fieldName);
                return field != null && field.asInt() >= 10 && field.asInt() <= 20;
            })
            .count();
}

used at read_filter_index1_copy/c_int and read_filter_index2_copy/c_int2 (ElasticsearchIT.java:499-505), and the readSinkDataWithOutSchema/readSinkDataWithSchema/readSinkDataWithSchema-with-nulls call sites (:778,789,797) now derive their expected count from mapTestDatasetForDSL().size() — the exact same filter helper (c_int in [10,20]) that the final assertIterableEquals downstream already uses. I checked: the [10,20] bound matches the rangeParam used in the actual ES query in the same test (testElasticsSearchWithMultiSourceByFilter, ElasticsearchIT.java:491-497), so this isn't just "no longer hardcoded," it's also more correct than the old single constant, which silently assumed testDataset1 and testDataset2 produce the same filtered count for two different fields. This was a real (if latent) hardcoded-constant fragility, now removed. readSinkDataWithNestSchema's awaitIndexDocsCount(index, 3) (nested-doc count, fixed correctly back in round 7) is untouched and unaffected by this change, as expected.

1.2 Compatibility Impact

Fully compatible. git diff 1f29112aa..df8625496 --stat confirms all 3 changed files remain under seatunnel-e2e/**; no production code, public API, SPI, or config-option changes. mergeable=true, mergeable_state=blocked (branch-protection/review gating, not a conflict) as of this review. No docs/en/docs/zh update required.

1.3 Performance / Side-Effect Analysis

Positive for the common case: reusing one ES container across the whole class should cut a meaningful chunk of ElasticsearchIT's ~84–103 minute runtime (94 container startups → 1), which also reduces load on the shared CI runner during the rest of the matrix.

One thing worth watching, not a blocker: the class now keeps a single Elasticsearch process alive across all ~94 sub-tests, each of which creates and drops a handful of indices. I don't see anything in the diff that would cause a leak (indices are explicitly dropped every @BeforeEach, and EsRestClient doesn't accumulate per-call state), but a long-lived ES node under a long parameterized run is a different failure mode than "container not ready yet" — cumulative segment/shard churn or JVM heap pressure inside the ES container over ~90 create/drop cycles is the kind of thing that tends to show up only under real CI load, not in a source read. Given elasticsearch-connector-it's CI run for this head hasn't completed yet, I'd flag this as something to keep an eye on if a different kind of instability (e.g. es_rejected_execution_exception, GC pauses) shows up instead of the previous "0 documents" signature.

1.4 Error Handling and Logging

Issue 1 (Low, non-blocking, new) — ElasticsearchSchemaChangeIT.java:143-150: when failFast trips (job finished unexpectedly), the actual cause — the AssertionError from the new Assertions.assertEquals(0, result.getExitCode(), result.getStderr()) check, or any IOException/InterruptedException from executeJob — is only ever thrown inside the CompletableFuture, which nothing ever .join()s or inspects. The test fails with Awaitility's generic fail-fast message ("the streaming job finished before X was indexed") instead of the real root cause. Suggested improvement: after the await() blocks (or in a finally), call something like jobFuture.getNow(null) guarded by isDone(), or wrap the future so its exception is logged, so a future CI failure here shows why the job died instead of just that it died early.

No other error-handling gaps found in this commit. The systemic .ignoreExceptions() issue from rounds 1–3 remains absent (this commit's two await() additions in ElasticsearchSchemaChangeIT both already chain .ignoreExceptions() correctly).

2. Code Quality Assessment

2.1 Coding Standards

Clean and consistent with the rest of the PR. The lifecycle-change comment in initializeTestData() explains the "why" (reuse the process, keep invocations isolated) rather than restating the "what." No stray formatting, no wildcard imports, no System.out.println.

2.2 Test Coverage and Test Stability

Per-site stability rating for this commit's 3 files (Section 5.10.2 analysis):

Site File:Line Rating Evidence
FtpFileIT sleep restoration FtpFileIT.java:534-542 Stable Exact restoration of a pattern I already validated on fork CI in an earlier round of this same PR; no new risk.
ElasticsearchSchemaChangeIT failFast guard ElasticsearchSchemaChangeIT.java:161,177 Stable The isDone() supplier can't produce a false positive against a still-running streaming job (executeJob blocks for the job's lifetime); this can only fail faster, never spuriously.
ElasticsearchIT FILTERED_DOCUMENT_COUNT → derived count ElasticsearchIT.java:503,505,778,789,797 Stable Verified the [10,20] bound matches the actual ES range query used in the same test; removes a latent single-constant-for-two-fields assumption.
ElasticsearchIT container lifecycle @BeforeEach→@BeforeAll ElasticsearchIT.java:101-145 Risk present — unconfirmed, not yet CI-verified Source-level trace supports this as a real fix for the repeat "observed 0 documents" failure mode (removes 93 of 94 container-restart race windows); mechanically sound (@TestInstance(PER_CLASS) present, executeJob is synchronous so no cross-test async race, EsRestClient has no stale-cache risk). But the fork's own CI run for this exact head (33040533660) was queued, not completed, at review time, and this is the third consecutive round attempting to fix this exact suite after two "logically correct" prior attempts both failed CI with the same signature. I'm rating this "Risk present" rather than "Stable" purely on the basis of "not yet proven," not because I found a defect in it.

Overall rating for this round's delta: Risk present, driven entirely by the unconfirmed CI status of the ElasticsearchIT lifecycle change, not by any anti-pattern I found in the new code itself. The FtpFileIT and ElasticsearchSchemaChangeIT changes are stable on inspection alone.

Carryover, non-blocking (unchanged from round 7, not touched by this commit):

  • DatabendCDCSinkIT.java:75 — the FLINK_1_18 @DisabledOnContainer addition still has no CI-run citation in the PR description, unlike every other fix in this PR. Low.

2.3 Documentation Updates

Not applicable — E2E test-only change.

3. Architectural Soundness

3.1 Elegance of the Solution

The FtpFileIT fix is a precise fix (exact restoration of a known-good pattern). The ElasticsearchSchemaChangeIT failFast addition is a precise, low-risk diagnosability improvement. The ElasticsearchIT lifecycle change is the most interesting piece of engineering in this round: rather than continuing to tweak threshold values against a symptom (which is what rounds 6–7 both did, both times exactly reproducing "correct value, still observes 0"), this commit goes after the actual mechanism (a container that gets torn down and rebuilt 94 times in a row) that's consistent with the observed symptom. That's the right instinct, even though I can't yet confirm it converts to a green run.

3.2 Maintainability

Good. The initializeTestData() comment explains the trade-off being made (shared process, isolated invocations) clearly enough that a future maintainer investigating a "weird cross-test pollution" bug in this file would immediately know where to look.

3.3 Extensibility

No new concerns from this round's delta. The countDocumentsMatchingRange helper is a reasonable, reusable pattern if other Elasticsearch E2E tests need range-filtered counts in the future.

3.4 Historical-Version Compatibility

N/A — test-only, no serialization/checkpoint-format/config changes.

4. Issue Summary

# Issue Location Severity
1 (new, non-blocking) failFast guard's fail-fast message hides the actual root-cause exception from inside the job future ElasticsearchSchemaChangeIT.java:143-150 Low
2 (carryover, non-blocking) DatabendCDCSinkIT's FLINK_1_18 disable still has no CI citation in the PR description DatabendCDCSinkIT.java:75 Low

Both previously-open High items from my last review are addressed in this commit:

  • FtpFileIT.java:534 Thread.sleep regression — fixed, exact restoration, confidently stable.
  • elasticsearch-connector-it red on ElasticsearchIT/ElasticsearchSchemaChangeIT — addressed via a real architectural change (container lifecycle), well-reasoned from source, but not yet CI-confirmed on this exact head (fork run was queued at review time).

5. Merge Recommendation

Conclusion: Not recommended for merge

I want to be clear this is not because I found a code defect in this round's diff — I didn't. It's because this PR's specific, repeated history with elasticsearch-connector-it (two prior rounds where a fix that checked out cleanly on inspection still failed CI with the identical "observed 0 documents" signature) means I don't think "this reasoning looks right" is sufficient evidence on its own for this particular suite anymore. I'd be glad to convert this to an approval as soon as the fork's own CI run for df8625496496 completes clean on elasticsearch-connector-it (and ideally the rest of the matrix, given the branch is also still diverged 12/12 from dev).

Blockers (must confirm, not "must fix"):

  1. A completed, clean fork CI run for elasticsearch-connector-it on head df8625496. The run (nzw921rx/seatunnel run 33040533660) was queued at review time — please share the result once it finishes, or ping me and I'll take a final pass.

Recommended fixes — non-blocking:

  • Issue 1 — surface the real exception from jobFuture when the failFast guard trips in ElasticsearchSchemaChangeIT, instead of only the generic Awaitility message.
  • Issue 2 (carryover) — add a CI-run citation for the DatabendCDCSinkIT FLINK_1_18 disable.
  • Worth a quick sanity check once CI is green: confirm ElasticsearchIT's newly-shared, long-lived ES container doesn't trade the old "container not ready yet" flakiness for a different one (heap/shard pressure) over its ~90 create/drop cycles per run.

Overall assessment: genuine, well-targeted progress. The FtpFileIT fix closes out a real regression cleanly, and the ElasticsearchIT container-lifecycle change is the first attempt in this whole saga that goes after the actual mechanism behind the repeated Elasticsearch failures rather than another value tweak — my source trace supports it as a plausible and probably-correct fix. Once this exact head's fork CI actually confirms that, I don't expect to have anything further to add on the code itself.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follow-up on my last review (df8625496, "Not recommended for merge," sole blocker: "a completed, clean fork CI run for elasticsearch-connector-it" on run nzw921rx/seatunnel 33040533660, which was queued at review time). That run has since completed — sharing the result rather than waiting to be pinged, since it's a mixed outcome worth being precise about.

elasticsearch-connector-it finished FAILURE, but not uniformly. Breaking it down by the two test classes this round's commit touched:

  • ElasticsearchIT (the @BeforeEach→@BeforeAll container-lifecycle change): passed. It's not among the errors in either the (8) or (11) job's Surefire summary, so the specific "observed 0 documents" failure mode this class hit in rounds 7-8 did not recur here. That's positive evidence for the lifecycle-change reasoning in my last review, though one clean run on a suite with this specific history is still one data point, not closure.
  • ElasticsearchSchemaChangeIT: failed again, with the identical signature as before:
    [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 336.16 s <<< FAILURE!
     - in org.apache.seatunnel.e2e.connector.elasticsearch.ElasticsearchSchemaChangeIT
    Caused by: org.opentest4j.AssertionFailedError: expected: <9> but was: <0>
        at ...ElasticsearchSchemaChangeIT.lambda$testSchemaChange$2(ElasticsearchSchemaChangeIT.java:167)
    
    This is the same "expected N but was 0" pattern from rounds 7-8, and it did not go through the failFast guard this commit added (jobFuture.isDone() never tripped — the streaming job was still running when the 5-minute window expired), so Issue 1 from my last review (the guard swallowing the real cause) doesn't apply here either; this ran its full course and asserted an honest 0. So the container-lifecycle fix looks correct for ElasticsearchIT, but whatever is still causing the initial-snapshot index to read back empty in ElasticsearchSchemaChangeIT specifically is unresolved.

Separately, unit-test (8, ubuntu-latest) also failed in this run, but on connector-activemq-e2e's dependency resolution (Could not transfer artifact org.testcontainers:activemq:pom:1.20.1 ... Connection reset) — a Maven Central connectivity blip, unrelated to this PR's diff and to Elasticsearch. Flagging only so it isn't mistaken for a second real regression.

Net: my "Not recommended for merge" conclusion stands, but the open item has narrowed — ElasticsearchIT's lifecycle fix appears to have worked, and the remaining blocker is specifically ElasticsearchSchemaChangeIT still observing 0 documents for the initial snapshot. That test doesn't share ElasticsearchIT's container-restart pattern (it's not part of the 94-invocation class), so the same root cause I traced for ElasticsearchIT likely doesn't apply here — this needs its own investigation into why the initial index write isn't visible by the time the five-minute poll gives up (an ES refresh-interval/indexing-latency question would be my first place to look, separate from container startup timing).

@nzw921rx

Copy link
Copy Markdown
Member Author

Close this PR, the scope of changes is too large. In the future, we will adopt a gradual cleaning mode to reduce the impact range.

@nzw921rx nzw921rx closed this Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants