volume.scrub and ec.scrub shell commands: make the display of scrub details optional. (#9911)

On volumes failing scrubs, the detail output can get very verbose, which makes
reading results difficult. Most users won't care about this information to
begin with - just whether or not volumes pass scrub tests.

This MR gates the display of scrub result details behind a `--details` flag.
This commit is contained in:
Lisandro Pin
2026-06-10 13:29:07 -07:00
committed by GitHub
parent caadd6ca79
commit 6b4d20a6f3
2 changed files with 8 additions and 6 deletions
+4 -3
View File
@@ -51,6 +51,7 @@ func (c *commandEcVolumeScrub) Do(args []string, commandEnv *CommandEnv, writer
volumeIDsStr := volScrubCommand.String("volumeId", "", "comma-separated EC volume IDs to process (optional)")
mode := volScrubCommand.String("mode", "local", "scrubbing mode (index/local/full/checksum)")
maxParallelization := volScrubCommand.Int("maxParallelization", DefaultMaxParallelization, "run up to X tasks in parallel, whenever possible")
showDetails := volScrubCommand.Bool("details", false, "display scrub result details, if available")
if err = volScrubCommand.Parse(args); err != nil {
return err
@@ -104,10 +105,10 @@ func (c *commandEcVolumeScrub) Do(args []string, commandEnv *CommandEnv, writer
fmt.Fprintf(writer, "using %s mode\n", c.mode.String())
c.env = commandEnv
return c.scrubEcVolumes(writer, *maxParallelization)
return c.scrubEcVolumes(writer, *maxParallelization, *showDetails)
}
func (c *commandEcVolumeScrub) scrubEcVolumes(writer io.Writer, maxParallelization int) error {
func (c *commandEcVolumeScrub) scrubEcVolumes(writer io.Writer, maxParallelization int, showDetails bool) error {
var brokenVolumesStr, brokenShardsStr []string
var details []string
var totalVolumes, brokenVolumes, brokenShards, totalFiles uint64
@@ -164,7 +165,7 @@ func (c *commandEcVolumeScrub) scrubEcVolumes(writer io.Writer, maxParallelizati
if len(brokenShardsStr) != 0 {
fmt.Fprintf(writer, "Affected shards: %s\n", strings.Join(brokenShardsStr, ", "))
}
if len(details) != 0 {
if showDetails && len(details) != 0 {
fmt.Fprintf(writer, "Details:\n\t%s\n", strings.Join(details, "\n\t"))
}
}
+4 -3
View File
@@ -53,6 +53,7 @@ func (c *commandVolumeScrub) Do(args []string, commandEnv *CommandEnv, writer io
mode := volScrubCommand.String("mode", "full", "scrubbing mode (index/local/full)")
markBrokenReadonly := volScrubCommand.Bool("markBrokenReadonly", false, "whether to flag volumes with scrub failures as read-only")
maxParallelization := volScrubCommand.Int("maxParallelization", DefaultMaxParallelization, "run up to X tasks in parallel, whenever possible")
showDetails := volScrubCommand.Bool("details", false, "display scrub result details, if available")
if err = volScrubCommand.Parse(args); err != nil {
return err
@@ -104,10 +105,10 @@ func (c *commandVolumeScrub) Do(args []string, commandEnv *CommandEnv, writer io
fmt.Fprintf(writer, "using %s mode\n", c.mode.String())
c.env = commandEnv
return c.scrubVolumes(writer, *maxParallelization, *markBrokenReadonly)
return c.scrubVolumes(writer, *maxParallelization, *markBrokenReadonly, *showDetails)
}
func (c *commandVolumeScrub) scrubVolumes(writer io.Writer, maxParallelization int, markBrokenReadonly bool) error {
func (c *commandVolumeScrub) scrubVolumes(writer io.Writer, maxParallelization int, markBrokenReadonly bool, showDetails bool) error {
var brokenVolumesStr []string
var details []string
var totalVolumes, brokenVolumes, totalFiles uint64
@@ -158,7 +159,7 @@ func (c *commandVolumeScrub) scrubVolumes(writer io.Writer, maxParallelization i
if brokenVolumes != 0 {
fmt.Fprintf(writer, "\nGot scrub failures on %d volumes :(\n", brokenVolumes)
fmt.Fprintf(writer, "Affected volumes: %s\n", strings.Join(brokenVolumesStr, ", "))
if len(details) != 0 {
if showDetails && len(details) != 0 {
fmt.Fprintf(writer, "Details:\n\t%s\n", strings.Join(details, "\n\t"))
}
}