diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-06-03 20:25:02 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-06-03 20:25:02 -0700 |
| commit | b05456fe07f49e50776124f5b3315c4bd7bfef36 (patch) | |
| tree | 2c6934fbf7df3d1c7197014bf9463aea69273efa /weed/server/volume_grpc_erasure_coding.go | |
| parent | 11cffb3168fd18bbf28772a54a0c3fac13e671e4 (diff) | |
| download | seaweedfs-b05456fe07f49e50776124f5b3315c4bd7bfef36.tar.xz seaweedfs-b05456fe07f49e50776124f5b3315c4bd7bfef36.zip | |
able to purge extra ec shard copies
Diffstat (limited to 'weed/server/volume_grpc_erasure_coding.go')
| -rw-r--r-- | weed/server/volume_grpc_erasure_coding.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/weed/server/volume_grpc_erasure_coding.go b/weed/server/volume_grpc_erasure_coding.go index d73cbdeeb..ab1310c4a 100644 --- a/weed/server/volume_grpc_erasure_coding.go +++ b/weed/server/volume_grpc_erasure_coding.go @@ -126,8 +126,20 @@ func (vs *VolumeServer) VolumeEcShardsDelete(ctx context.Context, req *volume_se baseFilename := erasure_coding.EcShardBaseFileName(req.Collection, int(req.VolumeId)) - for _, shardId := range req.ShardIds { - os.Remove(baseFilename + erasure_coding.ToExt(int(shardId))) + found := false + for _, location := range vs.store.Locations { + if util.FileExists(path.Join(location.Directory, baseFilename+".ecx")) { + found = true + baseFilename = path.Join(location.Directory, baseFilename) + for _, shardId := range req.ShardIds { + os.Remove(baseFilename + erasure_coding.ToExt(int(shardId))) + } + break + } + } + + if !found { + return nil, nil } // check whether to delete the ecx file also |
