*: better handle sysvar upgrades from older versions (#31583) #32997
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cherry-pick #31583 to release-5.4
You can switch your code base to this Pull Request by using git-extras:
# In tidb repo: git pr https://github.com/pingcap/tidb/pull/32997
After apply modifications, you can push your change to this PR via:
What problem does this PR solve?
Issue Number: close #31538
Problem Summary:
In v5.4 the
GetGlobalSysVar()
function returns an error if loading the value of a sysvar fails validation (in prior versions; no validation was performed at all, so this can be seen as a regression of #30293 ).While this could be fixed by adjusting
SHOW VARIABLES
to handle these errors, it seems easier if we consistently handle upgrade issues in theGetGlobalSysVar()
function in a determinstic way: replacing the default value if validation fails.This also adds tests around system variable upgrades, which unfortunately were lacking previously.
This effectively reverts #31566 because it handles the issue in a different part of the code.
What is changed and how it works?
Check List
Tests
Side effects
Minor incompatibility: In 5.4 (and only 5.4) it was possible that some noop sysvars permitted incorrect values to be set. These now return an error again as in 5.3 and below.
Documentation
Release note