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

*: replace conf item pprof_sql_cpu with srv var tidb_pprof_sql_cpu #14385

Merged
merged 2 commits into from
Jan 9, 2020
Merged

*: replace conf item pprof_sql_cpu with srv var tidb_pprof_sql_cpu #14385

merged 2 commits into from
Jan 9, 2020

Conversation

lysu
Copy link
Contributor

@lysu lysu commented Jan 8, 2020

What problem does this PR solve?

This PR improves #14312 because modifying the config item and reloading it is hard to use, both for human or external tools.

What is changed and how it works?

Replace the config item [performance] pprof_sql_cpu with a server-scope variable tidb_pprof_sql_cpu.

We can execute set tidb_pprof_sql_cpu = 1 before go profiler collection and execute set tidb_pprof_sql_cpu = 0 after tuning is finished.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test

Code changes

  • remove conf
  • add a var
  • add test case

Side effects

  • n/a

Related changes

  • n/a

Release note

  • n/a

This change is Reviewable

@lysu lysu added type/enhancement The issue or PR belongs to an enhancement. component/server needs-cherry-pick-3.0 labels Jan 8, 2020
@lysu lysu requested review from SunRunAway and jackysp January 8, 2020 03:05
@lysu
Copy link
Contributor Author

lysu commented Jan 8, 2020

/run-all-tests

@@ -706,6 +706,7 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal | ScopeSession, TiDBSkipIsolationLevelCheck, BoolToIntStr(DefTiDBSkipIsolationLevelCheck)},
/* The following variable is defined as session scope but is actually server scope. */
{ScopeSession, TiDBGeneralLog, strconv.Itoa(DefTiDBGeneralLog)},
{ScopeSession, TiDBPProfSQLCPU, strconv.Itoa(DefTiDBPProfSQLCPU)},
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

It is another issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we set util.EnablePProfSQLCPU into session.sessionVars?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there are no benefit to attach a server scope var to per session, but we can move it into variable package...moved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As https://github.com/pingcap/tidb/pull/14312/files#diff-dc417f5322100e2e83a8818c70a25878R810, Is it really in session scope?

/* The following variable is defined as session scope but is actually server scope. */

the comments above those variable talk some about this and it seems infra-team have plan to make a real server scope variable in roadmap

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@jackysp jackysp added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 9, 2020
@lysu lysu requested a review from SunRunAway January 9, 2020 05:05
Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

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

LGTM

@SunRunAway SunRunAway added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 9, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Jan 9, 2020

Your auto merge job has been accepted, waiting for 14389

@sre-bot
Copy link
Contributor

sre-bot commented Jan 9, 2020

/run-all-tests

@sre-bot sre-bot merged commit c48d563 into pingcap:master Jan 9, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Jan 9, 2020

cherry pick to release-3.0 failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/server status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants