Skip to content

Commit

Permalink
*: session variable value should not be modified when get global vari…
Browse files Browse the repository at this point in the history
…able (#5317)
  • Loading branch information
XuHuaiyu authored and coocood committed Dec 6, 2017
1 parent b0cd155 commit 738f933
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions new_session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,17 @@ func (s *testSessionSuite) TestGlobalVarAccessor(c *C) {
result.Check(testkit.Rows("sql_select_limit 18446744073709551615"))
result = tk.MustQuery("show session variables where variable_name='sql_select_limit';")
result.Check(testkit.Rows("sql_select_limit 100000000000"))

result = tk.MustQuery("select @@global.autocommit;")
result.Check(testkit.Rows("ON"))
result = tk.MustQuery("select @@autocommit;")
result.Check(testkit.Rows("ON"))
tk.MustExec("set @@global.autocommit = 0;")
result = tk.MustQuery("select @@global.autocommit;")
result.Check(testkit.Rows("0"))
result = tk.MustQuery("select @@autocommit;")
result.Check(testkit.Rows("ON"))
tk.MustExec("set @@global.autocommit=1")
}

func (s *testSessionSuite) TestRetryResetStmtCtx(c *C) {
Expand Down
1 change: 0 additions & 1 deletion sessionctx/varsutil/varsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func GetGlobalSystemVar(s *variable.SessionVars, key string) (string, error) {
if err != nil {
return "", errors.Trace(err)
}
s.Systems[key] = gVal
return gVal, nil
}

Expand Down

0 comments on commit 738f933

Please sign in to comment.