added checks local lock state before DB insert in shared token selector#1483
Open
Horiodino wants to merge 1 commit intohyperledger-labs:mainfrom
Open
added checks local lock state before DB insert in shared token selector#1483Horiodino wants to merge 1 commit intohyperledger-labs:mainfrom
Horiodino wants to merge 1 commit intohyperledger-labs:mainfrom
Conversation
3f749a5 to
f2f477a
Compare
f2f477a to
7fe8b5a
Compare
Contributor
|
Hi @Horiodino , thanks for submitting this. I'll review ASAP. A first comment though. A cache per selector might not be helpful because other selectors might end up choosing tokens already selected. I would investigate a more global locker instantiated at the manager level and passed to each selector. |
Contributor
|
Hi @Horiodino , did you have time to look at my comment? |
Signed-off-by: Praful <holiodin@gmail.com>
7fe8b5a to
fbad5a3
Compare
Author
|
Hey , i have moved the implementation from a per-selector cache to a shared local lock tracker,different selectors are aware of tokens already locked within the same replica, could you review? , i would fix the conflicts asap if it looks good. |
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.
This PR fixes #886 by adding a local lock check before attempting DB lock insertion in the shared token selector.
The selector now tracks tokens already locked by the current replica and skips duplicate
TryLockcalls for the same token within the same selection cycle. The local lock state is cleared duringUnlockAll().This avoids unnecessary DB round trips and optimistic insert failures when duplicate tokens are returned by the iterator.