Skip to content

Commit

Permalink
kv,admission: only log empty admission warning for non-release builds
Browse files Browse the repository at this point in the history
This error message, while useful for debugging, spams the logs with a
stack trace which can be distracting when reading the logs.

Since AC defaults to skip when there is an empty header, this is not a
concern, unless we see real-world performance impact (which we have
not).

This patch removes it from release builds while we figure out all the
sources for missing headers.

Informs cockroachdb#112680

Release note: None
  • Loading branch information
aadityasondhi committed Dec 6, 2023
1 parent 7a85aa8 commit 943f747
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/kv/kvserver/intentresolver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ go_library(
importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/intentresolver",
visibility = ["//visibility:public"],
deps = [
"//pkg/build",
"//pkg/internal/client/requestbatcher",
"//pkg/keys",
"//pkg/kv",
Expand Down
5 changes: 4 additions & 1 deletion pkg/kv/kvserver/intentresolver/intent_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"sort"
"time"

"github.com/cockroachdb/cockroach/pkg/build"
"github.com/cockroachdb/cockroach/pkg/internal/client/requestbatcher"
"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/kv"
Expand Down Expand Up @@ -1025,7 +1026,9 @@ func (ir *IntentResolver) resolveIntents(
var singleReq [1]kvpb.Request //gcassert:noescape
reqs := resolveIntentReqs(intents, opts, singleReq[:])
h := opts.AdmissionHeader
if h == (kvpb.AdmissionHeader{}) && ir.everyAdmissionHeaderMissing.ShouldLog() {
// We skip the warning for release builds to avoid printing out verbose stack traces.
// TODO(aaditya): reconsider this once #112680 is resolved.
if !build.IsRelease() && h == (kvpb.AdmissionHeader{}) && ir.everyAdmissionHeaderMissing.ShouldLog() {
log.Warningf(ctx, "empty admission header provided by %s", string(debug.Stack()))
}
// Send the requests ...
Expand Down

0 comments on commit 943f747

Please sign in to comment.