leonardBang opened a new pull request, #4643: URL: https://github.com/apache/flink-cdc/pull/4643
## What is the purpose of this pull request? Fix test-harness defects found while investigating recurring CI failures in the November 2–December 2 window. The changes address snapshot split submission in MySQL reader tests, TiDB readiness before test initialization, and incorrect success/timeout handling in pipeline job waits. The scope is 11 Java files under `src/test/java` and one line in the CI module-selection script. No production implementation, POM, logging configuration, dependency, restart budget, or data-correctness assertion is changed. ## Brief change log ### 1. Submit every MySQL snapshot split after the previous worker finishes `SnapshotSplitReaderTest` and `BinlogSplitReaderTest` previously submitted the next split only when `reader.isFinished()` was already true. Consuming the end marker can empty the record queue before the worker finishes cleanup. In that interval, the helper silently skipped the next split instead of waiting. Extract the shared test helper, wait up to 30 seconds for the previous worker, then submit the next split unconditionally. Close readers in `finally` blocks. A deterministic regression reproduces the cleanup gap and checks that both splits are submitted and consumed. The existing complete-row and backfill assertions remain intact. Historical failing case: `SnapshotSplitReaderTest.testMultipleSplitsWithBackfill`. The logs contain rows 101–108, including the earlier backfill updates, but miss the final split's rows 109/110: - [Failed CI job 125036260544](https://github.com/apache/flink-cdc/actions/runs/41369346292/job/125036260544) - [Repeated failure 127760005220](https://github.com/apache/flink-cdc/actions/runs/42176674677/job/127760005220) Commit: `669ed9539372a46958d05b2c1794e441c463fc8b`. ### 2. Wait for TiDB to accept SQL before initializing test tables The container port can be open before TiDB can complete a JDBC handshake and execute queries. Add a bounded JDBC connection plus `SELECT 1` probe before initialization DDL, with a maximum wait of two minutes. Retry `SQLException` and its subclasses; propagate non-SQL errors immediately. Each probe closes its connection, statement and result set. Test JDBC connections use 5-second connect and 10-second socket timeouts. DDL and CDC processing are not retried by this helper. Add regressions for connection failure followed by query failure and eventual readiness, resource closure, and immediate propagation of non-SQL errors. Add `flink-cdc-e2e-utils` to the existing core CI module list so these regressions actually run during CI verification. Dependency builds alone skip tests and did not provide that coverage. Historical failing case: `TiDBE2eITCase.testTIDBCDC`. Initialization in `before()` fails with handshake EOF / `CommunicationsException`, before CDC result validation: - [Failed CI job 125829879717](https://github.com/apache/flink-cdc/actions/runs/41610200452/job/125829879717) - [Repeated failure 132266958708](https://github.com/apache/flink-cdc/actions/runs/43536579715/job/132266958708) Commit: `1d0e9f85b6bc37cab4810a5abf8c5175ae3617ee`. ### 3. Fail pipeline waits correctly and preserve failure diagnostics Both shared job-state wait overloads previously returned normally when their deadline expired. When waiting for a terminal state such as `FINISHED`, they also failed to reject a different terminal state such as `FAILED`. A test could consequently spend additional minutes waiting for sink output after its job had already failed. Use a shared bounded status waiter: return only on the expected state, reject other terminal states immediately, and fail on timeout with the last observed status and request error. Bound REST future waits by the remaining deadline, avoid a busy polling loop, and preserve the interruption flag. On failure, print the buffered JobManager and TaskManager logs through the existing test logger. The schema recovery test now waits for the submitted job's ID. The shared implementation preserves compatibility with existing subclass overrides. Add 12 regressions covering both wait modes, expected and unexpected terminal states, unfinished/missing jobs, filtering other job IDs, unavailable/unresponsive REST requests, and interruption. Run them through the existing stage2 E2E execution as `JobStatusWaiterITCase`; these regressions inject status responses and do not start containers. No POM change is needed. Historical failing cases motivating the wait and diagnostic improvements: - `RouteE2eITCase.testExtremeMergeTableRoute(boolean)[1]` (`batch=true`): [failed CI job 126330152504](https://github.com/apache/flink-cdc/actions/runs/41613860613/job/126330152504). - `SchemaCoordinatorRecoveryE2eITCase.recoversFailedSchemaChangeAndContinues(boolean)[1]` (regular schema behavior), expected `FINISHED`, actual `FAILED`: [failed CI job 142540645404](https://github.com/apache/flink-cdc/actions/runs/46618180609/job/142540645404). This change fixes the test wait semantics and captures diagnostics. The underlying Route/recovery job failure causes remain unconfirmed and are not claimed as fixed by this PR. Commit: `bfd933c22296af615bc4b0fbc3eb5220a2bf42ac`. ## Verifying this change Local validation used Amazon Corretto Java 11.0.25 and Maven 3.9.9: | Validation | Flink 1.20.3 | Flink 2.2.0 (`-Pflink2`) | | --- | --- | --- | | `SnapshotSplitReaderTestUtilsTest`, `SnapshotSplitReaderTest`, `BinlogSplitReaderTest` | 34 passed | 34 passed | | `JdbcProxyTest` | 2 passed | 2 passed | | `JobStatusWaiterITCase`, through the existing stage2 execution | 12 passed, none skipped | 12 passed, none skipped | | `flink-cdc-e2e-utils verify`, without a `-Dtest` override | JDBC regressions executed and passed | JDBC regressions executed and passed | | Pipeline E2E dependency reactor `clean install` with tests skipped | passed | passed | The MySQL/JDBC results come from the preceding validation of their unchanged Java logic. The pipeline regressions were rerun under both profiles after moving them to the existing stage2 execution. Spotless apply/check, Checkstyle on all four affected modules, and `git diff --check` passed. Regression checks also confirmed that restoring the old split-submission behavior fails the new MySQL test, a single-attempt JDBC probe fails the readiness regression, and restoring the old pipeline terminal/timeout behavior fails 8 of the 12 status regressions. To run the pipeline status regressions using the existing Maven execution (add `-Pflink2` for Flink 2.2): ```sh mvn -B -ntp \ -pl flink-cdc-e2e-tests/flink-cdc-pipeline-e2e-tests \ '-De2eIncludePattern=**/stage2/JobStatusWaiterITCase.java' \ -DskipYarnTest=true -Dflink.release.download.skip=true -Dmdep.skip=true \ test-compile surefire:test@end-to-end-tests ``` Full TiDB, Route and schema recovery container E2E tests and the Java 17 matrix have not been rerun locally. The targeted tests verify the helper behavior; actual CI stability still needs confirmation from CI runs. ## Documentation - Does this pull request introduce a new feature? No. - How is the feature documented? Not applicable; test-harness and CI coverage changes only. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Codex (GPT-6). Generated-by: Codex (GPT-6) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
