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

sysvar: add INSTANCE scope for system variable #32888

Merged
merged 27 commits into from
Mar 16, 2022

Conversation

CbcWestwolf
Copy link
Member

@CbcWestwolf CbcWestwolf commented Mar 8, 2022

What problem does this PR solve?

Issue Number: ref #32887

Problem Summary:

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • 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

TiDB now natively supports `INSTANCE` scoped system variables. `INSTANCE` scoped variables are similar to global variables, except their changes do not persist to the TiDB cluster.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 8, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • morgo
  • zimulala

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-none do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 8, 2022
@morgo morgo self-requested a review March 8, 2022 15:37
Copy link
Contributor

@morgo morgo left a comment

Choose a reason for hiding this comment

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

Looking good, just needs some work on tests.

sessionctx/variable/sysvar.go Show resolved Hide resolved
executor/set.go Outdated Show resolved Hide resolved
session/session.go Outdated Show resolved Hide resolved
session/session.go Outdated Show resolved Hide resolved
sessionctx/variable/sysvar_test.go Outdated Show resolved Hide resolved
@sre-bot
Copy link
Contributor

sre-bot commented Mar 10, 2022

errno/errname.go Outdated Show resolved Hide resolved
@morgo
Copy link
Contributor

morgo commented Mar 10, 2022

Getting this error from the CI:

[2022-03-10T03:24:33.425Z] session/session_test.go:755:2: ineffectual assignment to err (ineffassign)
[2022-03-10T03:24:33.425Z] 	err = se.SetGlobalSysVar(varName, "ON")
[2022-03-10T03:24:33.425Z] 	^
[2022-03-10T03:24:33.425Z] session/session_test.go:762:2: ineffectual assignment to err (ineffassign)
[2022-03-10T03:24:33.425Z] 	err = se.SetGlobalSysVar(varName, defaultValue)
[2022-03-10T03:24:33.425Z] 	^

CbcWestwolf and others added 2 commits March 10, 2022 12:59
Co-authored-by: Morgan Tocker <tocker@gmail.com>
executor/set_test.go Outdated Show resolved Hide resolved
@CbcWestwolf CbcWestwolf marked this pull request as ready for review March 10, 2022 06:18
@CbcWestwolf CbcWestwolf requested a review from a team as a code owner March 10, 2022 06:18
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 10, 2022
@morgo
Copy link
Contributor

morgo commented Mar 10, 2022

Please run make errdoc. This will fix the error reported by the CI check check_dev.

But otherwise LGTM!

@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 15, 2022
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 15, 2022
@CbcWestwolf
Copy link
Member Author

/run-unit-test

@@ -764,6 +764,43 @@ func (s *testSessionSuite) TestUpgradeSysvars(c *C) {
c.Assert(v, Equals, "OFF") // the default value is restored.
}

func (s *testSessionSuite) TestSetInstanceSysvarBySetGlobalSysVar(c *C) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

Please remove this blank line.

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

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 Mar 15, 2022
@zimulala
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: ecfe407

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 15, 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 Mar 15, 2022
@ti-chi-bot ti-chi-bot merged commit d981c0e into pingcap:master Mar 16, 2022
@CbcWestwolf CbcWestwolf deleted the instance_scope_variables branch March 16, 2022 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note size/L Denotes a PR that changes 100-499 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.

None yet

5 participants