session, sessionctx/variable: add relaxed validation for global vars#29594
session, sessionctx/variable: add relaxed validation for global vars#29594ti-chi-bot merged 8 commits intopingcap:masterfrom
Conversation
|
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. DetailsReviewer can indicate their review by submitting an approval review. |
bcaba2c to
6a47fc3
Compare
|
/merge |
|
@bb7133 PTAL, it needs a configuration-reviewer. |
|
/merge hold |
|
/merge cancel |
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: ef7e00f |
|
@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. DetailsInstructions 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. |
What problem does this PR solve?
Issue Number: close #29587
Problem Summary:
When a sysvar is set from an earlier version of TiDB, it could cause problems after upgrade to a newer version which uses different rules for validation.
We currently handle this correctly for session scoped variables, but there was a gap where global scoped variables were not handled correctly. This PR addresses GLOBAL scoped variables.
What is changed and how it works?
When a global scoped variable is read, validation is now applied to it to make sure it uses the rules of the current TiDB server version. This helps improve consistency after upgrading from an earlier verison of TiDB.
Check List
Tests
Side effects
Whenever a system variable is read, more CPU is consumed. It could have also been possible to validate and 'cache' system variables, but I opted not to do this because the cache is actually re-generated very frequently at current. Also, global variables are rarely read. We could review this in future if we change the sysvar cache to be less frequent. We also currently always re-run validation for session variables, which is a larger opportunity for optimization.
Documentation
Release note