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 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

@jackysp jackysp requested review from tiancaiamao, winoros and lysu Oct 29, 2018
config/config.go Show resolved Hide resolved
@@ -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

This comment has been minimized.

Copy link
@lysu

lysu Oct 29, 2018

Member

IMHO, adapator.go:351 also need change to atomic.LoadUnit64 to keep visibility guarantee?

@morgo

This comment has been minimized.

Copy link
Contributor

morgo commented Oct 29, 2018

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

@jackysp

This comment has been minimized.

Copy link
Member Author

jackysp commented Oct 31, 2018

PTAL @lysu

@lysu

This comment has been minimized.

Copy link
Member

lysu commented Oct 31, 2018

LGTM

Copy link
Contributor

XuHuaiyu left a comment

Should we set the value read from the config file in main.go?
#7729 can be referred.

@jackysp

This comment has been minimized.

Copy link
Member Author

jackysp commented Nov 5, 2018

Copy link
Contributor

XuHuaiyu left a comment

LGTM

@XuHuaiyu

This comment has been minimized.

Copy link
Contributor

XuHuaiyu commented Nov 5, 2018

/run-all-tests

@zz-jason zz-jason merged commit ec693ce into pingcap:master Nov 5, 2018
4 checks passed
4 checks passed
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details
jackysp added a commit to jackysp/tidb that referenced this pull request Nov 5, 2018
jackysp added a commit to jackysp/tidb that referenced this pull request Nov 5, 2018
jackysp added a commit that referenced this pull request Nov 5, 2018
…ld dynamically (#8094) (#8173)
zz-jason added a commit that referenced this pull request Nov 5, 2018
@jackysp jackysp deleted the jackysp:slow_threshold branch Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.