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

executor: bootstrap SQLs are not treated as internal queries in statement summary (#17024) #17062

Merged
merged 1 commit into from
May 9, 2020

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented May 9, 2020

cherry-pick #17024 to release-4.0


What problem does this PR solve?

Problem Summary:
Some SQLs executed in bootstrap phase are not marked as internal queries. By default, internal queries are ignored in statement summary. But these SQLs still appear in statement summary.
For example, these SQLs are executed in bootstrap:

select variable_value from mysql.tidb where variable_name = 'system_tz'
select variable_value from mysql.tidb where variable_name = 'new_collation_enabled'

After This PR (after bootstrap):

mysql> select sample_user, exec_count, digest_text from information_schema.statements_summary\G
*************************** 1. row ***************************
sample_user: root
 exec_count: 1
digest_text: show tables
*************************** 2. row ***************************
sample_user: root
 exec_count: 1
digest_text: show databases
*************************** 3. row ***************************
sample_user: root
 exec_count: 1
digest_text: use test
*************************** 4. row ***************************
sample_user: NULL
 exec_count: 2
digest_text: select variable_value from mysql . tidb where variable_name = ?
4 rows in set (0.04 sec)

What is changed and how it works?

What's Changed:
Treat the SQLs whose users are empty as internal queries.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Manual test (add detailed scripts or steps below)
    After(after bootstrap):
mysql> select sample_user, digest_text from information_schema.statements_summary\G
*************************** 1. row ***************************
sample_user: root
digest_text: show tables
*************************** 2. row ***************************
sample_user: root
digest_text: show databases
*************************** 3. row ***************************
sample_user: root
digest_text: use test
3 rows in set (0.01 sec)

Side effects

N/A

Release note

  • Mark bootstrap statements as internal queries in statement summary.

@sre-bot sre-bot requested a review from a team as a code owner May 9, 2020 08:03
@sre-bot
Copy link
Contributor Author

sre-bot commented May 9, 2020

/run-all-tests

Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Deardrops Deardrops left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala merged commit df4efa3 into pingcap:release-4.0 May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants