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 global/instance variable to config top sql #24934

Merged
merged 16 commits into from
May 31, 2021

Conversation

crazycs520
Copy link
Contributor

Signed-off-by: crazycs [email protected]

Trace issue: #24875

What problem does this PR solve?

This PR adds the following instance/global variable to config Top SQL feature:

	// TiDBEnableTopSQL indicates whether the top SQL is enabled.
	TiDBEnableTopSQL = "tidb_enable_top_sql"

	// TiDBTopSQLAgentAddress indicates the top SQL agent address.
	TiDBTopSQLAgentAddress = "tidb_top_sql_agent_address"

	// TiDBTopSQLPrecisionSeconds indicates the top SQL precision seconds.
	TiDBTopSQLPrecisionSeconds = "tidb_top_sql_precision_seconds"

	// TiDBTopSQLMaxStatementCount indicates the max number of statements been collected.
	TiDBTopSQLMaxStatementCount = "tidb_top_sql_max_statement_count"

What is changed and how it works?

N/A

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn: WIP?

Check List

Tests

  • Unit test

Side effects

  • N/A

Release note

  • No release note

@crazycs520 crazycs520 requested a review from a team as a code owner May 27, 2021 11:05
@crazycs520 crazycs520 requested review from wshwsh12 and removed request for a team May 27, 2021 11:05
@ti-chi-bot ti-chi-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 27, 2021
@crazycs520 crazycs520 mentioned this pull request May 27, 2021
7 tasks
@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-all-tests

executor/set.go Outdated Show resolved Hide resolved
domain/sysvar_cache.go Outdated Show resolved Hide resolved
config/config.go Outdated
@@ -137,7 +145,7 @@ type Config struct {
DelayCleanTableLock uint64 `toml:"delay-clean-table-lock" json:"delay-clean-table-lock"`
SplitRegionMaxNum uint64 `toml:"split-region-max-num" json:"split-region-max-num"`
StmtSummary StmtSummary `toml:"stmt-summary" json:"stmt-summary"`
TopSQL TopSQL `toml:"top-sql" json:"top-sql"`
TopSQL TopSQL `toml:"-" json:"-"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why the toml and json names are blanked out - is the goal to no longer specify them in toml, but instead use them in sysvars?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the TopSQL feature doesn't want to provide a config item in the TiDB config file, only provide the instance/global variable to control.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@breeswish PTAL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because I think it is hard for the user to understand in this situation:

The user changes the config item in config file and restart the TiDB server, then which value takes effect? the config value or the global variable value? It will confuse the user.

Copy link
Member

Choose a reason for hiding this comment

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

As an instance config that is not placed in the config file, is it necessary to be inside the config.go?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just for coding convenience. Of course, we can use a unique global variable to do it. Should we ?

Copy link
Contributor Author

@crazycs520 crazycs520 May 28, 2021

Choose a reason for hiding this comment

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

I will add a new global variable to store the TopSQL config, and remove it from config pkg.

@crazycs520
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 28, 2021
@tangenta tangenta requested a review from morgo May 28, 2021 08:48
@crazycs520
Copy link
Contributor Author

@morgo PTAL, thanks~~

@morgo
Copy link
Contributor

morgo commented May 31, 2021

/LGTM

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • morgo
  • tangenta

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 31, 2021
@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: e86fa65

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 31, 2021
@crazycs520
Copy link
Contributor Author

/run-unit-test

@crazycs520
Copy link
Contributor Author

/run-check_dev_2

@crazycs520
Copy link
Contributor Author

/run-unit-test

1 similar comment
@crazycs520
Copy link
Contributor Author

/run-unit-test

Signed-off-by: crazycs <[email protected]>
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label May 31, 2021
@crazycs520
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 38f257a

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 31, 2021
@ti-chi-bot
Copy link
Member

@crazycs520: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit 702c86b into pingcap:master May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/config sig/execution SIG execution sig/sql-infra SIG: SQL Infra size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants