Skip to content

Commit

Permalink
session: log retryable errors. (pingcap#2832)
Browse files Browse the repository at this point in the history
  • Loading branch information
disksing authored and coocood committed Mar 15, 2017
1 parent c93cfcb commit 638234e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion session.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func (s *session) doCommitWithRetry() error {
err := s.doCommit()
if err != nil {
if s.isRetryableError(err) {
log.Warnf("[%d] retryable error: %v, txn: %v", s.sessionVars.ConnectionID, err, s.txn)
// Transactions will retry 2 ~ commitRetryLimit times.
// We make larger transactions retry less times to prevent cluster resource outage.
txnSizeRate := float64(txnSize) / float64(kv.TxnTotalSizeLimit)
Expand Down Expand Up @@ -363,9 +364,10 @@ func (s *session) retry(maxCnt int) error {
}
retryCnt++
if !s.unlimitedRetryCount && (retryCnt >= maxCnt) {
log.Warnf("[%id] Retry reached max count %d", connID, retryCnt)
log.Warnf("[%d] Retry reached max count %d", connID, retryCnt)
return errors.Trace(err)
}
log.Warnf("[%d] retryable error: %v, txn: %v", connID, err, s.txn)
kv.BackOff(retryCnt)
}
return err
Expand Down

0 comments on commit 638234e

Please sign in to comment.