From af8c5f279001c5b8d3c28944a0dedd3af7e2d285 Mon Sep 17 00:00:00 2001 From: Jackson Owens Date: Mon, 7 Aug 2023 11:31:05 -0400 Subject: [PATCH] internal/cache: mark panic messages as redaction-safe Informs cockroachdb/cockroach#84971. --- internal/cache/refcnt_normal.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/cache/refcnt_normal.go b/internal/cache/refcnt_normal.go index 2a947bee93..9ab3348613 100644 --- a/internal/cache/refcnt_normal.go +++ b/internal/cache/refcnt_normal.go @@ -10,6 +10,8 @@ package cache import ( "fmt" "sync/atomic" + + "github.com/cockroachdb/redact" ) // refcnt provides an atomic reference count. This version is used when the @@ -31,14 +33,14 @@ func (v *refcnt) refs() int32 { func (v *refcnt) acquire() { switch v := v.val.Add(1); { case v <= 1: - panic(fmt.Sprintf("pebble: inconsistent reference count: %d", v)) + panic(redact.Safe(fmt.Sprintf("pebble: inconsistent reference count: %d", v))) } } func (v *refcnt) release() bool { switch v := v.val.Add(-1); { case v < 0: - panic(fmt.Sprintf("pebble: inconsistent reference count: %d", v)) + panic(redact.Safe(fmt.Sprintf("pebble: inconsistent reference count: %d", v))) case v == 0: return true default: