Skip to content

Commit

Permalink
change error message
Browse files Browse the repository at this point in the history
  • Loading branch information
marsishandsome committed Apr 11, 2019
1 parent 18957ec commit 470b0dd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ func (s *testSuite2) TestSetVar(c *C) {

// test skip isolation level check: error
_, err = tk.Exec("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE")
c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err))
c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedIsolationLevel), IsTrue, Commentf("err %v", err))
tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-COMMITTED"))
tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-COMMITTED"))

_, err = tk.Exec("SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE")
c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err))
c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedIsolationLevel), IsTrue, Commentf("err %v", err))
tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("READ-COMMITTED"))
tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("READ-COMMITTED"))

Expand All @@ -312,8 +312,8 @@ func (s *testSuite2) TestSetVar(c *C) {
tk.MustExec("SET SESSION tidb_skip_isolation_level_check = 1")
tk.MustExec("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE")
tk.MustQuery("show warnings").Check(testkit.Rows(
"Warning 1105 variable 'tx_isolation' does not yet support value: SERIALIZABLE",
"Warning 1105 variable 'transaction_isolation' does not yet support value: SERIALIZABLE"))
"Warning 1105 The isolation level 'SERIALIZABLE' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error",
"Warning 1105 The isolation level 'SERIALIZABLE' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error"))
tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("SERIALIZABLE"))
tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("SERIALIZABLE"))

Expand All @@ -322,8 +322,8 @@ func (s *testSuite2) TestSetVar(c *C) {
tk.MustExec("SET SESSION tidb_skip_isolation_level_check = 1")
tk.MustExec("SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED")
tk.MustQuery("show warnings").Check(testkit.Rows(
"Warning 1105 variable 'tx_isolation' does not yet support value: READ-UNCOMMITTED",
"Warning 1105 variable 'transaction_isolation' does not yet support value: READ-UNCOMMITTED"))
"Warning 1105 The isolation level 'READ-UNCOMMITTED' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error",
"Warning 1105 The isolation level 'READ-UNCOMMITTED' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error"))
tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED"))
tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED"))

Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ func (s *SessionVars) SetSystemVar(name string, val string) error {
switch val {
case "SERIALIZABLE", "READ-UNCOMMITTED":
skipIsolationLevelCheck, err := GetSessionSystemVar(s, TiDBSkipIsolationLevelCheck)
returnErr := ErrUnsupportedValueForVar.GenWithStackByArgs(name, val)
returnErr := ErrUnsupportedIsolationLevel.GenWithStackByArgs(val)
if err != nil {
returnErr = err
}
Expand Down
1 change: 1 addition & 0 deletions sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ var (
ErrTruncatedWrongValue = terror.ClassVariable.New(CodeTruncatedWrongValue, mysql.MySQLErrName[mysql.ErrTruncatedWrongValue])
ErrMaxPreparedStmtCountReached = terror.ClassVariable.New(CodeMaxPreparedStmtCountReached, mysql.MySQLErrName[mysql.ErrMaxPreparedStmtCountReached])
ErrUnsupportedValueForVar = terror.ClassVariable.New(CodeUnknownStatusVar, "variable '%s' does not yet support value: %s")
ErrUnsupportedIsolationLevel = terror.ClassVariable.New(CodeUnknownStatusVar, "The isolation level '%s' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error")
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/varsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ func ValidateSetSystemVar(vars *SessionVars, name string, value string) (string,
switch upVal {
case "SERIALIZABLE", "READ-UNCOMMITTED":
skipIsolationLevelCheck, err := GetSessionSystemVar(vars, TiDBSkipIsolationLevelCheck)
returnErr := ErrUnsupportedValueForVar.GenWithStackByArgs(name, value)
returnErr := ErrUnsupportedIsolationLevel.GenWithStackByArgs(value)
if err != nil {
returnErr = err
}
Expand Down

0 comments on commit 470b0dd

Please sign in to comment.