Trigger search replica sync when scaling down to search-only - #21370
Trigger search replica sync when scaling down to search-only#21370HUSTERGS wants to merge 4 commits into
Conversation
Signed-off-by: gesong.samuel <gesong.samuel@bytedance.com>
PR Reviewer Guide 🔍(Review updated until commit e0cac9f)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to e0cac9f Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit b1d72c1
Suggestions up to commit ba918d3
Suggestions up to commit 06b097f
|
|
❌ Gradle check result for 06b097f: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit ba918d3 |
|
❌ Gradle check result for ba918d3: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit b1d72c1 |
|
❌ Gradle check result for b1d72c1: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit e0cac9f |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21370 +/- ##
============================================
+ Coverage 73.40% 73.42% +0.01%
- Complexity 74262 74321 +59
============================================
Files 5961 5961
Lines 337610 337625 +15
Branches 48704 48709 +5
============================================
+ Hits 247833 247910 +77
+ Misses 69954 69940 -14
+ Partials 19823 19775 -48 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This change triggers a final Remote Store segment sync on search-only replicas when an index transitions into search-only mode.
During scale down, primary shards already perform a final sync/flush and wait for Remote Store sync before the final metadata transition. Search-only replicas, however, are not part of checkpoint publishing and normally catch up through
IndexService.AsyncReplicationTask.Once
index.blocks.search_only=trueis applied, the regular replication task stops becauseAsyncReplicationTask#shouldRun()returns false. If a search-only replica has not already pulled the latest Remote Store segments before that metadata update, it can continue serving stale results after scale down completes.This PR fixes that gap by:
IndexService#updateMetadata.updateReplicationTask.AsyncReplicationTaskas before.AsyncReplicationTask#forceSyncSegments.maybeSyncSegments(true)so the existing search-only shard filtering and Remote Store sync path are preserved.mustReschedule()before enqueueing and again at execution time to respect index lifecycle conditions.The forced sync is asynchronous and does not add search replica catch-up to the scale-down critical path.
Related Issues
Resolves #21369
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.