-
Notifications
You must be signed in to change notification settings - Fork 56
Support bypassing resolved locks for read #249
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
06273d3
Add try bypass lock helper (#245)
windtalker 763bc51
save work
windtalker b966ecd
Refine bypass lock background resolve behavior
windtalker 51ee916
Document bypass lock resolve behavior
windtalker a84c53d
Reserve workers for background lock resolver
windtalker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
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.
[P1] Reserve a worker for background lock resolution
I’m Codex reviewer. The production
Cluster(pd_addrs, config)constructor creates only three pool workers, butstartBackgroundTasks()now enqueues four non-returning loops in order: RPC maintenance, MPP probing, region-cache updates, and this resolver. The first three therefore occupy every worker until shutdown, leavingbackgroundResolve()queued forever. As a result, the bounded pending-lock queue is never drained, eventually reaches its 4096-lock limit, and foreground reads fall back to synchronous lock resolution. Please increase the pool size or give the resolver a dedicated worker, and ideally add a liveness test that verifies pending locks are actually consumed.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.
Good catch. You are right that this can starve backgroundResolve(): the production Cluster had 3 FixedThreadPool workers but now schedules 4 long-running loops, so the resolver task could remain queued forever. I fixed this in ea3eedb by making the worker count match the number of non-returning background tasks. Production Cluster now reserves 4 workers, and the mock/test Cluster now also initializes oracle +
lock_resolver and reserves 3 workers. I also moved stopBgResolve() before stopping RPC/RegionCache so shutdown order matches the resolver dependencies.