@@ -21,6 +21,7 @@ import (
21
21
"github.com/cockroachdb/cockroach/pkg/sql/schemachanger/screl"
22
22
"github.com/cockroachdb/cockroach/pkg/util/iterutil"
23
23
"github.com/cockroachdb/errors"
24
+ "github.com/cockroachdb/redact"
24
25
)
25
26
26
27
// BuildStages builds the plan's stages for this and all subsequent phases.
@@ -267,9 +268,10 @@ func buildPostCommitStages(bc buildContext, bs buildState) (stages []Stage) {
267
268
var trace []string
268
269
bs .trace = & trace
269
270
sb = bc .makeStageBuilder (bs )
270
- panic (errors .WithDetailf (
271
- errors .AssertionFailedf ("unable to make progress" ),
272
- "terminal state:\n %s\n rule trace:\n %s" , sb , strings .Join (trace , "\n " )))
271
+ panic (errors .AssertionFailedf (
272
+ "unable to make progress\n terminal state:\n %v\n rule trace:\n %s" ,
273
+ sb , redact .SafeString (strings .Join (trace , "\n " )),
274
+ ))
273
275
}
274
276
build (sb )
275
277
}
@@ -726,15 +728,22 @@ func (sb stageBuilder) hasAnyNonRevertibleOps() bool {
726
728
727
729
// String returns a string representation of the stageBuilder.
728
730
func (sb stageBuilder ) String () string {
729
- var str strings.Builder
731
+ return redact .StringWithoutMarkers (sb )
732
+ }
733
+
734
+ // SafeFormat implements redact.SafeFormatter.
735
+ func (sb stageBuilder ) SafeFormat (p redact.SafePrinter , verb rune ) {
730
736
for _ , t := range sb .current {
731
- str .WriteString (" - " )
732
- str .WriteString (screl .NodeString (t .n ))
733
- str .WriteString ("\n " )
737
+ p .SafeString (" - " )
738
+ if err := screl .FormatNode (p , t .n ); err != nil {
739
+ p .UnsafeString (screl .NodeString (t .n ))
740
+ }
741
+ p .SafeString ("\n " )
734
742
}
735
- return str .String ()
736
743
}
737
744
745
+ var _ redact.SafeFormatter = stageBuilder {}
746
+
738
747
// computeExtraOps generates extra operations to decorate a stage with.
739
748
// These are typically job-related.
740
749
//
0 commit comments