Skip to content

Commit

Permalink
Addressing comments
Browse files Browse the repository at this point in the history
Signed-off-by: Shourya Dutta Biswas <114977491+shourya035@users.noreply.github.com>
  • Loading branch information
shourya035 committed Jun 6, 2024
1 parent 6358f71 commit ebdc32c
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ protected boolean performAfterRefreshWithPermit(boolean didRefresh) {
* @return true if sync is needed
*/
private boolean shouldSync(boolean didRefresh, boolean skipPrimaryTermCheck) {
// Ignore syncing segments if the underlying shard is closed
// This also makes sure that retries are not scheduled for shards
// with failed syncSegments invocation after they are closed
if (shardClosed()) {
logger.info("Shard is already closed. Not attempting sync to remote store");
return false;
}
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 @@ -179,13 +186,6 @@ private boolean shouldSync(boolean didRefresh, boolean skipPrimaryTermCheck) {
// Below check ensures that if there is commit, then that gets picked up by both 1st and 2nd shouldSync call.
|| isRefreshAfterCommitSafe()
|| isRemoteSegmentStoreInSync() == false;
// Ignore syncing segments if the underlying shard is closed
// This also makes sure that retries are not scheduled for shards
// with failed syncSegments invocation after they are closed
if (shardClosed()) {
logger.info("Shard is already closed, will stop scheduling retries");
return false;
}
if (shouldSync || skipPrimaryTermCheck) {
return shouldSync;
}
Expand Down

0 comments on commit ebdc32c

Please sign in to comment.