Browse Source

Rework collection resultion for `ec.rebuild`, in preparation for parallelization. (#7420)

* Rework collection resultion for `ec.rebuild`, in preparation for parallelization.

See https://github.com/seaweedfs/seaweedfs/issues/7416 .

* simplify

* Update weed/shell/command_ec_rebuild.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: chrislu <chris.lu@gmail.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
pull/7428/head
Lisandro Pin 3 weeks ago
committed by GitHub
parent
commit
1668c1042b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 16
      weed/shell/command_ec_rebuild.go

16
weed/shell/command_ec_rebuild.go

@ -79,23 +79,23 @@ func (c *commandEcRebuild) Do(args []string, commandEnv *CommandEnv, writer io.W
return err return err
} }
var collections []string
if *collection == "EACH_COLLECTION" { if *collection == "EACH_COLLECTION" {
collections, err := ListCollectionNames(commandEnv, false, true)
collections, err = ListCollectionNames(commandEnv, false, true)
if err != nil { if err != nil {
return err return err
} }
fmt.Printf("rebuildEcVolumes collections %+v\n", len(collections))
} else {
collections = []string{*collection}
}
fmt.Printf("rebuildEcVolumes for %d collection(s)\n", len(collections))
for _, c := range collections { for _, c := range collections {
fmt.Printf("rebuildEcVolumes collection %+v\n", c)
fmt.Printf("rebuildEcVolumes collection %s\n", c)
if err = rebuildEcVolumes(commandEnv, allEcNodes, c, writer, *applyChanges); err != nil { if err = rebuildEcVolumes(commandEnv, allEcNodes, c, writer, *applyChanges); err != nil {
return err return err
} }
} }
} else {
if err = rebuildEcVolumes(commandEnv, allEcNodes, *collection, writer, *applyChanges); err != nil {
return err
}
}
return nil return nil
} }

Loading…
Cancel
Save