SEPURI-SAI-KRISHNA opened a new pull request, #13269:
URL: https://github.com/apache/seatunnel/pull/13269

   Yes, glad to contribute to Apache SeaTunnel.
   
   ### Purpose of this pull request
   
   Fixes #13263.
   
   `TiDBCDCIT` fails in CI in `startUp`, before any job runs, with 
`CommunicationsException: Communications link failure` (EOF, the driver 
received no packet), within a second after testcontainers reports the TiDB 
container as started. `TiDBTestBase` connects as soon as the default port wait 
ends, and that wait does not prove that TiDB serves connections: Docker accepts 
on the mapped port at once, and `HostPortWaitStrategy` (testcontainers 1.21.4) 
does not fail when its check inside the container fails. TiDB v6.1.0 can also 
accept a connection and close it before its greeting, for example when it has 
lost its connection to PD, and logs that at warn level, which `tidb.toml` 
hides. The CI log cannot tell these two causes apart, and waiting until a query 
works covers both. Details and CI links are in the issue.
   
   Change, in `TiDBTestBase.startContainers()` only:
   
   - After the containers start, wait until a connection to TiDB runs `SELECT 
1`, every second for up to 120 seconds (the startup timeout the containers 
already use).
   - Each failed attempt is logged with its error, and the time the wait took 
is logged once it ends, so a CI log shows what TiDB did.
   - If TiDB never answers, the test fails with `IllegalStateException: TiDB 
did not answer queries` instead of a link failure.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Test code only.
   
   ### How was this patch tested?
   
   - `TiDBCDCIT` on Zeta locally: 4 tests, 0 failures (`TiDB answered queries 
after 1371 ms`). TiKV here refuses writes because the local disk is nearly full 
(`tikv disk full`), so for this run only I set `reserve-space = "0MB"` in 
`tikv.toml` and restored the file afterwards; it is not part of this PR. 
Without it, the new wait failed after 120 s with `TiDB did not answer queries`, 
while testcontainers had reported the container as started when TiDB stopped 
during bootstrap.
   - A probe that starts PD, TiKV and TiDB with the same images, commands and 
config files as `TiDBTestBase`, with the port wait of TiDB skipped to force an 
early start, 3 rounds:
   
   | | result |
   | --- | --- |
   | connect right away (as on dev) | the exact CI error at +0 ms, +3 s and +6 
s, in every round |
   | the wait in this PR, then `DROP DATABASE` / `CREATE DATABASE` as 
`initializeTidbTable` does | waited 32.1 to 32.4 s, then the statements 
succeeded, in every round |
   
   - CI on my fork 
([run](https://github.com/SEPURI-SAI-KRISHNA/seatunnel/actions/runs/43361168896)):
 `TiDBCDCIT` 16 tests, 0 failures on JDK 11 and on JDK 17, with `TiDB answered 
queries after 1297 ms` and `after 1308 ms`.
   - `spotless:apply`, and `verify -DskipTests` of `connector-cdc-tidb-e2e`.
   
   ### Check list
   
   * [x] If any new Jar binary package adding in your PR, please add License 
Notice according
     [New License 
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
 (no new jar)
   * [ ] If necessary, please update the documentation to describe the new 
feature. https://github.com/apache/seatunnel/tree/dev/docs (test only)
   * [ ] If necessary, please update `incompatible-changes.md` to describe the 
incompatibility caused by this PR. (no incompatible change)
   * [ ] If you are contributing the connector code, please check that the 
following files are updated: (not a new connector)
   


-- 
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]

Reply via email to