-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: add a variable tidb_slow_log_threshold to set the slow log threshold dynamically #8094
Conversation
@@ -85,6 +85,8 @@ func GetSessionOnlySysVars(s *SessionVars, key string) (string, bool, error) { | |||
return string(j), true, nil | |||
case TiDBForcePriority: | |||
return mysql.Priority2Str[mysql.PriorityEnum(atomic.LoadInt32(&ForcePriority))], true, nil | |||
case TiDBSlowLogThreshold: | |||
return strconv.FormatUint(atomic.LoadUint64(&config.GetGlobalConfig().Log.SlowThreshold), 10), true, nil |
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.
IMHO, adapator.go:351
also need change to atomic.LoadUnit64
to keep visibility guarantee?
LGTM. I like that it is in |
PTAL @lysu |
LGTM |
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.
Should we set the value read from the config file in main.go?
#7729 can be referred.
Won't support this until we support https://dev.mysql.com/doc/refman/8.0/en/persisted-system-variables.html. |
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
/run-all-tests |
What problem does this PR solve?
Changing the slow log threshold in TiDB needs to reboot the server to affect.
What is changed and how it works?
Add a variable "tidb_slow_log_threshold" to set the threshold by SQL.
Check List
Tests
Code changes
Has exported function/method change
Need to cherry-pick to the release branch
PTAL @tiancaiamao @lysu