Fix replica stuck behind primary after stale segrep retry - #22099
Conversation
A segment replication retry can finalize against a stale metadata checkpoint returned by the primary (see opensearch-project#20550, opensearch-project#20551), leaving the replica behind the checkpoint it was asked to sync to. This leads to the replica being stale until the next publish. If another publish never happens, it is stale forever. I believe this is the case of flakiness in FullRollingRestartIT where the test fails on timeout waiting for the replica to catch up. The fix is to compare against the replica's achieved checkpoint instead so a round that finalized behind its target retriggers catch-up. In the normal case the achieved checkpoint matches the target, so no extra rounds are introduced. Signed-off-by: Andrew Ross <andrross@amazon.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
FYI @guojialiang92 Issue #20610 seems like the right direction to me, but I think this fix is needed regardless. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #22099 +/- ##
============================================
- Coverage 73.52% 73.40% -0.12%
+ Complexity 75682 75583 -99
============================================
Files 6038 6038
Lines 343009 343012 +3
Branches 49348 49349 +1
============================================
- Hits 252189 251790 -399
- Misses 70746 71225 +479
+ Partials 20074 19997 -77 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A segment replication retry can finalize against a stale metadata checkpoint returned by the primary (see #20550, #20551), leaving the replica behind the checkpoint it was asked to sync to. This leads to the replica being stale until the next publish. If another publish never happens, it is stale forever. I believe this is the case of flakiness in FullRollingRestartIT where the test fails on timeout waiting for the replica to catch up. The fix is to compare against the replica's achieved checkpoint instead so a round that finalized behind its target retriggers catch-up. In the normal case the achieved checkpoint matches the target, so no extra rounds are introduced.
Related Issues
Resolves #18490
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.