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.04k stars 3.8k forks source link

Add `--num` flag and default preloaded data for `user_promo_codes` MovR table #39603

Closed ericharmeling closed 3 years ago

ericharmeling commented 5 years ago

All movr tables have a --num-[table] flag and default preloaded data, except for user_promo_codes.

--num-[table] flag

$ cockroach workload init movr --help
MovR is a fictional ride sharing company

Usage:
  cockroach demo movr [flags]

Flags:
      --concurrency int           Number of concurrent workers (default 16)
...
      --num-histories int         Initial number of ride location histories. (default 1000)
      --num-promo-codes int       Initial number of promo codes. (default 1000)
      --num-rides int             Initial number of rides. (default 500)
      --num-users int             Initial number of users. (default 50)
      --num-vehicles int          Initial number of vehicles. (default 15)
...

We just need to add

--num-user-promos int        Initial number of promo codes in use. (default 5)

or something similar.

Preloaded data

$ cockroach demo movr
> SELECT * FROM users;
                   id                  |     city      |        name         |            address             | credit_card
+--------------------------------------+---------------+---------------------+--------------------------------+-------------+
  c28f5c28-f5c2-4000-8000-000000000026 | amsterdam     | Maria Weber         | 14729 Karen Radial             | 5844236997
...
  3d70a3d7-0a3d-4000-8000-00000000000c | washington dc | Michael Brown       | 10742 Perkins Forks            | 9780468564
(50 rows)
> SELECT * FROM user_promo_codes;
  city | user_id | code | timestamp | usage_count
+------+---------+------+-----------+-------------+
(0 rows)

We just need a few users assigned to existing promo codes...

    city   |               user_id                |         code          | timestamp | usage_count
+----------+--------------------------------------+-----------------------+-----------+-------------+
  boston   | 19999999-9999-4a00-8000-000000000005 | a_blue_member         | NULL      |        NULL
  new york | 00000000-0000-4000-8000-000000000000 | a_down_man            | NULL      |        NULL
  rome     | f0a3d70a-3d70-4000-8000-00000000002f | ability_until_student | NULL      |        NULL
(3 rows)

or something similar

ericharmeling commented 5 years ago

@danhhz I know you worked on this, but I'm not sure who to assign...

danhhz commented 5 years ago

I handed off the maintenance to @nstewart, the original author of movr. Word is that maybe @johnrk may be taking it over?

nstewart commented 5 years ago

Eric -- you or @johnrk may need to try it. I definitely won't have the bandwidth to do this any time soon. I'm also not familiar with Go, so I'm owning this in spirit only

ericharmeling commented 5 years ago

Sounds good!

danhhz commented 5 years ago

@ericharmeling or @johnrk this is actually a pretty perfect intro change for workload movr, should be straightforward. I'm happy to walk either of you through it. We should probably figure out who wants to own workload movr long-term and use it as a starter project for them.