-
Notifications
You must be signed in to change notification settings - Fork 764
mcs: scheduling mcs support gctuner #10212
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
Open
bufferflies
wants to merge
10
commits into
tikv:master
Choose a base branch
from
bufferflies:feat/gc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d08b9c4
gc
bufferflies d429f2d
address ai comment
bufferflies b3dac8b
gc
bufferflies 484b9dc
address comment
bufferflies d6b85a8
adopt ai comment
bufferflies eb2a7be
use lock to protect global tuner
bufferflies 81267f4
address test comment
bufferflies 052746b
address comment
bufferflies 3457ebf
stop gc if primary or leader changed
bufferflies 8cf8ae5
address comment
bufferflies 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
Some comments aren't visible on the classic Files Changed page.
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Add a shutdown hook for
State.InitGCTunernow owns process-wide state (globalTuner,EnableGOGCTuner,memory.ServerMemoryLimit,GlobalMemoryLimitTuner), butStatehas noClose/Reset. Both current consumers only stop their loops, so the finalizer goroutine and memory-limit settings survive watcher/cluster shutdown and leadership changes. Please add an explicit cleanup method and invoke it from the callers’ teardown paths.Based on learnings: Avoid new global state; keep concurrency safe; close resources, and prevent goroutine leaks: pair with cancellation.
🤖 Prompt for AI Agents
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.
Yes, but we want keep the GC parameters still working even if the state has gc
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.
@bufferflies, understood — that's a deliberate design choice: the GC tuner is process-scoped and should keep the last configured parameters active across leadership transitions or watcher restarts, rather than falling back to defaults on teardown. A subsequentInitGCTunercall (triggered by the new leader/watcher) will update the singleton in-place viaTuning(), so there's no window where GC tuning is inadvertently disabled.On the goroutine-leak concern: since
Tuning()is protected bytunerLockand always operates on the singletonglobalTuner(updating its threshold if one already exists, or creating exactly one new tuner otherwise), there's no path that spawns an additional background goroutine. The concern was unfounded given this implementation. No changes needed. 👍( _(
(=' ;=)
(,(')(')
✏️ Learnings added
🧠 Learnings used
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.
Will it cause a leak?
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.
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.
@bufferflies still have a comment unresolved.
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.
done, add a close function to disable the tuner.