Merge pull request #635 from pingcap/c4pt0r/retryable-error

kv: add retryable err
This commit is contained in:
dongxu
2015-11-24 19:24:03 +08:00
2 changed files with 6 additions and 1 deletions

View File

@ -31,6 +31,9 @@ var (
ErrLockConflict = errors.New("Error: Lock conflict")
// ErrLazyConditionPairsNotMatch is used when value in store differs from expect pairs.
ErrLazyConditionPairsNotMatch = errors.New("Error: Lazy condition pairs not match")
// ErrRetryable is used when KV store occurs RPC error or some other
// errors which SQL layer can safely retry.
ErrRetryable = errors.New("Error: KV error safe to retry")
)
var (

View File

@ -25,7 +25,9 @@ func IsRetryableError(err error) bool {
return false
}
if terror.ErrorEqual(err, ErrLockConflict) || terror.ErrorEqual(err, ErrConditionNotMatch) {
if terror.ErrorEqual(err, ErrRetryable) ||
terror.ErrorEqual(err, ErrLockConflict) ||
terror.ErrorEqual(err, ErrConditionNotMatch) {
return true
}