mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
This is a simple version of https://github.com/tursodatabase/turso/pull/7489 I did a bunch of refactoring to make `main.rs` in turso-stress have less responsibilities and be easier to work with. Unfortunately the commit history isn't as nice as I would have wanted, so the diff may be a bit messy. Here's what's going on in this PR: * extracted logging to a `Tracer` type * extracted SQL logging (to a file) to a `SqlLogger` type * extracted progress bars to a `Progress` type * encapsulated post-statement SQL logging inside a `StressConn` type * encapsulated closing/reopening in a `StressDb` type * moved the ddl up so that it was performed only once (previously we performed the same DDL setup once per thread, which I think was a mistake). This was necessary because without this fix, threads with higher indexes barely got any attention, because by the time threads 0 or 1 requested a synchronization, they were still performing their initialization. * restored `turso_assert_reachable!` (it was a no-op), and added one invocation to MVCC recovery, so that we'll know if we ever have a regression and it's not exercised in Antithesis anymore. * changed how the loop is structured, so that all the DBs are dropped at the same time, thereby exercising MVCC recovery Handwritten. I used Claude to figure out bugs (I had a few deadlocks and starvation issues while coding this). Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com> Closes #7571