Skip to content

session, sessionctx/variable: add relaxed validation for global vars#29594

Merged
ti-chi-bot merged 8 commits intopingcap:masterfrom
morgo:normalize-global-sysvars
Nov 18, 2021
Merged

session, sessionctx/variable: add relaxed validation for global vars#29594
ti-chi-bot merged 8 commits intopingcap:masterfrom
morgo:normalize-global-sysvars

Conversation

@morgo
Copy link
Contributor

@morgo morgo commented Nov 9, 2021

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

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
    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.
  • 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

When a global scoped system 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.

@morgo morgo requested a review from a team as a code owner November 9, 2021 03:35
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 9, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • dveeden
  • xhebox

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.

Details

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/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 9, 2021
@morgo morgo force-pushed the normalize-global-sysvars branch from bcaba2c to 6a47fc3 Compare November 9, 2021 04:01
@morgo morgo requested review from djshow832 and xhebox November 11, 2021 03:21
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 11, 2021
@morgo morgo requested a review from dveeden November 16, 2021 01:45
@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 Nov 16, 2021
@morgo
Copy link
Contributor Author

morgo commented Nov 16, 2021

/merge

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 16, 2021
@morgo
Copy link
Contributor Author

morgo commented Nov 17, 2021

@bb7133 PTAL, it needs a configuration-reviewer.

@morgo
Copy link
Contributor Author

morgo commented Nov 17, 2021

/merge hold

@morgo
Copy link
Contributor Author

morgo commented Nov 17, 2021

/merge cancel

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Nov 17, 2021
@bb7133
Copy link
Member

bb7133 commented Nov 18, 2021

/merge

@ti-chi-bot
Copy link
Member

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

DetailsCommit hash: ef7e00f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 18, 2021
@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.

Details

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

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 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.

global sql_auto_is_null is not controlled by noop funciton

5 participants