Skip to content

Commit

Permalink
make tidb_disable_txn_auto_retry as it used to be (#10339)
Browse files Browse the repository at this point in the history
Signed-off-by: Shuaipeng Yu <[email protected]>
  • Loading branch information
jackysp authored May 5, 2019
1 parent 6f67214 commit 71d15aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (s *session) doCommitWithRetry(ctx context.Context) error {
// For autocommit single statement transactions, the history count is always 1.
// For explicit transactions, the statement count is more than 1.
history := GetHistory(s)
if history.Count() > 1 && strings.Contains(err.Error(), util.WriteConflictMarker) {
if history.Count() > 1 {
commitRetryLimit = 0
}
}
Expand Down
6 changes: 3 additions & 3 deletions session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2421,12 +2421,12 @@ func (s *testSchemaSuite) TestDisableTxnAutoRetry(c *C) {
tk2.MustExec("alter table no_retry add index idx(id)")
tk2.MustQuery("select * from no_retry").Check(testkit.Rows("8"))
tk1.MustExec("update no_retry set id = 10")
tk1.MustExec("commit")
tk2.MustQuery("select * from no_retry").Check(testkit.Rows("10"))
_, err = tk1.Se.Execute(context.Background(), "commit")
c.Assert(err, NotNil)

// set autocommit to begin and commit
tk1.MustExec("set autocommit = 0")
tk1.MustQuery("select * from no_retry").Check(testkit.Rows("10"))
tk1.MustQuery("select * from no_retry").Check(testkit.Rows("8"))
tk2.MustExec("update no_retry set id = 11")
tk1.MustExec("update no_retry set id = 12")
_, err = tk1.Se.Execute(context.Background(), "set autocommit = 1")
Expand Down

0 comments on commit 71d15aa

Please sign in to comment.