Skip to content

Commit 4128691

Browse files
committed
disable auto retry by default
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
1 parent f525557 commit 4128691

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

ddl/db_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,7 @@ func (s *testDBSuite8) TestColumn(c *C) {
12801280
s.tk = testkit.NewTestKit(c, s.store)
12811281
s.tk.MustExec("use " + s.schemaName)
12821282
s.tk.MustExec("create table t2 (c1 int, c2 int, c3 int)")
1283+
s.tk.MustExec("set @@tidb_disable_txn_auto_retry = 0")
12831284
s.testAddColumn(c)
12841285
s.testDropColumn(c)
12851286
s.tk.MustExec("drop table t2")

executor/write_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -2467,6 +2467,7 @@ func (s *testSuite2) TestAutoIDInRetry(c *C) {
24672467
tk := testkit.NewTestKitWithInit(c, s.store)
24682468
tk.MustExec("create table t (id int not null auto_increment primary key)")
24692469

2470+
tk.MustExec("set @@tidb_disable_txn_auto_retry = 0")
24702471
tk.MustExec("begin")
24712472
tk.MustExec("insert into t values ()")
24722473
tk.MustExec("insert into t values (),()")

server/server_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ func runTestConcurrentUpdate(c *C) {
682682
dbt.mustExec("drop table if exists test2")
683683
dbt.mustExec("create table test2 (a int, b int)")
684684
dbt.mustExec("insert test2 values (1, 1)")
685+
dbt.mustExec("set @@tidb_disable_txn_auto_retry = 0")
685686

686687
txn1, err := dbt.db.Begin()
687688
c.Assert(err, IsNil)

session/session_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ func (s *testSessionSuite) TestRowLock(c *C) {
293293
tk.MustExec("insert t values (12, 2, 3)")
294294
tk.MustExec("insert t values (13, 2, 3)")
295295

296+
tk1.MustExec("set @@tidb_disable_txn_auto_retry = 0")
296297
tk1.MustExec("begin")
297298
tk1.MustExec("update t set c2=21 where c1=11")
298299

@@ -507,6 +508,7 @@ func (s *testSessionSuite) TestRetryResetStmtCtx(c *C) {
507508
tk := testkit.NewTestKitWithInit(c, s.store)
508509
tk.MustExec("create table retrytxn (a int unique, b int)")
509510
tk.MustExec("insert retrytxn values (1, 1)")
511+
tk.MustExec("set @@tidb_disable_txn_auto_retry = 0")
510512
tk.MustExec("begin")
511513
tk.MustExec("update retrytxn set b = b + 1 where a = 1")
512514

@@ -665,6 +667,7 @@ func (s *testSessionSuite) TestRetryPreparedStmt(c *C) {
665667
tk.MustExec("create table t (c1 int, c2 int, c3 int)")
666668
tk.MustExec("insert t values (11, 2, 3)")
667669

670+
tk1.MustExec("set @@tidb_disable_txn_auto_retry = 0")
668671
tk1.MustExec("begin")
669672
tk1.MustExec("update t set c2=? where c1=11;", 21)
670673

@@ -881,6 +884,7 @@ func (s *testSessionSuite) TestAutoIncrementWithRetry(c *C) {
881884
tk := testkit.NewTestKitWithInit(c, s.store)
882885
tk1 := testkit.NewTestKitWithInit(c, s.store)
883886

887+
tk.MustExec("set @@tidb_disable_txn_auto_retry = 0")
884888
tk.MustExec("create table t (c2 int, c1 int not null auto_increment, PRIMARY KEY (c1))")
885889
tk.MustExec("insert into t (c2) values (1), (2), (3), (4), (5)")
886890

@@ -1308,6 +1312,9 @@ func (s *testSessionSuite) TestRetry(c *C) {
13081312
tk2 := testkit.NewTestKitWithInit(c, s.store)
13091313
tk3 := testkit.NewTestKitWithInit(c, s.store)
13101314
tk3.MustExec("SET SESSION autocommit=0;")
1315+
tk1.MustExec("set @@tidb_disable_txn_auto_retry = 0")
1316+
tk2.MustExec("set @@tidb_disable_txn_auto_retry = 0")
1317+
tk3.MustExec("set @@tidb_disable_txn_auto_retry = 0")
13111318

13121319
var wg sync.WaitGroup
13131320
wg.Add(3)
@@ -1449,6 +1456,7 @@ func (s *testSessionSuite) TestResetCtx(c *C) {
14491456

14501457
tk.MustExec("create table t (i int auto_increment not null key);")
14511458
tk.MustExec("insert into t values (1);")
1459+
tk.MustExec("set @@tidb_disable_txn_auto_retry = 0")
14521460
tk.MustExec("begin;")
14531461
tk.MustExec("insert into t values (10);")
14541462
tk.MustExec("update t set i = i + row_count();")
@@ -1480,6 +1488,8 @@ func (s *testSessionSuite) TestUnique(c *C) {
14801488
tk1 := testkit.NewTestKitWithInit(c, s.store)
14811489
tk2 := testkit.NewTestKitWithInit(c, s.store)
14821490

1491+
tk.MustExec("set @@tidb_disable_txn_auto_retry = 0")
1492+
tk1.MustExec("set @@tidb_disable_txn_auto_retry = 0")
14831493
tk.MustExec(`CREATE TABLE test ( id int(11) UNSIGNED NOT NULL AUTO_INCREMENT, val int UNIQUE, PRIMARY KEY (id)); `)
14841494
tk.MustExec("begin;")
14851495
tk.MustExec("insert into test(id, val) values(1, 1);")
@@ -1764,6 +1774,7 @@ func (s *testSchemaSuite) TestSchemaCheckerSQL(c *C) {
17641774
tk.MustExec(`insert into t values(1, 1);`)
17651775

17661776
// The schema version is out of date in the first transaction, but the SQL can be retried.
1777+
tk.MustExec("set @@tidb_disable_txn_auto_retry = 0")
17671778
tk.MustExec(`begin;`)
17681779
tk1.MustExec(`alter table t add index idx(c);`)
17691780
tk.MustExec(`insert into t values(2, 2);`)
@@ -1808,6 +1819,7 @@ func (s *testSchemaSuite) TestPrepareStmtCommitWhenSchemaChanged(c *C) {
18081819
tk1.MustExec("execute stmt using @a, @a")
18091820
tk1.MustExec("commit")
18101821

1822+
tk1.MustExec("set @@tidb_disable_txn_auto_retry = 0")
18111823
tk1.MustExec("begin")
18121824
tk.MustExec("alter table t drop column b")
18131825
tk1.MustExec("execute stmt using @a, @a")
@@ -1820,6 +1832,7 @@ func (s *testSchemaSuite) TestCommitWhenSchemaChanged(c *C) {
18201832
tk1 := testkit.NewTestKitWithInit(c, s.store)
18211833
tk.MustExec("create table t (a int, b int)")
18221834

1835+
tk1.MustExec("set @@tidb_disable_txn_auto_retry = 0")
18231836
tk1.MustExec("begin")
18241837
tk1.MustExec("insert into t values (1, 1)")
18251838

@@ -1837,6 +1850,7 @@ func (s *testSchemaSuite) TestRetrySchemaChange(c *C) {
18371850
tk.MustExec("create table t (a int primary key, b int)")
18381851
tk.MustExec("insert into t values (1, 1)")
18391852

1853+
tk1.MustExec("set @@tidb_disable_txn_auto_retry = 0")
18401854
tk1.MustExec("begin")
18411855
tk1.MustExec("update t set b = 5 where a = 1")
18421856

@@ -1867,6 +1881,7 @@ func (s *testSchemaSuite) TestRetryMissingUnionScan(c *C) {
18671881
tk.MustExec("create table t (a int primary key, b int unique, c int)")
18681882
tk.MustExec("insert into t values (1, 1, 1)")
18691883

1884+
tk1.MustExec("set @@tidb_disable_txn_auto_retry = 0")
18701885
tk1.MustExec("begin")
18711886
tk1.MustExec("update t set b = 1, c = 2 where b = 2")
18721887
tk1.MustExec("update t set b = 1, c = 2 where a = 1")

sessionctx/variable/tidb_vars.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ const (
303303
DefTiDBMemQuotaDistSQL = 32 << 30 // 32GB.
304304
DefTiDBGeneralLog = 0
305305
DefTiDBRetryLimit = 10
306-
DefTiDBDisableTxnAutoRetry = false
306+
DefTiDBDisableTxnAutoRetry = true
307307
DefTiDBConstraintCheckInPlace = false
308308
DefTiDBHashJoinConcurrency = 5
309309
DefTiDBProjectionConcurrency = 4

0 commit comments

Comments
 (0)