Skip to content

Add planned-reparent command to pscale branch vtctld#1240

Merged
nickvanw merged 3 commits intomainfrom
nick/planned-reparent-shard
Mar 31, 2026
Merged

Add planned-reparent command to pscale branch vtctld#1240
nickvanw merged 3 commits intomainfrom
nick/planned-reparent-shard

Conversation

@nickvanw
Copy link
Copy Markdown
Contributor

@nickvanw nickvanw commented Mar 31, 2026

Summary

Adds pscale branch vtctld planned-reparent with create and get subcommands for executing and monitoring PlannedReparentShard operations.

  • create initiates the operation and waits for completion by default (use --wait=false to return the operation ID immediately)
  • get retrieves the current status of an operation by ID
pscale branch vtctld planned-reparent create <db> <branch> \
  --keyspace <ks> --shard <shard> --new-primary <tablet-alias>

pscale branch vtctld planned-reparent get <db> <branch> <operation-id>

Adds `pscale branch vtctld planned-reparent` with two subcommands:

- `create` — initiates a planned reparent shard operation, waits for
  completion by default (--wait=false to return immediately)
- `get` — polls the status of an existing operation

Usage:
  pscale branch vtctld planned-reparent create <db> <branch> \
    --keyspace <ks> --shard <shard> --new-primary <alias>

Updates planetscale-go to v0.159.0 for PlannedReparentShardService.
@nickvanw nickvanw requested a review from a team as a code owner March 31, 2026 12:21
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Instead of create/get subcommands, use a single command with two modes:

  # Execute a planned reparent
  pscale branch vtctld planned-reparent-shard <db> <branch> \
    --keyspace <ks> --shard <shard> --new-primary <alias>

  # Check on an existing operation
  pscale branch vtctld planned-reparent-shard <db> <branch> --id <op-id>

This matches how Vitess exposes PlannedReparentShard as a single action
rather than a CRUD resource.
The root command runs the reparent (all flags required, no ambiguity):
  pscale branch vtctld planned-reparent-shard <db> <branch> \
    --keyspace <ks> --shard <shard> --new-primary <alias>

A status subcommand checks on an existing operation:
  pscale branch vtctld planned-reparent-shard status <db> <branch> <op-id>
@nickvanw nickvanw merged commit 18f16ca into main Mar 31, 2026
4 checks passed
@nickvanw nickvanw deleted the nick/planned-reparent-shard branch March 31, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants