Skip to content

Commit b055b6b

Browse files
craig[bot]Abhinav1299
andcommitted
Merge #148570
148570: kvclient: update error formatting in BatchResponse and improve test expectations in dist_sender_test r=Abhinav1299 a=Abhinav1299 This commit removes the `StripMarkers` function from dist_sender_test.go file. The `StripMarkers` function should be present in the tests to validate that redaction is working fine. This fixes the changes made in #147609 which adds the StripMarkers function. Moreover since the redaction markers are preserved now, it also caters to safeFormat implemented on Spans ref #147739. No functional changes were made to the logic. Epic: CRDB-37533 Part of: CRDB-44885 Release note: None Co-authored-by: Abhinav1299 <[email protected]>
2 parents da1c4c6 + b592edd commit b055b6b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pkg/kv/kvclient/kvcoord/dist_sender_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4770,26 +4770,26 @@ func TestDistSenderSlowLogMessage(t *testing.T) {
47704770
br.Error = kvpb.NewError(errors.New("boom"))
47714771
desc := &roachpb.RangeDescriptor{RangeID: 9, StartKey: roachpb.RKey("x"), EndKey: roachpb.RKey("z")}
47724772
{
4773-
exp := `have been waiting 8.16s (120 attempts) for RPC Get(Shared,Unreplicated) ["a"] to` +
4774-
` r9:{x-z} [<no replicas>, next=0, gen=0]; resp: (err: boom)`
4773+
exp := `have been waiting 8.16s (120 attempts) for RPC Get(Shared,Unreplicated) ["a"] to` +
4774+
` r9:{‹x›-‹z›} [<no replicas>, next=0, gen=0]; resp: (err: boom)`
47754775
var s redact.StringBuilder
47764776
slowRangeRPCWarningStr(&s, ba, dur, attempts, desc, nil /* err */, br)
4777-
act := s.RedactableString().StripMarkers()
4777+
act := s.RedactableString()
47784778
require.EqualValues(t, exp, act)
47794779
}
47804780
{
47814781
exp := `slow RPC finished after 8.16s (120 attempts)`
47824782
var s redact.StringBuilder
47834783
slowRangeRPCReturnWarningStr(&s, dur, attempts)
4784-
act := s.RedactableString().StripMarkers()
4784+
act := s.RedactableString()
47854785
require.EqualValues(t, exp, act)
47864786
}
47874787
{
4788-
exp := `have been waiting 8.16s (120 attempts) for RPC Get(Shared,Unreplicated) ["a"] to` +
4788+
exp := `have been waiting 8.16s (120 attempts) for RPC Get(Shared,Unreplicated) ["a"] to` +
47894789
` replica (n2,s3):1; resp: (err: boom)`
47904790
var s redact.StringBuilder
47914791
slowReplicaRPCWarningStr(&s, ba, dur, attempts, nil /* err */, br)
4792-
act := s.RedactableString().StripMarkers()
4792+
act := s.RedactableString()
47934793
require.EqualValues(t, exp, act)
47944794
}
47954795
}

pkg/kv/kvpb/batch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ func (br *BatchResponse) String() string {
487487
func (br *BatchResponse) SafeFormat(s redact.SafePrinter, verb rune) {
488488
// Marking Error of BatchResponse as safe as Outside of the RPC boundaries,
489489
// this field is nil and must neither be checked nor populated
490-
s.Printf("(err: %s)", redact.Safe(br.Error.String()))
490+
s.Printf("(err: %v)", br.Error)
491491

492492
for count, union := range br.Responses {
493493
// Limit the strings to provide just a summary. Without this limit a log

0 commit comments

Comments
 (0)