diff --git a/pkg/kv/kvpb/batch.go b/pkg/kv/kvpb/batch.go index 51dd42149055..351a80fd57bc 100644 --- a/pkg/kv/kvpb/batch.go +++ b/pkg/kv/kvpb/batch.go @@ -405,25 +405,25 @@ func (ba *BatchRequest) IsCompleteTransaction() bool { panic(fmt.Sprintf("unreachable. Batch requests: %s", TruncatedRequestsString(ba.Requests, 1024))) } -// hasFlag returns true iff one of the requests within the batch contains the -// specified flag. -func (ba *BatchRequest) hasFlag(flag flag) bool { +// hasFlag returns true iff at least one of the requests within the batch +// contains at least one of the specified flags. +func (ba *BatchRequest) hasFlag(flags flag) bool { for _, union := range ba.Requests { - if (union.GetInner().flags() & flag) != 0 { + if (union.GetInner().flags() & flags) != 0 { return true } } return false } -// hasFlagForAll returns true iff all of the requests within the batch contains -// the specified flag. -func (ba *BatchRequest) hasFlagForAll(flag flag) bool { +// hasFlagForAll returns true iff all of the requests within the batch contain +// all of the specified flags. +func (ba *BatchRequest) hasFlagForAll(flags flag) bool { if len(ba.Requests) == 0 { return false } for _, union := range ba.Requests { - if (union.GetInner().flags() & flag) == 0 { + if (union.GetInner().flags() & flags) != flags { return false } } diff --git a/pkg/kv/kvserver/asim/tests/output.go b/pkg/kv/kvserver/asim/tests/output.go index acdda7b5747c..b65725860102 100644 --- a/pkg/kv/kvserver/asim/tests/output.go +++ b/pkg/kv/kvserver/asim/tests/output.go @@ -55,9 +55,9 @@ func (o OutputFlags) set(f OutputFlags) OutputFlags { return o | f } -// Has returns true if this flag has the given f OutputFlags on. +// Has returns true if this flag has all of the given f OutputFlags on. func (o OutputFlags) Has(f OutputFlags) bool { - return o&f != 0 + return o&f == f } type testResult struct {