Skip to content

Commit

Permalink
sessionctx/variable: fix cannot select session scope ScopeNone variab…
Browse files Browse the repository at this point in the history
…le (#19584) (#19944)

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
ti-srebot authored Oct 3, 2020
1 parent b782b01 commit 4d54559
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,10 +685,9 @@ func (s *testSessionSuite) TestGetSysVariables(c *C) {
// Test ScopeNone
tk.MustExec("select @@performance_schema_max_mutex_classes")
tk.MustExec("select @@global.performance_schema_max_mutex_classes")
_, err = tk.Exec("select @@session.performance_schema_max_mutex_classes")
c.Assert(terror.ErrorEqual(err, variable.ErrIncorrectScope), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select @@local.performance_schema_max_mutex_classes")
c.Assert(terror.ErrorEqual(err, variable.ErrIncorrectScope), IsTrue, Commentf("err %v", err))
// For issue 19524, test
tk.MustExec("select @@session.performance_schema_max_mutex_classes")
tk.MustExec("select @@local.performance_schema_max_mutex_classes")
}

func (s *testSessionSuite) TestRetryResetStmtCtx(c *C) {
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/varsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func ValidateGetSystemVar(name string, isGlobal bool) error {
return ErrUnknownSystemVar.GenWithStackByArgs(name)
}
switch sysVar.Scope {
case ScopeGlobal, ScopeNone:
case ScopeGlobal:
if !isGlobal {
return ErrIncorrectScope.GenWithStackByArgs(name, "GLOBAL")
}
Expand Down

0 comments on commit 4d54559

Please sign in to comment.