SEPURI-SAI-KRISHNA opened a new pull request, #13450: URL: https://github.com/apache/seatunnel/pull/13450
Yes, glad to contribute to Apache SeaTunnel. ### Purpose of this pull request `MongodbSinkOptionDefaultsTest` (added in #13200) fails now and then on the Windows unit-test lane: - `explicitRetryIntervalIsStillApplied`: `expected a back-off of at least 50 ms before retry 1, got 49 ms` ([run](https://github.com/SEPURI-SAI-KRISHNA/seatunnel/actions/runs/45534228132/job/138937879254), JDK 11) - the same test with 99 ms for 100 ms, reported in the [#13412 review](https://github.com/apache/seatunnel/pull/13412#pullrequestreview-6043056707) The test measures the gap between two attempts with `System.nanoTime()`, truncates it to whole milliseconds and requires at least the configured interval. `MongodbWriter` waits with `TimeUnit.MILLISECONDS.sleep(retryIntervalMs * (i + 1))`, which is only as precise as the system timer, so the measured gap can be slightly shorter than requested. The change, test only: `assertBackOffAtLeast` compares in nanoseconds and allows `TIMER_TOLERANCE_MS = 16` (one Windows timer tick, about 15.6 ms). The checks still tell the cases apart: | Case | Required gap | Measured when broken | |---|---|---| | default `retry.interval` (1000 ms), retry 1 | 984 ms | 0.3 ms without the wait | | explicit 50 ms, retry 1 | 34 ms | 0.3 ms without the wait | | explicit 50 ms, retry 2 (linear) | 84 ms | 51 ms with a constant back-off | ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Locally on Linux, JDK 17: - `MongodbSinkOptionDefaultsTest` 8/8, the whole `connector-mongodb` module 71/71. - Production code changed on purpose, one at a time, then restored: - no wait (`sleep(0)`): `omittedRetryIntervalUsesDeclaredDefault` and `explicitRetryIntervalIsStillApplied` fail (0.3 ms); - constant back-off (`sleep(retryIntervalMs)`): `explicitRetryIntervalIsStillApplied` fails on retry 2 (51 ms); - every wait 5 ms short, to reproduce the Windows failure: the old test fails with 46 ms for 50 ms and 996 ms for 1000 ms, the new one passes. - `spotless:check`, `git diff --check`. Not verified: a run on Windows itself; the Windows lane of this PR's CI is the check for that. ### 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) * [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs (not needed, test only) * [x] If necessary, please update `incompatible-changes.md` to describe the incompatibility caused by this PR. (not needed) * [x] 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]
