Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kvserver: remove the assertion on not exceeding MaxSpanRequestKeys #92942

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions pkg/kv/kvserver/replica_evaluate.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/errors"
"github.com/cockroachdb/redact"
"github.com/kr/pretty"
)

Expand Down Expand Up @@ -404,20 +403,13 @@ func evaluateBatch(
// the batch, but with limit-aware operations returning no data.
h := reply.Header()
if limit, retResults := baHeader.MaxSpanRequestKeys, h.NumKeys; limit != 0 && retResults > 0 {
if retResults > limit {
exceedingAllowed := baHeader.WholeRowsOfSize != 0 && !baHeader.AllowEmpty
if !exceedingAllowed {
index, retResults, limit := index, retResults, limit // don't alloc unless branch taken
return nil, mergedResult, roachpb.NewError(errors.AssertionFailedf(
"received %d results, limit was %d (original limit: %d, batch=%s idx=%d)",
retResults, limit, ba.Header.MaxSpanRequestKeys,
redact.Safe(ba.Summary()), index))
}
} else if retResults < limit {
if retResults < limit {
baHeader.MaxSpanRequestKeys -= retResults
} else {
// They were equal, so drop to -1 instead of zero (which would
// mean "no limit").
// The limit was either exceeded (which is allowed in some cases
// like when WholeRowsOfSize is set and AllowEmpty is false) or
// was exactly used up, so drop to -1 instead of zero (which
// would mean "no limit").
baHeader.MaxSpanRequestKeys = -1
}
}
Expand Down