ec.encode: Fix resolution of target collections. (#6585)
* Don't ignore empty (`""`) collection names when computing collections for a given volume ID.
* `ec.encode`: Fix resolution of target collections.
When no `volumeId` parameter is provided, compute volumes
based on the provided collection name, even if it's empty (`""`).
This restores behavior to before recent EC rebalancing rework. See also
ec30a504ba/weed/shell/command_ec_encode.go (L99) .
This commit is contained in:
@@ -98,23 +98,19 @@ func (c *commandEcEncode) Do(args []string, commandEnv *CommandEnv, writer io.Wr
|
||||
}
|
||||
}
|
||||
|
||||
var collections []string
|
||||
var volumeIds []needle.VolumeId
|
||||
if vid := needle.VolumeId(*volumeId); vid != 0 {
|
||||
// volumeId is provided
|
||||
volumeIds = append(volumeIds, vid)
|
||||
collections = collectCollectionsForVolumeIds(topologyInfo, volumeIds)
|
||||
} else {
|
||||
// apply to all volumes in the collection
|
||||
// apply to all volumes for the given collection
|
||||
volumeIds, err = collectVolumeIdsForEcEncode(commandEnv, *collection, *fullPercentage, *quietPeriod)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
var collections []string
|
||||
if *collection != "" {
|
||||
collections = []string{*collection}
|
||||
} else {
|
||||
collections = collectCollectionsForVolumeIds(topologyInfo, volumeIds)
|
||||
collections = append(collections, *collection)
|
||||
}
|
||||
|
||||
// encode all requested volumes...
|
||||
|
||||
Reference in New Issue
Block a user