Skip to content

workload: add --list-dbs flag to workload_generator#163930

Merged
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
nameisbhaskar:workgen_add_list_db
Feb 24, 2026
Merged

workload: add --list-dbs flag to workload_generator#163930
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
nameisbhaskar:workgen_add_list_db

Conversation

@nameisbhaskar
Copy link
Contributor

Before this change, users needed to manually inspect debug logs to determine which databases were available before running workload init workload_generator. This required opening the debug zip and examining the crdb_internal.create_statements.txt file.

This commit adds a --list-dbs flag that scans the debug logs and prints all user databases (excluding system databases: system, postgres, defaultdb, and NULL entries). The flag exits immediately after printing to prevent duplicate output from multiple PreCreate hook invocations.

This commit also adds a comprehensive README.md for the workload_generator package that documents all features, flags, and usage patterns.

Example usage:
./cockroach workload init workload_generator
'postgresql://...'
--debug-logs=/path/to/debug/logs
--list-dbs

Release note (cli change): Added a --list-dbs flag to workload init workload_generator that lists all user databases found in debug logs without initializing tables. This helps users discover which databases are available in the debug zip before running the full init command.

Epic: None
Release Notes: None

@trunk-io
Copy link
Contributor

trunk-io bot commented Feb 19, 2026

😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nameisbhaskar nameisbhaskar force-pushed the workgen_add_list_db branch 5 times, most recently from 0844e7d to 1befa20 Compare February 19, 2026 15:28
@nameisbhaskar nameisbhaskar marked this pull request as ready for review February 19, 2026 16:23
@nameisbhaskar nameisbhaskar requested a review from a team as a code owner February 19, 2026 16:23
@nameisbhaskar nameisbhaskar requested review from golgeek, herkolategan, shailendra-patel and srosenberg and removed request for a team and golgeek February 19, 2026 16:23
Before this change, users needed to manually inspect debug logs to
determine which databases were available before running `workload init
workload_generator`. This required opening the debug zip and examining
the `crdb_internal.create_statements.txt` file.

This commit adds a `--list-dbs` flag that scans the debug logs and
prints all user databases (excluding system databases: system, postgres,
defaultdb, and NULL entries). The flag exits immediately after printing
to prevent duplicate output from multiple PreCreate hook invocations.

This commit also adds a comprehensive README.md for the workload_generator
package that documents all features, flags, and usage patterns.

Example usage:
  ./cockroach workload init workload_generator \
    'postgresql://...' \
    --debug-logs=/path/to/debug/logs \
    --list-dbs

Release note (cli change): Added a `--list-dbs` flag to `workload init
workload_generator` that lists all user databases found in debug logs
without initializing tables. This helps users discover which databases
are available in the debug zip before running the full init command.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@nameisbhaskar
Copy link
Contributor Author

Thanks @herkolategan for your review and approval!

@nameisbhaskar
Copy link
Contributor Author

/trunk merge

@trunk-io trunk-io bot merged commit 943f82f into cockroachdb:master Feb 24, 2026
24 checks passed
@nameisbhaskar nameisbhaskar deleted the workgen_add_list_db branch March 6, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants