Skip to content

Commit

Permalink
GOCBC-512: Add error helper for DurableWriteReCommitInProgress
Browse files Browse the repository at this point in the history
Change-Id: I6d75f7a50ea950ab1fafb566617480e8e22a9604
Reviewed-on: http://review.couchbase.org/114691
Reviewed-by: Mike Goldsmith <goldsmith.mike@gmail.com>
Tested-by: Charles Dixon <chvckd@gmail.com>
  • Loading branch information
chvck committed Sep 16, 2019
1 parent 1fd516c commit 1ef8075
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,17 @@ func IsDurabilityImpossibleError(err error) bool {
return false
}

// IsSyncWriteReCommitInProgressError verifies whether or not the cause for an error is because of an
// attempt to mutate a key which has a SyncWrite recommit pending. Client should retry, possibly with backoff.
func IsSyncWriteReCommitInProgressError(err error) bool {
cause := errors.Cause(err)
if kvErr, ok := cause.(KeyValueError); ok && kvErr.KeyValueError() {
return kvErr.StatusCode() == int(gocbcore.StatusSyncWriteReCommitInProgress)
}

return false
}

// IsSyncWriteInProgressError verifies whether or not the cause for an error is because of an
// attempt to mutate a key which has a SyncWrite pending. Client should retry, possibly with backoff.
func IsSyncWriteInProgressError(err error) bool {
Expand Down

0 comments on commit 1ef8075

Please sign in to comment.