tidb: Make sure TestIssue571 pass
Set session maxRetryCnt to unlimited times.
This commit is contained in:
@ -108,6 +108,8 @@ func (h *stmtHistory) clone() *stmtHistory {
|
||||
return &nh
|
||||
}
|
||||
|
||||
const unlimitedRetryCnt = -1
|
||||
|
||||
type session struct {
|
||||
txn kv.Transaction // Current transaction
|
||||
args []interface{} // Statment execution args, this should be cleaned up after exec
|
||||
@ -254,7 +256,7 @@ func (s *session) Retry() error {
|
||||
}
|
||||
}
|
||||
retryCnt++
|
||||
if (s.maxRetryCnt > 0) && (retryCnt >= s.maxRetryCnt) {
|
||||
if (s.maxRetryCnt != unlimitedRetryCnt) && (retryCnt >= s.maxRetryCnt) {
|
||||
return errors.Trace(err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1131,10 +1131,13 @@ func (s *testSessionSuite) TestIssue571(c *C) {
|
||||
mustExecSQL(c, se, "commit")
|
||||
|
||||
se1 := newSession(c, store, s.dbName)
|
||||
se1.(*session).maxRetryCnt = unlimitedRetryCnt
|
||||
mustExecSQL(c, se1, "SET SESSION autocommit=1;")
|
||||
se2 := newSession(c, store, s.dbName)
|
||||
se2.(*session).maxRetryCnt = unlimitedRetryCnt
|
||||
mustExecSQL(c, se2, "SET SESSION autocommit=1;")
|
||||
se3 := newSession(c, store, s.dbName)
|
||||
se3.(*session).maxRetryCnt = unlimitedRetryCnt
|
||||
mustExecSQL(c, se3, "SET SESSION autocommit=0;")
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
||||
Reference in New Issue
Block a user