-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Return empty CommitID from ShadowEngine#flush #11554
Conversation
here is the CI link http://build-us-00.elastic.co/job/es_core_16_strong/37/consoleFull |
} | ||
// we have to read this in a loop since there is a potential race-condition between reading | ||
// the segment info and reading the commit ID/ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while(true) doesn't seem right. Should this be done in a FindSegmentsFile block to remove the race?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think doing it in a FindSegmentsFile
block would be better, but there is still going to be a race condition on actually reading the segments file, so it will still need to be in a loop?
@s1monw that sounds fine to me, if we don't need the CommitID why even read it at all then? Why not always return an empty one? |
+1 on an empty commit ID all the time. The only use case for it now is the synced flush which isn't supported anyway on ShadowEngines. |
@@ -155,7 +158,9 @@ public CommitId flush(boolean force, boolean waitIfOngoing) throws EngineExcepti | |||
} finally { | |||
store.decRef(); | |||
} | |||
return id; | |||
// We can just return an empty commit ID since this is a read only engine that | |||
// doesn't modify anything so the content of this ID doesn't really matter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a little note about avoiding race conditions between read and writes on a shared FS ? I think this will people we not see why we opted to EMPTY_COMMIT_ID
LGTM. Left one trivial comment |
9aba2e2
to
72acf7b
Compare
This change removes CommitID reading for 1.x indices to prevent raceconditions on shared FS for shadow engines where null is returned if a race happens. We now simply return an empty commit ID which is not needed on shadow engines anyway.
this change removes CommitID reading for 1.x indices to prevent raceconditions on shared FS for shadow engines where null is returned if a race happens. We now simply return an empty commit ID which is not needed on shadow engines anyway.