diff options
| author | NyaMisty <gyc990326@gmail.com> | 2025-06-16 11:30:04 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-15 20:30:04 -0700 |
| commit | f894e7b7a500e6f4af26867233069e71139a7648 (patch) | |
| tree | a4516cded0cf9d1f3a6f43d14021be74dddcf670 /weed/shell/command_ec_encode.go | |
| parent | 53e5c845233c0823346a237984f868a671e4ba37 (diff) | |
| download | seaweedfs-f894e7b7a500e6f4af26867233069e71139a7648.tar.xz seaweedfs-f894e7b7a500e6f4af26867233069e71139a7648.zip | |
Support filtering source disk type in volume.tier.upload (#6868)
Diffstat (limited to 'weed/shell/command_ec_encode.go')
| -rw-r--r-- | weed/shell/command_ec_encode.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/weed/shell/command_ec_encode.go b/weed/shell/command_ec_encode.go index db2fac469..ebdd95b71 100644 --- a/weed/shell/command_ec_encode.go +++ b/weed/shell/command_ec_encode.go @@ -4,6 +4,7 @@ import ( "context" "flag" "fmt" + "github.com/seaweedfs/seaweedfs/weed/storage/types" "io" "time" @@ -107,7 +108,7 @@ func (c *commandEcEncode) Do(args []string, commandEnv *CommandEnv, writer io.Wr balanceCollections = collectCollectionsForVolumeIds(topologyInfo, volumeIds) } else { // apply to all volumes for the given collection - volumeIds, err = collectVolumeIdsForEcEncode(commandEnv, *collection, *fullPercentage, *quietPeriod) + volumeIds, err = collectVolumeIdsForEcEncode(commandEnv, *collection, nil, *fullPercentage, *quietPeriod) if err != nil { return err } @@ -250,7 +251,7 @@ func generateEcShards(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, } -func collectVolumeIdsForEcEncode(commandEnv *CommandEnv, selectedCollection string, fullPercentage float64, quietPeriod time.Duration) (vids []needle.VolumeId, err error) { +func collectVolumeIdsForEcEncode(commandEnv *CommandEnv, selectedCollection string, sourceDiskType *types.DiskType, fullPercentage float64, quietPeriod time.Duration) (vids []needle.VolumeId, err error) { // collect topology information topologyInfo, volumeSizeLimitMb, err := collectTopologyInfo(commandEnv, 0) if err != nil { @@ -270,7 +271,8 @@ func collectVolumeIdsForEcEncode(commandEnv *CommandEnv, selectedCollection stri if v.RemoteStorageName != "" && v.RemoteStorageKey != "" { continue } - if v.Collection == selectedCollection && v.ModifiedAtSecond+quietSeconds < nowUnixSeconds { + if v.Collection == selectedCollection && v.ModifiedAtSecond+quietSeconds < nowUnixSeconds && + (sourceDiskType == nil || types.ToDiskType(v.DiskType) == *sourceDiskType) { if float64(v.Size) > fullPercentage/100*float64(volumeSizeLimitMb)*1024*1024 { if good, found := vidMap[v.Id]; found { if good { |
