Skip to content

Commit

Permalink
rac2: make AdmittedVector printing redaction-safe
Browse files Browse the repository at this point in the history
Epic: none
Release note: none
  • Loading branch information
pav-kv committed Dec 19, 2024
1 parent b1253a8 commit 9cb9ca8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pkg/kv/kvserver/kvflowcontrol/rac2/log_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ func (av AdmittedVector) SafeFormat(w redact.SafePrinter, _ rune) {
buf.Printf("term:%d, admitted:[", av.Term)
for pri, index := range av.Admitted {
if pri > 0 {
buf.Printf(",")
buf.SafeRune(',')
}
buf.Printf("%s:%d", raftpb.Priority(pri), index)
}
buf.Printf("]")
w.Printf("%v", buf)
buf.SafeRune(']')
w.SafeString(redact.SafeString(buf.String()))
}

// LogTracker tracks the durable and logically admitted state of a raft log.
Expand Down
8 changes: 4 additions & 4 deletions pkg/raft/raftpb/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ func (p Priority) String() string {
func (p Priority) SafeFormat(w redact.SafePrinter, _ rune) {
switch p {
case LowPri:
w.Printf("LowPri")
w.SafeString("LowPri")
case NormalPri:
w.Printf("NormalPri")
w.SafeString("NormalPri")
case AboveNormalPri:
w.Printf("AboveNormalPri")
w.SafeString("AboveNormalPri")
case HighPri:
w.Printf("HighPri")
w.SafeString("HighPri")
default:
panic("invalid raft priority")
}
Expand Down

0 comments on commit 9cb9ca8

Please sign in to comment.