[V1] Fix Vector Set Creation Live Lock#1852
Merged
Merged
Conversation
…r vector set creation to live lock; this fixes that by, should initial creation be necessary, switching to an exclusive acquisition iff the 'cheap' promotion fails
…, needs a refactor
…adOptimizedLock; cleanup VectorSet locking as part of adopting type
Contributor
There was a problem hiding this comment.
Pull request overview
Cherry-picks the Vector Set lock acquisition changes from #1846 onto the v1 branch to eliminate a contention-induced live lock during Vector Set index (re)creation by adjusting the shared→exclusive promotion strategy.
Changes:
- Adds a typed
ReadOptimizedLock.LockTokenand a unifiedReleaseLock(...)API (replacing separate shared/exclusive release methods). - Updates Vector Set locking to fall back to acquiring an initial exclusive lock after a failed promotion attempt, avoiding repeated promotion failures under contention.
- Updates
ReadOptimizedLocktests to use the new token/release APIs and ref-based promotion.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| test/Garnet.test/ReadOptimizedLockTests.cs | Updates tests to use LockToken, ReleaseLock, and ref-based promotion. |
| libs/server/Resp/Vector/VectorManager.Locking.cs | Implements the livelock fix by switching to initial exclusive acquisition after failed promote; consolidates lock scope types. |
| libs/common/ReadOptimizedLock.cs | Introduces LockToken, unifies release logic, and updates acquire/promote APIs accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
badrishc
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picking #1846 onto v1 to keep Vector Set parity.
We're getting pretty close to stopping backports to V1, but since #1726 will land against v1 I'd like to keep parity for a bit longer.