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
`ec.encode`: Fix resolution of target collections. (#6585)
Lisandro Pinc07596691c58
diff --git a/weed/shell/command_ec_common.go b/weed/shell/command_ec_common.goindex f2845224e9..c49ab76111 100644--- a/weed/shell/command_ec_common.go+++ b/weed/shell/command_ec_common.go@@ -248,14 +248,14 @@ func collectCollectionsForVolumeIds(t *master_pb.TopologyInfo, vids []needle.Volfor _, diskInfo := range dn.DiskInfos {for _, vi := range diskInfo.VolumeInfos {for _, vid := range vids {- if needle.VolumeId(vi.Id) == vid && vi.Collection != "" {+ if needle.VolumeId(vi.Id) == vid {found[vi.Collection] = true}}}for _, ecs := range diskInfo.EcShardInfos {for _, vid := range vids {- if needle.VolumeId(ecs.Id) == vid && ecs.Collection != "" {+ if needle.VolumeId(ecs.Id) == vid {found[ecs.Collection] = true}}diff --git a/weed/shell/command_ec_common_test.go b/weed/shell/command_ec_common_test.goindex fa9460288e..f1f460bc64 100644--- a/weed/shell/command_ec_common_test.go+++ b/weed/shell/command_ec_common_test.go@@ -45,9 +45,9 @@ func TestCollectCollectionsForVolumeIds(t *testing.T) {{topology1, nil, nil},{topology1, []needle.VolumeId{}, nil},{topology1, []needle.VolumeId{needle.VolumeId(9999)}, nil},- {topology1, []needle.VolumeId{needle.VolumeId(2)}, nil},- {topology1, []needle.VolumeId{needle.VolumeId(2), needle.VolumeId(272)}, []string{"collection2"}},- {topology1, []needle.VolumeId{needle.VolumeId(2), needle.VolumeId(272), needle.VolumeId(299)}, []string{"collection2"}},+ {topology1, []needle.VolumeId{needle.VolumeId(2)}, []string{""}},+ {topology1, []needle.VolumeId{needle.VolumeId(2), needle.VolumeId(272)}, []string{"", "collection2"}},+ {topology1, []needle.VolumeId{needle.VolumeId(2), needle.VolumeId(272), needle.VolumeId(299)}, []string{"", "collection2"}},{topology1, []needle.VolumeId{needle.VolumeId(272), needle.VolumeId(299), needle.VolumeId(95)}, []string{"collection1", "collection2"}},{topology1, []needle.VolumeId{needle.VolumeId(272), needle.VolumeId(299), needle.VolumeId(95), needle.VolumeId(51)}, []string{"collection1", "collection2"}},{topology1, []needle.VolumeId{needle.VolumeId(272), needle.VolumeId(299), needle.VolumeId(95), needle.VolumeId(51), needle.VolumeId(15)}, []string{"collection0", "collection1", "collection2"}},diff --git a/weed/shell/command_ec_encode.go b/weed/shell/command_ec_encode.goindex e341f7828a..a1d899d15f 100644--- a/weed/shell/command_ec_encode.go+++ b/weed/shell/command_ec_encode.go@@ -98,23 +98,19 @@ func (c *commandEcEncode) Do(args []string, commandEnv *CommandEnv, writer io.Wr}}+ var collections []stringvar volumeIds []needle.VolumeIdif vid := needle.VolumeId(*volumeId); vid != 0 {// volumeId is providedvolumeIds = append(volumeIds, vid)+ collections = collectCollectionsForVolumeIds(topologyInfo, volumeIds)} else {- // apply to all volumes in the collection+ // apply to all volumes for the given collectionvolumeIds, 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...