Skip to content

feat(testbedctl): add gc-regions and purge commands - #3

Merged
sunng87 merged 1 commit into
mainfrom
feat/testbedctl-gc-regions-purge
Jul 24, 2026
Merged

feat(testbedctl): add gc-regions and purge commands#3
sunng87 merged 1 commit into
mainfrom
feat/testbedctl-gc-regions-purge

Conversation

@sunng87

@sunng87 sunng87 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

Adds two more testbedctl admin commands alongside the existing flush/compact/gc, both running against the client PostgreSQL port (11043), so they work identically in distributed (haproxy), standalone, standalone-fs, and active/standby modes.

gc-regions — region-scoped GC

./testbedctl gc-regions 4398046511106                         # admin gc_regions(4398046511106)
./testbedctl gc-regions 4398046511106 4398046511117 --full     # admin gc_regions(4398046511106, 4398046511117, true)

Mirrors the table-level gc command but targets specific region IDs (u64 values, e.g. from greptimedb logs). --full/-f forces a full object-storage file listing. Region IDs must be numeric (rejected otherwise).

purge — permanently purge a dropped table

./testbedctl purge my_table        # prompts: y/N
./testbedctl purge my_table -y     # admin purge_table('my_table'), no prompt

Runs admin purge_table(...), which permanently removes a dropped table's data (irreversible). Prompts for confirmation by default; -y/--yes skips it for scripting.

Notes

  • Like flush/compact/gc, these route through the frontend to the metasrv leader (check_leader). gc-regions/purge are synchronous within the GC/procedure mailbox_timeout (default 60s).
  • Documented in AGENTS.md and README.md.

Verification

  • bash -n testbedctl passes.
  • All arg forms produce the expected SQL (verified with a stub psql): region IDs joined as numbers, --full appends the trailing boolean.
  • purge confirmation flow: n aborts (exit 1), y proceeds; -y bypasses; no-arg prints usage.
  • gc-regions rejects non-numeric IDs and prints usage with no args.
  • testbedctl help and both docs show the new commands.

- `testbedctl gc-regions <id>... [--full]` runs `admin gc_regions(...)`,
  mirroring the table-level `gc` command but for specific region IDs (u64,
  e.g. from greptimedb logs). --full/-f forces a full object-storage file
  listing. Region IDs must be numeric.
- `testbedctl purge <table> [-y]` runs `admin purge_table(...)`, permanently
  purging a DROPPED table's data. It prompts for confirmation by default
  (irreversible); -y/--yes skips it.

Both are documented in AGENTS.md and README.md alongside flush/compact/gc.
@sunng87
sunng87 merged commit 8e54cb5 into main Jul 24, 2026
4 checks passed
@sunng87
sunng87 deleted the feat/testbedctl-gc-regions-purge branch July 24, 2026 08:58
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