-
Notifications
You must be signed in to change notification settings - Fork 6.2k
add skip isolation level check variable #10065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
427762b
3270cf5
6579b58
4271cd6
8d0a17d
8ddd5c5
4c5eddd
0bda114
a388359
18957ec
470b0dd
2c75356
876342f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -285,6 +285,49 @@ func (s *testSuite2) TestSetVar(c *C) { | |
| c.Assert(err, NotNil) | ||
| _, err = tk.Exec("set global tidb_batch_commit = 2") | ||
| c.Assert(err, NotNil) | ||
|
|
||
| // test skip isolation level check: init | ||
| tk.MustExec("SET GLOBAL tidb_skip_isolation_level_check = 0") | ||
| tk.MustExec("SET SESSION tidb_skip_isolation_level_check = 0") | ||
| tk.MustExec("SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED") | ||
| tk.MustExec("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED") | ||
| tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("READ-COMMITTED")) | ||
| tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("READ-COMMITTED")) | ||
| tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("READ-COMMITTED")) | ||
| tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("READ-COMMITTED")) | ||
|
|
||
| // test skip isolation level check: error | ||
| _, err = tk.Exec("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE") | ||
| 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.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")) | ||
|
|
||
| // test skip isolation level check: success | ||
| tk.MustExec("SET GLOBAL tidb_skip_isolation_level_check = 1") | ||
| 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 The isolation level 'SERIALIZABLE' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error")) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to see just one warning here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should debug it, why the warning was appended twice.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So the function
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the error message does not mention which variable was set now, it is easy to fix by wrapping an
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| tk.MustQuery("select @@session.tx_isolation").Check(testkit.Rows("SERIALIZABLE")) | ||
| tk.MustQuery("select @@session.transaction_isolation").Check(testkit.Rows("SERIALIZABLE")) | ||
|
|
||
| // test skip isolation level check: success | ||
| tk.MustExec("SET GLOBAL tidb_skip_isolation_level_check = 0") | ||
| 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 The isolation level 'READ-UNCOMMITTED' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error")) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here too |
||
| tk.MustQuery("select @@global.tx_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) | ||
| tk.MustQuery("select @@global.transaction_isolation").Check(testkit.Rows("READ-UNCOMMITTED")) | ||
|
|
||
| // test skip isolation level check: reset | ||
| tk.MustExec("SET GLOBAL tidb_skip_isolation_level_check = 0") | ||
| tk.MustExec("SET SESSION tidb_skip_isolation_level_check = 0") | ||
| } | ||
|
|
||
| func (s *testSuite2) TestSetCharset(c *C) { | ||
|
|
@@ -584,6 +627,8 @@ func (s *testSuite2) TestValidateSetVar(c *C) { | |
| result = tk.MustQuery("select @@tx_isolation;") | ||
| result.Check(testkit.Rows("REPEATABLE-READ")) | ||
|
|
||
| tk.MustExec("SET GLOBAL tidb_skip_isolation_level_check = 0") | ||
| tk.MustExec("SET SESSION tidb_skip_isolation_level_check = 0") | ||
| _, err = tk.Exec("set @@tx_isolation='SERIALIZABLE'") | ||
| c.Assert(terror.ErrorEqual(err, variable.ErrUnsupportedValueForVar), IsTrue, Commentf("err %v", err)) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.