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

*: Change stmt summary and capture plan baselines to GLOBAL only #30756

Merged
merged 11 commits into from
Jan 12, 2022

Conversation

morgo
Copy link
Contributor

@morgo morgo commented Dec 16, 2021

What problem does this PR solve?

Issue Number: part of #30557

Problem Summary:

In #30557 it is proposed that we implement INSTANCE scope for system variables using a simplified proposal (instance and global are mutually exclusive). This addresses all the pre-requisite behavior changes, which are related to stmt summary and capture plan baseslines (the features are related).

Merging this PR is predicated on the proposal for simplified INSTANCE scope being approved. If we don't approve the proposal, this PR does not make sense.

Yes, this is a breaking change! It has been approved by @easonn7

What is changed and how it works?

The change is unfortunately quite large, this is because:

  • If it is no longer instance scope, the tie-in to config is obsolete.
  • stmt summary predated sysvar validation (and performed its own validation). When refactoring, it made sense in making the changes that it would switch to using sysvar validation and use the correct types in the internal API.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    I manually tested that the starting of sysvar cache loop correctly sets the global variablse for stmt summary. If you set global tidb_enable_stmt_summary = 0 and restart the tidb server, it will be off.
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Configuration for Statement Summary and Capture Plan Baselines is now only available on a GLOBAL basis. This simplifies configuration from earlier versions of TiDB where it was configurable on an INSTANCE of GLOBAL basis.

@morgo morgo added the compatibility-breaker Violation of forwards/backwards compatibility in a design-time piece. label Dec 16, 2021
@morgo morgo requested a review from a team as a code owner December 16, 2021 01:55
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 16, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Reminiscent
  • djshow832

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 submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 16, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 16, 2021
@morgo
Copy link
Contributor Author

morgo commented Dec 16, 2021

/run-check_dev_2

Copy link
Contributor

@Reminiscent Reminiscent left a comment

Choose a reason for hiding this comment

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

The capture plan baselines part LGTM.

@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 Dec 17, 2021
@Reminiscent
Copy link
Contributor

Another question is if we execute the set tidb_capture_plan_baselines = 1;. The default scope should be transferred from SESSION to GLOBAL. We should update the doc to remind the user.

@morgo
Copy link
Contributor Author

morgo commented Dec 17, 2021

Another question is if we execute the set tidb_capture_plan_baselines = 1;. The default scope should be transferred from SESSION to GLOBAL. We should update the doc to remind the user.

Sorry, just to clarify: did you mean that (a) we should allow session to be specified for compatibiliity, or (b) update the docs so that it correctly lists scope?

For (b) I have a script that auto-generates the correct docs which I then use to create PRs. See pingcap/docs#6838 for an example where I detected changes and updated the docs (I typically run this script every 2 weeks, so it will be caught before GA).

@Reminiscent
Copy link
Contributor

Reminiscent commented Dec 20, 2021

Another question is if we execute the set tidb_capture_plan_baselines = 1;. The default scope should be transferred from SESSION to GLOBAL. We should update the doc to remind the user.

Sorry, just to clarify: did you mean that (a) we should allow session to be specified for compatibiliity, or (b) update the docs so that it correctly lists scope?

For (b) I have a script that auto-generates the correct docs which I then use to create PRs. See pingcap/docs#6838 for an example where I detected changes and updated the docs (I typically run this script every 2 weeks, so it will be caught before GA).

I mean plan b, thanks for the answer. In fact, what I mean is that when we do not explicitly specify the scope of the query. For example, the original set tidb_capture_plan_baselines = 1; is equivalent to set session tidb_capture_plan_baselines = 1;. When tidb_capture_plan_baselines only supports global scope, set tidb_capture_plan_baselines = 1; is equivalent to set global tidb_capture_plan_baselines = 1;. We need to remind users of this behavior change in the document. So I think plan B is OK:)

@morgo
Copy link
Contributor Author

morgo commented Dec 20, 2021

When tidb_capture_plan_baselines only supports global scope, set tidb_capture_plan_baselines = 1; is equivalent to set global tidb_capture_plan_baselines = 1;.

Unfortunately this is not the case. SET has a default scope of session, so the user will get an error.

I am hessitant to allow SET SESSION to redirect to global scope in this context, because if a user did not intend for this to execute globally it could cause problems. At least they will get an error message and can check the manual, and it is not typically application sessions which will be executing this query but DBAs.

(In a different context in #30558 I proposed we allow both for backward compatibility. But this is slightly different because it very strictly ensures the previous behavior and it does not propagate to peers).

We need to remind users of this behavior change in the document. So I think plan B is OK:)

Yes, the docs team will also catch it from the compatibility-breaker label. There is a section in each .0 release which covers defaults and variable changes.

@Reminiscent
Copy link
Contributor

When tidb_capture_plan_baselines only supports global scope, set tidb_capture_plan_baselines = 1; is equivalent to set global tidb_capture_plan_baselines = 1;.

Unfortunately this is not the case. SET has a default scope of session, so the user will get an error.

I am hessitant to allow SET SESSION to redirect to global scope in this context, because if a user did not intend for this to execute globally it could cause problems. At least they will get an error message and can check the manual, and it is not typically application sessions which will be eecuting this query but DBAs.

(In a different context in #30558 I proposed we allow both for backward compatibility. But this is slightly different because it very strictly ensures the previous behavior and it does not propagate to peers).

We need to remind users of this behavior change in the document. So I think plan B is OK:)

Yes, the docs team will also catch it from the compatibility-breaker label. There is a section in each .0 release which covers defaults and variable changes.

@qw4990 PTAL.
I think is reasonable to report the error. But I'm not sure it's reasonable for others. So it may need more discussion.

@sre-bot
Copy link
Contributor

sre-bot commented Dec 24, 2021

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 27, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 27, 2021
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 31, 2021
@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 4, 2022
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 12, 2022
@morgo
Copy link
Contributor Author

morgo commented Jan 12, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: d8f420f

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

@morgo: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-breaker Violation of forwards/backwards compatibility in a design-time piece. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ 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.

6 participants