tidb: Make sure TestIssue571 pass

Set session maxRetryCnt to unlimited times.
This commit is contained in:
shenli
2015-11-24 16:21:41 +08:00
parent 7d9d802af7
commit aa92d10bc6
2 changed files with 6 additions and 1 deletions

View File

@ -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)
}
}

View File

@ -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