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

release-23.2: kv,admission: add missing admission headers #116397

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions pkg/kv/kvclient/kvcoord/txn_interceptor_heartbeater.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,13 @@ func (h *txnHeartbeater) abortTxnAsyncLocked(ctx context.Context) {
// concurrent requests from failing to notice the transaction was aborted.
Poison: true,
})
// NB: Setting `Source: kvpb.AdmissionHeader_OTHER` means this request will
// bypass AC.
ba.AdmissionHeader = kvpb.AdmissionHeader{
Priority: txn.AdmissionPriority,
CreateTime: timeutil.Now().UnixNano(),
Source: kvpb.AdmissionHeader_OTHER,
}

const taskName = "txnHeartbeater: aborting txn"
log.VEventf(ctx, 2, "async abort for txn: %s", txn)
Expand Down
8 changes: 8 additions & 0 deletions pkg/kv/kvserver/replica_range_lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/settings"
"github.com/cockroachdb/cockroach/pkg/util"
"github.com/cockroachdb/cockroach/pkg/util/admission/admissionpb"
"github.com/cockroachdb/cockroach/pkg/util/envutil"
"github.com/cockroachdb/cockroach/pkg/util/growstack"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
Expand Down Expand Up @@ -571,6 +572,13 @@ func (p *pendingLeaseRequest) requestLease(
// lease when the range is unavailable results in, essentially, giving
// up on the lease and thus worsening the situation.
ba.Add(leaseReq)
// NB: Setting `Source: kvpb.AdmissionHeader_OTHER` means this request will
// bypass AC.
ba.AdmissionHeader = kvpb.AdmissionHeader{
Priority: int32(admissionpb.NormalPri),
CreateTime: timeutil.Now().UnixNano(),
Source: kvpb.AdmissionHeader_OTHER,
}
_, pErr := p.repl.Send(ctx, ba)
return pErr.GoError()
}
Expand Down