Skip to content

Add vtctld get-routing-rules command#1266

Open
maxenglander wants to merge 3 commits into
mainfrom
maxeng/issues-gh-1753/get-routing-rules
Open

Add vtctld get-routing-rules command#1266
maxenglander wants to merge 3 commits into
mainfrom
maxeng/issues-gh-1753/get-routing-rules

Conversation

@maxenglander

@maxenglander maxenglander commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Adds a vtctld command to read live routing rules from the cluster:

pscale branch vtctld get-routing-rules <database> <branch>

This complements pscale branch routing-rules get, which reads from the schema snapshot.

Depends on planetscale/planetscale-go#313.

Manual testing

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

  1. Created a Vitess database and waited for the default branch to become ready.
  2. pscale branch vtctld get-routing-rules <database> <branch> returned {"rules":[]}.
  3. Created a second keyspace on that branch:
    pscale keyspace create <database> <branch> target-ks --cluster-size PS-10 --wait
    
  4. Created an identical customers table on both the default keyspace and target-ks.
  5. Applied routing rules so rdonly queries against customers on the default keyspace are served from target-ks:
    {
      "rules": [
        {"from_table": "customers@rdonly", "to_tables": ["target-ks.customers"]},
        {"from_table": "target-ks.customers", "to_tables": ["<default-keyspace>.customers"]},
        {"from_table": "customers", "to_tables": ["<default-keyspace>.customers"]}
      ]
    }
    pscale branch routing-rules update <database> <branch> --routing-rules routing-rules.json
    
  6. pscale branch vtctld get-routing-rules <database> <branch> returned:
    {
      "rules": [
        {
          "fromTable": "customers@rdonly",
          "toTables": ["target-ks.customers"]
        },
        {
          "fromTable": "target-ks.customers",
          "toTables": ["<default-keyspace>.customers"]
        },
        {
          "fromTable": "customers",
          "toTables": ["<default-keyspace>.customers"]
        }
      ]
    }

@maxenglander maxenglander force-pushed the maxeng/issues-gh-1753/get-routing-rules branch from 0fd6c2a to 2a8f6ee Compare June 7, 2026 04:23
maxenglander and others added 2 commits June 7, 2026 00:26
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-routing-rules branch from 2a8f6ee to a49d8f2 Compare June 7, 2026 04:26
Resolve planetscale-go dependency to include main ListTablets changes
alongside the GetRoutingRules client from the stacked branch.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Max Englander <max@planetscale.com>
@maxenglander maxenglander marked this pull request as ready for review June 10, 2026 19:39
@maxenglander maxenglander requested a review from a team as a code owner June 10, 2026 19:39
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