Skip to content

Commit

Permalink
executor, sessionctx: fix set tidb_general_log=0 error (pingcap#7186)
Browse files Browse the repository at this point in the history
  • Loading branch information
XuHuaiyu authored Jul 30, 2018
1 parent e907bfc commit 2fee494
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ func (s *testSuite) TestSetVar(c *C) {
tk.MustQuery(`select @@session.sql_log_bin;`).Check(testkit.Rows("0"))
tk.MustExec("set @@sql_log_bin = on")
tk.MustQuery(`select @@session.sql_log_bin;`).Check(testkit.Rows("1"))

tk.MustExec("set @@tidb_general_log = 1")
tk.MustExec("set @@tidb_general_log = 0")
}

func (s *testSuite) TestSetCharset(c *C) {
Expand Down
5 changes: 2 additions & 3 deletions sessionctx/variable/varsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func ValidateSetSystemVar(vars *SessionVars, name string, value string) (string,
return value, nil
case WarningCount, ErrorCount:
return value, ErrReadOnly.GenByArgs(name)
case GeneralLog, AvoidTemporalUpgrade, BigTables, CheckProxyUsers, CoreFile, EndMakersInJSON, SQLLogBin, OfflineMode,
case GeneralLog, TiDBGeneralLog, AvoidTemporalUpgrade, BigTables, CheckProxyUsers, CoreFile, EndMakersInJSON, SQLLogBin, OfflineMode,
PseudoSlaveMode, LowPriorityUpdates, SkipNameResolve, ForeignKeyChecks, SQLSafeUpdates:
if strings.EqualFold(value, "ON") || value == "1" {
return "1", nil
Expand All @@ -331,8 +331,7 @@ func ValidateSetSystemVar(vars *SessionVars, name string, value string) (string,
TiDBDistSQLScanConcurrency,
TiDBIndexSerialScanConcurrency, TiDBDDLReorgWorkerCount,
TiDBBackoffLockFast, TiDBMaxChunkSize,
TiDBDMLBatchSize, TiDBOptimizerSelectivityLevel,
TiDBGeneralLog:
TiDBDMLBatchSize, TiDBOptimizerSelectivityLevel:
v, err := strconv.Atoi(value)
if err != nil {
return value, ErrWrongTypeForVar.GenByArgs(name)
Expand Down

0 comments on commit 2fee494

Please sign in to comment.