Await asynchronous checkpoint metrics
Changed the logical state-store metrics test to recollect a complete snapshot until Hazelcast entry-listener counters reflect the state already written to the backing maps.
apache/seatunnel · #12453
Engine CI reliability
Logical checkpoint-metric tests now account for Hazelcast's asynchronous listener updates instead of treating an immediately stale snapshot as a product failure.
Problem
Hazelcast map writes return before asynchronous entry listeners update the AtomicLong counters exported for checkpoint history and running-job metrics. The test scraped once immediately after seeding state, so unrelated CI runs could observe retained history as zero even though the expected entries were already stored.
Approach
Wraps the complete metrics collection and the existing exact assertions in the bounded Awaitility pattern already used by the test class. Each poll obtains a fresh snapshot; all expected values and backend labels remain unchanged, and a genuine failure still surfaces after the existing ten-second bound.
Impact and scope
- Aligns the test with the state stores' real eventually consistent listener-update model.
- Eliminates a demonstrated timing race without adding sleeps or increasing a global timeout.
- Retains every exact metric value and backend-label assertion rather than weakening coverage.
- Uses a read-only collection path, so retries do not mutate engine state or hide side effects.
- Changes one test file only; no production metric, checkpoint, storage, or user-visible behavior was modified.
Validation
- A controlled Java 11 schedule held Hazelcast listener delivery: the unchanged one-shot assertion failed with retained history 0 instead of 2, while the patched test passed after listener delivery resumed.
- Focused checkpoint-overview and logical-metric tests passed with three tests and no failures, errors, or skips; Spotless and diff checks also passed.
- All five hosted checks passed, and both an upstream contributor and an Apache SeaTunnel member approved the authored change before merge.