Skip to content
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

Merged
merged 5 commits into from
Nov 5, 2018

Conversation

jackysp
Copy link
Member

@jackysp jackysp commented Oct 29, 2018

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

  • Unit test

Code changes

  • Has exported function/method change

  • Need to cherry-pick to the release branch

PTAL @tiancaiamao @lysu

@@ -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
Copy link
Contributor

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?

@morgo
Copy link
Contributor

morgo commented Oct 29, 2018

LGTM. I like that it is in ms, and the default is 300.

@jackysp
Copy link
Member Author

jackysp commented Oct 31, 2018

PTAL @lysu

@lysu
Copy link
Contributor

lysu commented Oct 31, 2018

LGTM

@jackysp jackysp added type/enhancement The issue or PR belongs to an enhancement. priority/release-blocker This issue blocks a release. Please solve it ASAP. labels Nov 5, 2018
Copy link
Contributor

@XuHuaiyu XuHuaiyu left a 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.

@jackysp
Copy link
Member Author

jackysp commented Nov 5, 2018

Won't support this until we support https://dev.mysql.com/doc/refman/8.0/en/persisted-system-variables.html.

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Nov 5, 2018

/run-all-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/release-blocker This issue blocks a release. Please solve it ASAP. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants