Skip to content

Commit

Permalink
storage: retry AdminSplit on roachpb.ConflictUpdatingRangeDescError
Browse files Browse the repository at this point in the history
This allows an internal error to be retried instead of it needing to
be retried on the outside.
  • Loading branch information
vivekmenezes committed Nov 17, 2016
1 parent d77762b commit 6c17172
Show file tree
Hide file tree
Showing 11 changed files with 312 additions and 155 deletions.
4 changes: 1 addition & 3 deletions pkg/cmd/zerosum/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"github.com/cockroachdb/cockroach/pkg/cmd/internal/localcluster"
"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/storage"
"github.com/cockroachdb/cockroach/pkg/util/encoding"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/syncutil"
Expand Down Expand Up @@ -227,8 +226,7 @@ func (z *zeroSum) monkey(tableID uint32, d time.Duration) {
switch r.Intn(2) {
case 0:
if err := z.Split(z.RandNode(r.Intn), key); err != nil {
if strings.Contains(err.Error(), "range is already split at key") ||
strings.Contains(err.Error(), storage.ErrMsgConflictUpdatingRangeDesc) {
if strings.Contains(err.Error(), "range is already split at key") {
continue
}
z.maybeLogError(err)
Expand Down
3 changes: 3 additions & 0 deletions pkg/kv/dist_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,9 @@ func (ds *DistSender) sendPartialBatch(
log.VEventf(ctx, 1, "likely split; resending batch to span: %s", tErr)
reply, pErr = ds.divideAndSendBatchToRanges(ctx, ba, intersected, isFirst)
return response{reply: reply, pErr: pErr}
case *roachpb.ConflictUpdatingRangeDescError:
log.Event(ctx, "retrying on conflict updating range descriptor error")
continue
}
break
}
Expand Down
1 change: 1 addition & 0 deletions pkg/roachpb/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pkg/roachpb/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,16 @@ func (e *AmbiguousResultError) message(_ *Error) string {

var _ ErrorDetailInterface = &AmbiguousResultError{}

func (e *ConflictUpdatingRangeDescError) Error() string {
return "conflict updating range descriptor"
}

func (e *ConflictUpdatingRangeDescError) message(_ *Error) string {
return e.Error()
}

var _ ErrorDetailInterface = &ConflictUpdatingRangeDescError{}

func (e *TransactionAbortedError) Error() string {
return "txn aborted"
}
Expand Down
Loading

0 comments on commit 6c17172

Please sign in to comment.