cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.2k stars 3.82k forks source link

cli/sql: add run rand to cockroach demo and cockroach workload #46562

Closed awoods187 closed 2 years ago

awoods187 commented 4 years ago

Cockroach Demo nor Cockroach Workload can take advantage of the random data generator present in workload workload run rand --table <their table> --db <their db>.

For example:

andrewwoods@MacBook-Pro-3:~/go/src/github.com/cockroachdb/cockroach$ ./cockroach workload run --help
[experimental] run a workload's operations against a cluster

Usage:
  cockroach workload run [flags]
  cockroach workload run [command]

Available Commands:
  bank        [experimental] Bank models a set of accounts with currency balances
  kv          [experimental] KV reads and writes to keys spread randomly across the cluster.
  movr        [experimental] MovR is a fictional vehicle sharing company
  tpcc        [experimental] TPC-C simulates a transaction processing workload using a rich schema of multiple tables
  ycsb        [experimental] YCSB is the Yahoo! Cloud Serving Benchmark

Flags:
  -h, --help   help for run

Global Flags:
      --logtostderr Severity[=DEFAULT]   logs at or above this threshold go to stderr (default NONE)
      --no-color                         disable standard error log colorization
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging (significantly hurts performance)

Use "cockroach workload run [command] --help" for more information about a command.

We should add these capabilities to both demo and cockroach workload. Related to https://github.com/cockroachdb/cockroach/issues/44713

Jira issue: CRDB-5079

rohany commented 4 years ago

It might be interesting to hook this up as a command in demo --

root@127.0.0.1:52629/movr> \rand_fill_table <tablename> <num_rows>
awoods187 commented 4 years ago

Yeah i like that idea a lot. My ideal workflow would look something like:

  1. start demo
  2. create a table
  3. call a function that adds random data to the table using its schema
  4. run queries/profit
rohany commented 4 years ago

Yeah, thats what I had in mind. I don't think adding workload rand run to demo would be useful, because you don't actually have tables to populate when starting the demo command with workload run.

knz commented 4 years ago

ok that's for 20.2 right?

awoods187 commented 4 years ago

yeah i think so unless its trivially easy and super low risk.

rohany commented 4 years ago

Adding the demo command seems easy/low risk to me -- i'll put up a PR and see what people think.