Skip to content

Commit

Permalink
kvserver: improve reporting for an assertion
Browse files Browse the repository at this point in the history
Downgrade the assertion to returning an error to the user, asking nicely
for providing their repro on the issue. We keep reporting to sentry
despite not terminating the process.

Touches cockroachdb#46652.

Release justification: low-risk reporting improvement
Release note: None
  • Loading branch information
tbg committed Apr 1, 2020
1 parent 9c59059 commit c1b1189
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/kv/kvserver/replica_evaluate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/storage"
"github.com/cockroachdb/cockroach/pkg/storage/enginepb"
"github.com/cockroachdb/cockroach/pkg/util/errorutil"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/errors"
Expand Down Expand Up @@ -333,7 +334,14 @@ func evaluateBatch(
if limit := baHeader.MaxSpanRequestKeys; limit > 0 {
retResults := reply.Header().NumKeys
if retResults > limit {
log.Fatalf(ctx, "received %d results, limit was %d", retResults, limit)
index, retResults, limit := index, retResults, limit // don't alloc unless branch taken
err := errorutil.UnexpectedWithIssueErrorf(46652,
"received %d results, limit was %d (original limit: %d, batch=%s idx=%d)",
errors.Safe(retResults), errors.Safe(limit),
errors.Safe(ba.Header.MaxSpanRequestKeys),
errors.Safe(ba.Summary()), errors.Safe(index))
errorutil.SendReport(ctx, &rec.ClusterSettings().SV, err)
return nil, mergedResult, roachpb.NewError(err)
} else if retResults < limit {
baHeader.MaxSpanRequestKeys -= retResults
} else {
Expand Down

0 comments on commit c1b1189

Please sign in to comment.