Skip to content

HDDS-16081. TestOMRatisSnapshots fails due to leader applied index taken before flush - #10959

Open
ss77892 wants to merge 1 commit into
apache:masterfrom
ss77892:HDDS-16081
Open

HDDS-16081. TestOMRatisSnapshots fails due to leader applied index taken before flush#10959
ss77892 wants to merge 1 commit into
apache:masterfrom
ss77892:HDDS-16081

Conversation

@ss77892

@ss77892 ss77892 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Flaky TestOMRatisSnapshots#testInstallSnapshotWithClientWrite: follower may not have all keys when the leader's last applied index is reached

The test starts a stopped follower OM, writes 200 keys while it catches up, waits for the follower to reach the leader, then reads the follower's RocksDB directly to confirm every key arrived. Sometimes the last few keys aren't there yet. That happens because there is a small gap in which a write has already been acked to the client (and committed to the Ratis log) but not yet flushed to RocksDB. The test relies on the leader's lastAppliedTermIndex, which only advances on flush, so the target it hands the follower can sit behind writes that already returned. Previously, a 5-second sleep made the flush all but certain by the time that index was read. HDDS-10310 replaced it with an index-based wait and dropped the per-key sleeps from the write loop, so the writes now outrun the flush and nothing closes the gap, leaving the test to check the follower's DB for keys that are still queued.
The fix adds a single leaderOM.awaitDoubleBufferFlush() call after the writes complete, so the leader's lastAppliedTermIndex covers them before the test uses it as the follower's target.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-16081

How was this patch tested?

To reproduce it for sure, a small delay (1 ms) has been added to OzoneManagerDoubleBuffer#flush. The test fails all the time in this case. With the fix, it no longer fails.

…rite: follower may not have all keys when the leader's last applied index is reached
@adoroszlai adoroszlai changed the title HDDS-16081. Flaky TestOMRatisSnapshots#testInstallSnapshotWithClientWrite: follower may not have all keys when the leader's last applied index is reached HDDS-16081. TestOMRatisSnapshots fails due to leader applied index taken before flush Aug 6, 2026
@adoroszlai adoroszlai added the test label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants