Skip to content

Add keyspace storage settings to keyspace settings commands - #1431

Open
inelpandzic wants to merge 1 commit into
mainfrom
inel/disk-autoscale-settings-improvement
Open

inelpandzic wants to merge 1 commit into
mainfrom
inel/disk-autoscale-settings-improvement

Conversation

@inelpandzic

Copy link
Copy Markdown
Contributor

Adds the keyspace storage object from planetscale/api-bb#22099 to pscale keyspace settings and pscale keyspace update-settings.

  • --disk-scaling-strategygrow, disable, or shrink
  • --max-storage — max size in bytes disks may autoscale to
  • --storage — size in bytes to recreate disks at; only with shrink, must be a whole GiB

Only the flags that are passed are sent, matching the existing update-settings pattern.

# Autoscale up to 4 TiB
pscale keyspace update-settings <database> <branch> <keyspace> --org <org> \
  --disk-scaling-strategy grow --max-storage 4398046511104

# Shrink disks to 200 GiB and disable autoscaling
pscale keyspace update-settings <database> <branch> <keyspace> --org <org> \
  --disk-scaling-strategy shrink --storage 214748364800

keyspace settings output gains disk scaling strategy, storage, and max storage columns:

$ pscale keyspace settings <database> <branch> <keyspace> --org <org>
  ...   THROTTLER ENABLED   THROTTLER THRESHOLD   DISK SCALING STRATEGY   STORAGE   MAX STORAGE
  ...   Yes                 5s                    grow                    100 GiB   4.0 TiB

JSON output carries the raw API object:

"storage": {
  "storage_bytes": 107374182400,
  "max_storage_bytes": 4398046511104,
  "disk_scaling_strategy": "grow"
}

Handles https://github.com/planetscale/issues/issues/2020

@inelpandzic
inelpandzic requested a review from a team as a code owner September 18, 2026 09:15
// The API only recreates disks at a new size when shrinking, so
// the strategy has to be part of the same request.
if !strategyChanged || flags.diskScalingStrategy != shrinkStrategy {
return fmt.Errorf("--storage can only be set when --disk-scaling-strategy is %s", shrinkStrategy)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What if they previously shrank a disk? In that case the API has already stored shrink scaling strategy. Seems like they ought to be able to just update the storage. Would it simplify things if we didn't do this validation in the CLI and just relied on the API.

This branch has not been deployed

No deployments
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.

3 participants