testing/stress: stop replaying the same RNG stream after reopens
Since 9e92d5040 ("exercise MVCC recovery in turso_stress") the stress
loop periodically tears down all threads and the database to exercise
recovery, then respawns the threads in a new batch. Each respawned
thread seeds its RNG with global_seed + thread_idx + iteration_idx *
1000, where iteration_idx was meant to distinguish batches but is
actually the thread's enumerate() position in the threads vector, so
it is identical in every batch. Every reopen batch therefore replayed
each thread's random stream from position zero: the same statements,
reconnects, savepoint patterns, and checkpoint modes over and over,
so long runs had far less behavioral diversity than their iteration
count suggests.
The skew was large enough to show up in small samples: with seed 3, a
uniform 3-way checkpoint mode pick produced 0 FULL, 79 RESTART, and
36 TRUNCATE picks across a 2x800-iteration run, and 232 distinct
generated DML statements appeared more than once purely from replay.
Count batches explicitly and mix that counter into the seed instead.
Antithesis builds are unaffected because AntithesisRng ignores the
seed; plain builds now reproduce different runs for a given --seed
than before this change. P
Pekka Enberg committed
21d2dafa59e0921d08fe5bda86fb693efc38faec
Parent: 069b543