SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
`volume.scrub` and `ec.scrub` shell commands: make the display of scrub details optional. (#9911)
Lisandro Pin6b4d20a6f3f8
diff --git a/weed/shell/command_ec_scrub.go b/weed/shell/command_ec_scrub.goindex ee3235972d..e9bd36f6e1 100644--- a/weed/shell/command_ec_scrub.go+++ b/weed/shell/command_ec_scrub.go@@ -51,6 +51,7 @@ func (c *commandEcVolumeScrub) Do(args []string, commandEnv *CommandEnv, writervolumeIDsStr := 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, writerfmt.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 []stringvar details []stringvar totalVolumes, brokenVolumes, brokenShards, totalFiles uint64@@ -164,7 +165,7 @@ func (c *commandEcVolumeScrub) scrubEcVolumes(writer io.Writer, maxParallelizatiif 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"))}}diff --git a/weed/shell/command_volume_scrub.go b/weed/shell/command_volume_scrub.goindex 1b99678e96..dfac142945 100644--- a/weed/shell/command_volume_scrub.go+++ b/weed/shell/command_volume_scrub.go@@ -53,6 +53,7 @@ func (c *commandVolumeScrub) Do(args []string, commandEnv *CommandEnv, writer iomode := 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 iofmt.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 []stringvar details []stringvar totalVolumes, brokenVolumes, totalFiles uint64@@ -158,7 +159,7 @@ func (c *commandVolumeScrub) scrubVolumes(writer io.Writer, maxParallelization iif 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"))}}