Skip to content

Commit 22ed1bc

Browse files
committed
kvpb: avoid over redaction of prev_err field
When logging a kvpb.TxnAlreadyEncounteredErrorError, the previous error was getting redacted too aggressively. This patch makes the error use a redactable string instead. Release note: None
1 parent 9ddf582 commit 22ed1bc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/kv/kvclient/kvcoord/txn_coord_sender.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ func (tc *TxnCoordSender) updateStateLocked(
10401040
if kvpb.ErrPriority(pErr.GoError()) != kvpb.ErrorScoreUnambiguousError {
10411041
tc.mu.txnState = txnError
10421042
tc.mu.storedErr = kvpb.NewError(&kvpb.TxnAlreadyEncounteredErrorError{
1043-
PrevError: pErr.String(),
1043+
PrevError: redact.Sprintf("%v", pErr),
10441044
})
10451045
}
10461046

pkg/kv/kvpb/errors.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ message TransactionRetryWithProtoRefreshError {
573573
message TxnAlreadyEncounteredErrorError{
574574
// prev_error is the message from the error that the txn encountered
575575
// previously.
576-
optional string prev_error = 1 [(gogoproto.nullable) = false];
576+
optional string prev_error = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/cockroachdb/redact.RedactableString"];
577577
}
578578

579579
// An IntegerOverflowError indicates that an operation was aborted because

0 commit comments

Comments
 (0)