-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Testing Infrastructure
-
None
-
Fully Compatible
-
QI 2025-02-17
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The change stream sharding FSM resume test spawns a fresh worker thread for every resume point it verifies. Each thread re-imports the full module graph and sets up its own connection, a fixed cost of roughly 0.6-1.3s that dominates the very short reads these threads perform. With dozens of resume points per collection and several collections per test, that fixed cost is paid hundreds of times.
This change replaces the "one thread per resume point" sliding window with a small pool of worker threads. Each worker processes several resume points sequentially, reusing one module import and one connection, while still opening a fresh cursor and signaling completion independently for each point. Verification behavior and coverage are unchanged.
- Added a batched reader entry point that runs a list of reader configs on a single background thread, reusing one connection and one module import for the whole batch. Each config still opens its own cursor and notifies completion independently, so per-point synchronization is unchanged.
- A failure in one config is logged, its completion is still signaled so waiters do not hang, the remaining configs are still processed, and the first error is rethrown so thread failures are still reported at teardown.
- Reworked the prefix/resume verification test case to build all resume-point configs up front, distribute them round-robin across a fixed-size worker pool, and then verify each point. The previous sliding window is removed.
- Split config construction from launching so the verifier can build a resume-point config without immediately spawning a thread.
Measured on the resume FSM test (62 resume points per collection, 8 workers):
- Effective wall time per resume point: ~2.65s -> ~1.77s (~33% reduction).
- Resume verification per collection: ~20.5s -> ~13-15s (~6-7s saved per collection, ~20s across the test's three verifications).
Whole-test wall time is dominated by serialized reshard DDL in the writers, whose runtime varies with the random command seed, so the total is not a reliable signal; the isolated resume-verification timing is.