aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_ec_balance.go
diff options
context:
space:
mode:
authorLisandro Pin <lisandro.pin@proton.ch>2024-12-02 17:44:07 +0100
committerGitHub <noreply@github.com>2024-12-02 08:44:07 -0800
commitb2ba7d7408500bb450884a288327a1fb53e67fae (patch)
treeb16eac42446ecd69bf5c2a8b3a57afb49b0d644b /weed/shell/command_ec_balance.go
parent9a741a61b195ccdf9815ab64dc9f0725f620f836 (diff)
downloadseaweedfs-b2ba7d7408500bb450884a288327a1fb53e67fae.tar.xz
seaweedfs-b2ba7d7408500bb450884a288327a1fb53e67fae.zip
Resolve replica placement for EC volumes from master server defaults. (#6303)
Diffstat (limited to 'weed/shell/command_ec_balance.go')
-rw-r--r--weed/shell/command_ec_balance.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/weed/shell/command_ec_balance.go b/weed/shell/command_ec_balance.go
index 6004ad7e4..24dea3e2d 100644
--- a/weed/shell/command_ec_balance.go
+++ b/weed/shell/command_ec_balance.go
@@ -17,10 +17,11 @@ func (c *commandEcBalance) Name() string {
return "ec.balance"
}
+// TODO: Update help string and move to command_ec_common.go once shard replica placement logic is enabled.
func (c *commandEcBalance) Help() string {
return `balance all ec shards among all racks and volume servers
- ec.balance [-c EACH_COLLECTION|<collection_name>] [-force] [-dataCenter <data_center>]
+ ec.balance [-c EACH_COLLECTION|<collection_name>] [-force] [-dataCenter <data_center>] [-shardReplicaPlacement <replica_placement>]
Algorithm:
@@ -100,6 +101,7 @@ func (c *commandEcBalance) Do(args []string, commandEnv *CommandEnv, writer io.W
balanceCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
collection := balanceCommand.String("collection", "EACH_COLLECTION", "collection name, or \"EACH_COLLECTION\" for each collection")
dc := balanceCommand.String("dataCenter", "", "only apply the balancing for this dataCenter")
+ shardReplicaPlacement := balanceCommand.String("shardReplicaPlacement", "", "replica placement for EC shards, or master default if empty (currently unused)")
applyBalancing := balanceCommand.Bool("force", false, "apply the balancing plan")
if err = balanceCommand.Parse(args); err != nil {
return nil
@@ -121,5 +123,10 @@ func (c *commandEcBalance) Do(args []string, commandEnv *CommandEnv, writer io.W
}
fmt.Printf("balanceEcVolumes collections %+v\n", len(collections))
- return EcBalance(commandEnv, collections, *dc, *applyBalancing)
+ rp, err := parseReplicaPlacementArg(commandEnv, *shardReplicaPlacement)
+ if err != nil {
+ return err
+ }
+
+ return EcBalance(commandEnv, collections, *dc, rp, *applyBalancing)
}