-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Move uid lock into LiveVersionMap #27905
Conversation
While the LiveVersionMap is an internal class that belongs to the engine we do rely on some external locking to enforce the desired semantics. Yet, in tests we mimic the outer locking but we don't have any way to enforce or assert on that the lock is actually hold. This change moves the KeyedLock inside the LiveVersionMap that allows the engine to access it as before but enables assertions in the LiveVersionMap to ensure the lock for the modifying or reading key is actually hold.
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
private Releasable acquireLock(BytesRef uid) { | ||
return keyedLock.acquire(uid); | ||
} | ||
|
||
private Releasable acquireLock(Term uid) { |
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 we can clean this method up - it doesn't add much but craft and at least in one place we go and do the same conversion later on - might as well capture it as a value on the caller
try (Releasable ignore = acquireLock(get.uid())) { // we need to lock here to access the version map to do this truly in RT
+ versionValue = getVersionFromMap(get.uid().bytes());
+ }
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 am not sure I follow
While the LiveVersionMap is an internal class that belongs to the engine we do rely on some external locking to enforce the desired semantics. Yet, in tests we mimic the outer locking but we don't have any way to enforce or assert on that the lock is actually hold. This change moves the KeyedLock inside the LiveVersionMap that allows the engine to access it as before but enables assertions in the LiveVersionMap to ensure the lock for the modifying or reading key is actually hold.
* es/6.x: (43 commits) ingest: upgraded ingest geoip's geoip2's dependencies. [TEST] logging for update by query test #27820 Use full profile on JDK 10 builds Require Gradle 4.3 Add unreleased v6.1.2 version TEST: reduce blob size #testExecuteMultipartUpload Check index under the store metadata lock (#27768) Upgrade to Lucene 7.2.0. (#27910) Fixed test to be up to date with the new database files. Use `_refresh` to shrink the version map on inactivity (#27918) Make KeyedLock reentrant (#27920) Fixes DocStats to not report index size < -1 (#27863) Disable TestZenDiscovery in cloud providers integrations test ingest: Upgraded the geolite2 databases. [Issue-27716]: CONTRIBUTING.md IntelliJ configurations settings are confusing. (#27717) [Test] Fix IndicesClientDocumentationIT (#27899) Move uid lock into LiveVersionMap (#27905) Mute testRetentionPolicyChangeDuringRecovery Increase Gradle heap space to 1536m Move GlobalCheckpointTracker and remove SequenceNumbersService (#27837) ...
While the LiveVersionMap is an internal class that belongs to the engine we do
rely on some external locking to enforce the desired semantics. Yet, in tests
we mimic the outer locking but we don't have any way to enforce or assert on
that the lock is actually hold. This change moves the KeyedLock inside the
LiveVersionMap that allows the engine to access it as before but enables
assertions in the LiveVersionMap to ensure the lock for the modifying or
reading key is actually hold.