aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLisandro Pin <lisandro.pin@proton.ch>2025-02-10 18:49:58 +0100
committerGitHub <noreply@github.com>2025-02-10 09:49:58 -0800
commit392656d59e5d768cbed9b0a92cbf8b815f342d1e (patch)
tree3f5e9a0bb0f4fd0fad4202c1f3000d2688192324
parentde66c82252a6f0f2e9cc4aa09284979622da2828 (diff)
downloadseaweedfs-392656d59e5d768cbed9b0a92cbf8b815f342d1e.tar.xz
seaweedfs-392656d59e5d768cbed9b0a92cbf8b815f342d1e.zip
`ec.encode`: Explictly mount EC shards after volume conversion. (#6528)
This guarantees EC shards are immediately available after encoding, even if not affected by subsequent re-balancing.
-rw-r--r--weed/shell/command_ec_encode.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/weed/shell/command_ec_encode.go b/weed/shell/command_ec_encode.go
index da0a94f0f..e341f7828 100644
--- a/weed/shell/command_ec_encode.go
+++ b/weed/shell/command_ec_encode.go
@@ -143,6 +143,7 @@ func doEcEncode(commandEnv *CommandEnv, collection string, vid needle.VolumeId,
if !found {
return fmt.Errorf("volume %d not found", vid)
}
+ target := locations[0]
// mark the volume as readonly
ewg = NewErrorWaitGroup(maxParallelization)
@@ -159,8 +160,8 @@ func doEcEncode(commandEnv *CommandEnv, collection string, vid needle.VolumeId,
}
// generate ec shards
- if err := generateEcShards(commandEnv.option.GrpcDialOption, vid, collection, locations[0].ServerAddress()); err != nil {
- return fmt.Errorf("generate ec shards for volume %d on %s: %v", vid, locations[0].Url, err)
+ if err := generateEcShards(commandEnv.option.GrpcDialOption, vid, collection, target.ServerAddress()); err != nil {
+ return fmt.Errorf("generate ec shards for volume %d on %s: %v", vid, target.Url, err)
}
// ask the source volume server to delete the original volume
@@ -178,6 +179,15 @@ func doEcEncode(commandEnv *CommandEnv, collection string, vid needle.VolumeId,
return err
}
+ // mount all ec shards for the converted volume
+ shardIds := make([]uint32, erasure_coding.TotalShardsCount)
+ for i := range shardIds {
+ shardIds[i] = uint32(i)
+ }
+ if err := mountEcShards(commandEnv.option.GrpcDialOption, collection, vid, target.ServerAddress(), shardIds); err != nil {
+ return fmt.Errorf("mount ec shards for volume %d on %s: %v", vid, target.Url, err)
+ }
+
return nil
}