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

variables: return error when setting statement summary variables to invalid values (#17108) #17129

Merged
merged 1 commit into from
May 12, 2020

Conversation

sre-bot
Copy link
Contributor

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

cherry-pick #17108 to release-4.0


What problem does this PR solve?

Problem Summary:
System variables are transformed to a valid value according to min/max values. But this valid value is stored into TiKV, while the current server still uses the invalid value.
For example,

set global tidb_stmt_summary_refresh_interval = -1;

-1 is invalid and the value is transformed to 1 when validating it, and 1 is stored to mysql.global_variables table. However, 1 is not returned in the current SET statement, and the SET statement passes -1 to statement summary.

What is changed and how it works?

What's Changed:
Throw an error when it's set to an invalid value. This is simple and reasonable.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)
mysql> set global tidb_stmt_summary_refresh_interval=1<<31;
ERROR 1231 (42000): Variable 'tidb_stmt_summary_refresh_interval' can't be set to the value of '2147483648'
mysql> set session tidb_stmt_summary_refresh_interval=0;
ERROR 1231 (42000): Variable 'tidb_stmt_summary_refresh_interval' can't be set to the value of '0'

Side effects

  • Breaking backward compatibility

Release note

  • return error when setting statement summary system variables to invalid values.

@sre-bot
Copy link
Contributor Author

sre-bot commented May 12, 2020

/run-all-tests

@sre-bot sre-bot added compatibility-breaker Violation of forwards/backwards compatibility in a design-time piece. type/4.0-cherry-pick type/bugfix This PR fixes a bug. labels May 12, 2020
@sre-bot sre-bot added this to the 4.0.0-rc.2 milestone May 12, 2020
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

@bb7133 bb7133 merged commit 4741ec6 into pingcap:release-4.0 May 12, 2020
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. type/bugfix This PR fixes a bug. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants