pub fn key(key_size: ByteSize, sequence: u64) -> Option<Bytes>Expand description
Builds a record key of exactly key_size bytes, distinct per sequence.
A scenario that sets key_size asks for a keyed workload, and a keyed
workload is not a keyless one: the partitioner hashes the key instead of
round-robining, and the key adds its own bytes to the wire. The key has to
vary, or every record hashes to one partition and the run measures a single
partition rather than the scenario’s partition count.
The first eight bytes are the big-endian sequence, so keys are distinct and
spread. The rest is the same repeating ramp the value filler uses, so a
compressed batch is not dominated by a run of zeros. A key_size below
eight bytes is honoured as given and takes a prefix of the sequence.