Commit Graph

7 Commits

Author SHA1 Message Date
Benny Halevy
fef3342a34 test: random_schema::make_ckeys: fix inifinte loop
Allow returning fewer random clustering keys than requested since
the schema may limit the total number we can generate, for example,
if there is only one boolean clustering column.

Fixes #5161

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-10-15 08:52:39 +03:00
Botond Dénes
057f9aa655 random_schema: add ttl and expiry support
When generating data, the user can now also generate ttls and
expiry for all generated atoms. This happens in a controlled way, via a
generator functor, very similar to how the timestamps are generated.
This functor is also used by `random_schema` to generate `deletion_time`
for all tombstones, so the user now has full control of when all of the
atoms can be GC'd.
2019-07-15 17:38:00 +03:00
Botond Dénes
b26fe76fc1 tests: random_schema: futurize generate_random_mutations()
To avoid reactor stalls when generate many and/or large partitions.
2019-07-15 17:38:00 +03:00
Botond Dénes
cf135c6257 tests/random_schema: generate_random_mutations(): allow customizing generated data
Allow callers to specify the number of partitions generated, as well as
the number of clustering rows and range tombstones generated per
partition.
2019-07-15 17:38:00 +03:00
Botond Dénes
d90ac6bd7b tests/random_schema: generate_random_mutations(): remove engine parameter
Use an internally create instance of random engine. Passing a readily
seeded engine from the outside is pointless now that we have a mechanism
to seed entire test suites with a command line algorithm: the internal
engine is seeded from tests::random, so the seed of the test suite
determines the internal seed as well.

Update the sole user of this method (mutation_writer_test.cc) to not
generate local seeds anymore.
2019-07-15 17:38:00 +03:00
Botond Dénes
fd2f53f292 tests: mutation_writer_test.cc/generate_mutations() -> random_schema.hh/generate_random_mutations()
We plan on allowing other tests to use this method. The first step is to
make it available in a header.
2019-07-15 17:38:00 +03:00
Botond Dénes
d00cb4916c tests: introduce random_schema
random_schema is a utility class that provides methods for generating
random schemas as well as generating data (mutations) for them. The aim
is to make using random schemas in tests as simple and convenient as
is using `simple_schema`. For this reason the interface of
`random_schema` follows closely that of `simple_schema` to the extent
that it makes sense. An important difference is that `random_schema`
relies on `data_model` to actually build mutations. So all its
mutation-related operations work with `data_model::mutation_descrition`
instead of actual `mutation` objects. Once the user arrived at the
desired mutation description they can generate an actual mutation via
`data_model::mutation_description::build()`.

In addition to the `random_schema` class, the `random_schema.hh` header
exposes the generic utility classes for generating types and values
that it internally uses.

random_schema is fully deterministic. Using the same seed and the same
set of operations is guaranteed to result in generating the same schema
and data.
2019-06-25 12:01:33 +03:00