-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Strengthen locking in FsBlobContainer
register impl
#107830
Strengthen locking in FsBlobContainer
register impl
#107830
Conversation
Expands the JVM-wide mutex to prevent all concurrent operations on file-based registers, but then introduces an artificial mechanism for emulating write/write contention within a single JVM.
Pinging @elastic/es-distributed (Team:Distributed) |
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.
Looks good, good idea about the write contention simulation. Can we add tests to demonstrate that contended reads no longer report MISSING (or fail on the assertion)?
Yep, and I think we can strengthen the repo analysis too |
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.
LGTM.
try { | ||
return doUncontendedCompareAndExchangeRegister(registerPath, expected, updated); | ||
} finally { | ||
mutex.close(); |
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.
Is this not handled by the try-with-resource above?
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.
d'oh yes it is
if (r.isPresent()) { | ||
l.onResponse(r); | ||
} else { | ||
l.onFailure(new IllegalStateException("register read failed due to contention")); |
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.
@DaveCTurner raising your attention that it seems to fail AzureSnapshotRepoTestKitIT/testRepositoryAnalysis
(see #108504)
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.
Thanks for the ping, clearly a bug: #108900
Expands the JVM-wide mutex to prevent all concurrent operations on
file-based registers, but then introduces an artificial mechanism for
emulating write/write contention within a single JVM.