From 2509fcd9d97fad4c116d00dd2486c84ba38d3031 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Sat, 8 Dec 2018 16:30:04 +0000 Subject: [PATCH 1/5] sessionctx: error/warn on isolation levels --- sessionctx/variable/session.go | 6 ++++++ sessionctx/variable/varsutil.go | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index 060b323aa3bb9..4598fe7f9f3e5 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -526,6 +526,12 @@ func (s *SessionVars) setDDLReorgPriority(val string) { func (s *SessionVars) SetSystemVar(name string, val string) error { switch name { case TxnIsolationOneShot: + switch val { + case "SERIALIZABLE": + return ErrWrongValueForVar.GenWithStackByArgs(name, val) + case "READ-COMMITTED", "READ-UNCOMMITTED": + s.StmtCtx.AppendWarning(ErrWrongValueForVar.GenWithStackByArgs(name, val)) + } s.TxnIsolationLevelOneShot.State = 1 s.TxnIsolationLevelOneShot.Value = val case TimeZone: diff --git a/sessionctx/variable/varsutil.go b/sessionctx/variable/varsutil.go index 5aa2cdee688be..a3472a868ac83 100644 --- a/sessionctx/variable/varsutil.go +++ b/sessionctx/variable/varsutil.go @@ -343,12 +343,18 @@ func ValidateSetSystemVar(vars *SessionVars, name string, value string) (string, return "", errors.Trace(err) } return v, nil - case TxnIsolation, TransactionIsolation: + case TransactionIsolation: upVal := strings.ToUpper(value) _, exists := TxIsolationNames[upVal] if !exists { return "", ErrWrongValueForVar.GenWithStackByArgs(name, value) } + switch upVal { + case "SERIALIZABLE": + return "", ErrWrongValueForVar.GenWithStackByArgs(name, value) + case "READ-COMMITTED", "READ-UNCOMMITTED": + vars.StmtCtx.AppendWarning(ErrWrongValueForVar.GenWithStackByArgs(name, value)) + } return upVal, nil } return value, nil From eb187e9b10304585f51e4ea81bc31be7634bdf11 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Sat, 8 Dec 2018 18:33:37 +0000 Subject: [PATCH 2/5] Fixed error code to be Notsupportedyet --- sessionctx/variable/session.go | 4 ++-- sessionctx/variable/varsutil.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index 2899022839b3e..e737f22698397 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -584,9 +584,9 @@ func (s *SessionVars) SetSystemVar(name string, val string) error { case TxnIsolationOneShot: switch val { case "SERIALIZABLE": - return ErrWrongValueForVar.GenWithStackByArgs(name, val) + return ErrUnsupportedValueForVar.GenWithStackByArgs(name, val) case "READ-COMMITTED", "READ-UNCOMMITTED": - s.StmtCtx.AppendWarning(ErrWrongValueForVar.GenWithStackByArgs(name, val)) + s.StmtCtx.AppendWarning(ErrUnsupportedValueForVar.GenWithStackByArgs(name, val)) } s.TxnIsolationLevelOneShot.State = 1 s.TxnIsolationLevelOneShot.Value = val diff --git a/sessionctx/variable/varsutil.go b/sessionctx/variable/varsutil.go index 0507b7bddf16a..12948ec03f5dd 100644 --- a/sessionctx/variable/varsutil.go +++ b/sessionctx/variable/varsutil.go @@ -396,9 +396,9 @@ func ValidateSetSystemVar(vars *SessionVars, name string, value string) (string, } switch upVal { case "SERIALIZABLE": - return "", ErrWrongValueForVar.GenWithStackByArgs(name, value) + return "", ErrUnsupportedValueForVar.GenWithStackByArgs(name, value) case "READ-COMMITTED", "READ-UNCOMMITTED": - vars.StmtCtx.AppendWarning(ErrWrongValueForVar.GenWithStackByArgs(name, value)) + vars.StmtCtx.AppendWarning(ErrUnsupportedValueForVar.GenWithStackByArgs(name, value)) } return upVal, nil } From db8fa555b2b8b55c7178ebdc1211099b1f46dea2 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Sat, 8 Dec 2018 13:28:20 -0700 Subject: [PATCH 3/5] Fix tests. --- executor/set_test.go | 40 ++++++++++++++++++++------------- sessionctx/variable/varsutil.go | 7 ++++-- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/executor/set_test.go b/executor/set_test.go index 015292f5d8308..e24030451a11c 100644 --- a/executor/set_test.go +++ b/executor/set_test.go @@ -138,15 +138,21 @@ func (s *testSuite) TestSetVar(c *C) { tk.MustQuery("select @@character_set_results").Check(testkit.Rows("")) // Test set transaction isolation level, which is equivalent to setting variable "tx_isolation". + // warning tk.MustExec("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED") + tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning 1105 variable 'transaction_isolation' does not yet support value: READ-COMMITTED")) tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-COMMITTED")) tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-COMMITTED")) + // warning tk.MustExec("SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED") + tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning 1105 variable 'transaction_isolation' does not yet support value: READ-UNCOMMITTED")) tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) - tk.MustExec("SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE") - tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("SERIALIZABLE")) - tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("SERIALIZABLE")) + // Fails + _, err = tk.Exec("SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE") + c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err)) + tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("REPEATABLE-READ")) + tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("REPEATABLE-READ")) // test synonyms variables tk.MustExec("SET SESSION tx_isolation = 'READ-COMMITTED'") @@ -157,21 +163,26 @@ func (s *testSuite) TestSetVar(c *C) { tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) - tk.MustExec("SET SESSION transaction_isolation = 'SERIALIZABLE'") - tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("SERIALIZABLE")) - tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("SERIALIZABLE")) + // fails + _, err = tk.Exec("SET SESSION transaction_isolation = 'SERIALIZABLE'") + c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err)) + tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) + tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) - tk.MustExec("SET GLOBAL transaction_isolation = 'SERIALIZABLE'") - tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("SERIALIZABLE")) - tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("SERIALIZABLE")) + // fails + _, err = tk.Exec("SET GLOBAL transaction_isolation = 'SERIALIZABLE'") + c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err)) + tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("REPEATABLE-READ")) + tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("REPEATABLE-READ")) tk.MustExec("SET GLOBAL transaction_isolation = 'READ-UNCOMMITTED'") tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) - tk.MustExec("SET GLOBAL tx_isolation = 'SERIALIZABLE'") - tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("SERIALIZABLE")) - tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("SERIALIZABLE")) + _, err = tk.Exec("SET GLOBAL tx_isolation = 'SERIALIZABLE'") + c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err)) + tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) + tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) tk.MustExec("SET SESSION tx_read_only = 1") tk.MustExec("SET SESSION tx_read_only = 0") @@ -553,7 +564,6 @@ func (s *testSuite) TestValidateSetVar(c *C) { result = tk.MustQuery("select @@tx_isolation;") result.Check(testkit.Rows("REPEATABLE-READ")) - tk.MustExec("set @@tx_isolation='SERIALIZABLE'") - result = tk.MustQuery("select @@tx_isolation;") - result.Check(testkit.Rows("SERIALIZABLE")) + _, err = tk.Exec("set @@tx_isolation='SERIALIZABLE'") + c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err)) } diff --git a/sessionctx/variable/varsutil.go b/sessionctx/variable/varsutil.go index 12948ec03f5dd..8ef24911782fe 100644 --- a/sessionctx/variable/varsutil.go +++ b/sessionctx/variable/varsutil.go @@ -388,7 +388,7 @@ func ValidateSetSystemVar(vars *SessionVars, name string, value string) (string, return "", errors.Trace(err) } return v, nil - case TransactionIsolation: + case TxnIsolation, TransactionIsolation: upVal := strings.ToUpper(value) _, exists := TxIsolationNames[upVal] if !exists { @@ -398,7 +398,10 @@ func ValidateSetSystemVar(vars *SessionVars, name string, value string) (string, case "SERIALIZABLE": return "", ErrUnsupportedValueForVar.GenWithStackByArgs(name, value) case "READ-COMMITTED", "READ-UNCOMMITTED": - vars.StmtCtx.AppendWarning(ErrUnsupportedValueForVar.GenWithStackByArgs(name, value)) + // prevent double warning + if name == "transaction_isolation" { + vars.StmtCtx.AppendWarning(ErrUnsupportedValueForVar.GenWithStackByArgs(name, value)) + } } return upVal, nil } From 0dc57f70a97f76d44adeaeb33875aa79187e25ec Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Sun, 9 Dec 2018 09:29:28 -0700 Subject: [PATCH 4/5] Changed Error Class, Made read-uncommitted an err --- executor/set_test.go | 35 ++++++++++++++++++--------------- sessionctx/variable/session.go | 6 +++--- sessionctx/variable/sysvar.go | 1 + sessionctx/variable/varsutil.go | 6 +++--- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/executor/set_test.go b/executor/set_test.go index e24030451a11c..ba68092b785a9 100644 --- a/executor/set_test.go +++ b/executor/set_test.go @@ -140,14 +140,14 @@ func (s *testSuite) TestSetVar(c *C) { // Test set transaction isolation level, which is equivalent to setting variable "tx_isolation". // warning tk.MustExec("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED") - tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning 1105 variable 'transaction_isolation' does not yet support value: READ-COMMITTED")) + tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning 1105 variable 'transaction_isolation' does not recommend value: READ-COMMITTED")) + tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-COMMITTED")) + tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-COMMITTED")) + // error + _, err = tk.Exec("SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED") + c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), 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")) - // warning - tk.MustExec("SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED") - tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning 1105 variable 'transaction_isolation' does not yet support value: READ-UNCOMMITTED")) - tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) - tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) // Fails _, err = tk.Exec("SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE") c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err)) @@ -156,18 +156,20 @@ func (s *testSuite) TestSetVar(c *C) { // test synonyms variables tk.MustExec("SET SESSION tx_isolation = 'READ-COMMITTED'") + tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning 1105 variable 'transaction_isolation' does not recommend value: READ-COMMITTED")) tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-COMMITTED")) tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-COMMITTED")) - tk.MustExec("SET SESSION tx_isolation = 'READ-UNCOMMITTED'") - tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) - tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) + _, err = tk.Exec("SET SESSION tx_isolation = 'READ-UNCOMMITTED'") + c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), 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")) // fails _, err = tk.Exec("SET SESSION transaction_isolation = 'SERIALIZABLE'") c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err)) - tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) - tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) + tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-COMMITTED")) + tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-COMMITTED")) // fails _, err = tk.Exec("SET GLOBAL transaction_isolation = 'SERIALIZABLE'") @@ -175,14 +177,15 @@ func (s *testSuite) TestSetVar(c *C) { tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("REPEATABLE-READ")) tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("REPEATABLE-READ")) - tk.MustExec("SET GLOBAL transaction_isolation = 'READ-UNCOMMITTED'") - tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) - tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) + _, err = tk.Exec("SET GLOBAL transaction_isolation = 'READ-UNCOMMITTED'") + c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err)) + tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("REPEATABLE-READ")) + tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("REPEATABLE-READ")) _, err = tk.Exec("SET GLOBAL tx_isolation = 'SERIALIZABLE'") c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err)) - tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) - tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) + tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("REPEATABLE-READ")) + tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("REPEATABLE-READ")) tk.MustExec("SET SESSION tx_read_only = 1") tk.MustExec("SET SESSION tx_read_only = 0") diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index e737f22698397..407004a4df2f1 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -583,10 +583,10 @@ func (s *SessionVars) SetSystemVar(name string, val string) error { switch name { case TxnIsolationOneShot: switch val { - case "SERIALIZABLE": + case "SERIALIZABLE", "READ-UNCOMMITTED": return ErrUnsupportedValueForVar.GenWithStackByArgs(name, val) - case "READ-COMMITTED", "READ-UNCOMMITTED": - s.StmtCtx.AppendWarning(ErrUnsupportedValueForVar.GenWithStackByArgs(name, val)) + case "READ-COMMITTED": + s.StmtCtx.AppendWarning(ErrNotRecommendedValueForVar.GenWithStackByArgs(name, val)) } s.TxnIsolationLevelOneShot.State = 1 s.TxnIsolationLevelOneShot.Value = val diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index 26a03c098a550..cfab4a004e79a 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -82,6 +82,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") + ErrNotRecommendedValueForVar = terror.ClassVariable.New(CodeUnknownStatusVar, "variable '%s' does not recommend value: %s") ) func init() { diff --git a/sessionctx/variable/varsutil.go b/sessionctx/variable/varsutil.go index 8ef24911782fe..62e49571d2193 100644 --- a/sessionctx/variable/varsutil.go +++ b/sessionctx/variable/varsutil.go @@ -395,12 +395,12 @@ func ValidateSetSystemVar(vars *SessionVars, name string, value string) (string, return "", ErrWrongValueForVar.GenWithStackByArgs(name, value) } switch upVal { - case "SERIALIZABLE": + case "SERIALIZABLE", "READ-UNCOMMITTED": return "", ErrUnsupportedValueForVar.GenWithStackByArgs(name, value) - case "READ-COMMITTED", "READ-UNCOMMITTED": + case "READ-COMMITTED": // prevent double warning if name == "transaction_isolation" { - vars.StmtCtx.AppendWarning(ErrUnsupportedValueForVar.GenWithStackByArgs(name, value)) + vars.StmtCtx.AppendWarning(ErrNotRecommendedValueForVar.GenWithStackByArgs(name, value)) } } return upVal, nil From bbec512d7e0657bd9f19aecf3ddaef44cb292ba8 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Sun, 9 Dec 2018 16:31:30 -0700 Subject: [PATCH 5/5] changed read-committed to be no warning or error --- executor/set_test.go | 3 --- sessionctx/variable/session.go | 2 -- sessionctx/variable/sysvar.go | 1 - sessionctx/variable/varsutil.go | 5 ----- 4 files changed, 11 deletions(-) diff --git a/executor/set_test.go b/executor/set_test.go index ba68092b785a9..35c61825ac494 100644 --- a/executor/set_test.go +++ b/executor/set_test.go @@ -138,9 +138,7 @@ func (s *testSuite) TestSetVar(c *C) { tk.MustQuery("select @@character_set_results").Check(testkit.Rows("")) // Test set transaction isolation level, which is equivalent to setting variable "tx_isolation". - // warning tk.MustExec("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED") - tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning 1105 variable 'transaction_isolation' does not recommend value: READ-COMMITTED")) tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-COMMITTED")) tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-COMMITTED")) // error @@ -156,7 +154,6 @@ func (s *testSuite) TestSetVar(c *C) { // test synonyms variables tk.MustExec("SET SESSION tx_isolation = 'READ-COMMITTED'") - tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning 1105 variable 'transaction_isolation' does not recommend value: READ-COMMITTED")) tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-COMMITTED")) tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-COMMITTED")) diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index 407004a4df2f1..bc1ea077ebc68 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -585,8 +585,6 @@ func (s *SessionVars) SetSystemVar(name string, val string) error { switch val { case "SERIALIZABLE", "READ-UNCOMMITTED": return ErrUnsupportedValueForVar.GenWithStackByArgs(name, val) - case "READ-COMMITTED": - s.StmtCtx.AppendWarning(ErrNotRecommendedValueForVar.GenWithStackByArgs(name, val)) } s.TxnIsolationLevelOneShot.State = 1 s.TxnIsolationLevelOneShot.Value = val diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index cfab4a004e79a..26a03c098a550 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -82,7 +82,6 @@ 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") - ErrNotRecommendedValueForVar = terror.ClassVariable.New(CodeUnknownStatusVar, "variable '%s' does not recommend value: %s") ) func init() { diff --git a/sessionctx/variable/varsutil.go b/sessionctx/variable/varsutil.go index 62e49571d2193..c5f3aa3c1e1d9 100644 --- a/sessionctx/variable/varsutil.go +++ b/sessionctx/variable/varsutil.go @@ -397,11 +397,6 @@ func ValidateSetSystemVar(vars *SessionVars, name string, value string) (string, switch upVal { case "SERIALIZABLE", "READ-UNCOMMITTED": return "", ErrUnsupportedValueForVar.GenWithStackByArgs(name, value) - case "READ-COMMITTED": - // prevent double warning - if name == "transaction_isolation" { - vars.StmtCtx.AppendWarning(ErrNotRecommendedValueForVar.GenWithStackByArgs(name, value)) - } } return upVal, nil }