Skip to content

Add vtctld set-shard-tablet-control command#1268

Draft
maxenglander wants to merge 4 commits into
maxeng/issues-gh-1753/get-shardfrom
maxeng/issues-gh-1753/set-shard-tablet-control
Draft

Add vtctld set-shard-tablet-control command#1268
maxenglander wants to merge 4 commits into
maxeng/issues-gh-1753/get-shardfrom
maxeng/issues-gh-1753/set-shard-tablet-control

Conversation

@maxenglander

@maxenglander maxenglander commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Adds a hidden vtctld command to update shard tablet controls on the cluster:

pscale branch vtctld set-shard-tablet-control <database> <branch> \
  --keyspace <keyspace> --shard <shard> --tablet-type rdonly \
  --denied-tables <table>

Requires at least one of --remove, --denied-tables, or --disable-query-service.

Depends on planetscale/planetscale-go#315.

Manual testing

Tested end-to-end against a dev Vitess branch (org with direct_vtctld_access enabled) with the full stack deployed.

  1. Baseline get-shard on unsharded keyspace test-vtctld/- returned empty tablet_controls.
  2. Added denied table:
    pscale branch vtctld set-shard-tablet-control <database> <branch> \
      --keyspace test-vtctld --shard - --tablet-type rdonly --denied-tables customers
    
    returned {}. Re-ran get-shard and confirmed:
    {
      "tablet_controls": [
        {
          "tablet_type": 3,
          "cells": [],
          "denied_tables": ["customers"],
          "frozen": false
        }
      ]
    }
  3. Removed denied table:
    pscale branch vtctld set-shard-tablet-control <database> <branch> \
      --keyspace test-vtctld --shard - --tablet-type rdonly \
      --remove --denied-tables customers
    
    get-shard then showed empty tablet_controls again.
  4. CLI validation: omitting all mutation flags returns must specify at least one of --remove, --denied-tables, or --disable-query-service.
  5. Repeated add/remove on sharded keyspace sharded-2/-80 with --denied-tables orders — same behavior.

Comment thread internal/cmd/branch/vtctld/set_shard_tablet_control.go
@maxenglander maxenglander force-pushed the maxeng/issues-gh-1753/get-shard branch from c523aef to baa7d16 Compare June 7, 2026 04:23
@maxenglander maxenglander force-pushed the maxeng/issues-gh-1753/set-shard-tablet-control branch from 46fc1f8 to 56e07e2 Compare June 7, 2026 04:23
@maxenglander maxenglander force-pushed the maxeng/issues-gh-1753/get-shard branch from baa7d16 to 35ab8e7 Compare June 7, 2026 04:26
@maxenglander maxenglander force-pushed the maxeng/issues-gh-1753/set-shard-tablet-control branch from 56e07e2 to 6f69901 Compare June 7, 2026 04:26

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Reviewed by Cursor Bugbot for commit 27c1ed7. Configure here.


client, err := ch.Client()
if err != nil {
return err

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing mutation flag validation

Medium Severity

The command reads remove and disable-query-service via Flags().Changed but never requires at least one of --remove, --denied-tables, or --disable-query-service before calling the API. The PR describes that check and manual “CLI validation,” yet no matching fmt.Errorf exists in this repo (unlike deployrequest edit).

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 27c1ed7. Configure here.

maxenglander and others added 3 commits June 9, 2026 18:49
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Max Englander <max@planetscale.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Max Englander <max@planetscale.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Max Englander <max@planetscale.com>
@maxenglander maxenglander force-pushed the maxeng/issues-gh-1753/get-shard branch from 35ab8e7 to d76a790 Compare June 10, 2026 02:13
@maxenglander maxenglander force-pushed the maxeng/issues-gh-1753/set-shard-tablet-control branch from 27c1ed7 to fc3b72f Compare June 10, 2026 02:13
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Max Englander <max@planetscale.com>
@maxenglander maxenglander force-pushed the maxeng/issues-gh-1753/get-shard branch from 3a7e5c9 to 4c2996a Compare June 12, 2026 03:12
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.

1 participant