-
Notifications
You must be signed in to change notification settings - Fork 742
Closed
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.
Description
Enhancement Task
root@serverless-cluster-pd-0:/# ./pd-ctl keyspace-group split help
Usage:
pd-ctl keyspace-group split <keyspace_group_id> <new_keyspace_group_id> [<keyspace_id>] [flags]
// SplitKeyspaceGroupByIDParams defines the params for splitting a keyspace group.
type SplitKeyspaceGroupByIDParams struct {
NewID uint32 `json:"new-id"`
Keyspaces []uint32 `json:"keyspaces"`
// StartKeyspaceID and EndKeyspaceID are used to indicate the range of keyspaces to be split.
StartKeyspaceID uint32 `json:"start-keyspace-id"`
EndKeyspaceID uint32 `json:"end-keyspace-id"`
}
func splitKeyspaceGroupCommandFunc(cmd *cobra.Command, args []string) {
if len(args) < 3 {
cmd.Usage()
return
}
_, err := strconv.ParseUint(args[0], 10, 32)
if err != nil {
cmd.Printf("Failed to parse the old keyspace group ID: %s\n", err)
return
}
newID, err := strconv.ParseUint(args[1], 10, 32)
if err != nil {
cmd.Printf("Failed to parse the new keyspace group ID: %s\n", err)
return
}
keyspaces := make([]uint32, 0, len(args)-2)
for _, arg := range args[2:] {
id, err := strconv.ParseUint(arg, 10, 32)
if err != nil {
cmd.Printf("Failed to parse the keyspace ID: %s\n", err)
return
}
keyspaces = append(keyspaces, uint32(id))
}
postJSON(cmd, fmt.Sprintf("%s/%s/split", keyspaceGroupsPrefix, args[0]), map[string]interface{}{
"new-id": uint32(newID),
"keyspaces": keyspaces,
})
Metadata
Metadata
Assignees
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.