Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Remote Store] Fix refresh lag bug on primary term change #10918

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Incorporate PR review feedback
Signed-off-by: Ashish Singh <ssashish@amazon.com>
  • Loading branch information
ashking94 committed Oct 25, 2023
commit e6eece590156bce83c0892ea51b4f838807ee7d5
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ protected boolean performAfterRefreshWithPermit(boolean didRefresh) {
* This checks if there is a sync required to remote.
*
* @param didRefresh if the readers changed.
* @param avoidPrimaryTermChange consider change in primary term or not for should sync
* @param skipPrimaryTermCheck consider change in primary term or not for should sync
* @return true if sync is needed
*/
private boolean shouldSync(boolean didRefresh, boolean avoidPrimaryTermChange) {
private boolean shouldSync(boolean didRefresh, boolean skipPrimaryTermCheck) {
boolean shouldSync = didRefresh // If the readers change, didRefresh is always true.
// The third condition exists for uploading the zero state segments where the refresh has not changed the reader
// reference, but it is important to upload the zero state segments so that the restore does not break.
Expand All @@ -173,7 +173,7 @@ private boolean shouldSync(boolean didRefresh, boolean avoidPrimaryTermChange) {
// we update the primary term and the same condition would not evaluate to true again in syncSegments.
// Below check ensures that if there is commit, then that gets picked up by both 1st and 2nd shouldSync call.
|| isRefreshAfterCommitSafe();
if (shouldSync || avoidPrimaryTermChange) {
if (shouldSync || skipPrimaryTermCheck) {
return shouldSync;
}
return this.primaryTerm != indexShard.getOperationPrimaryTerm();
Expand Down