When a stress thread runs out of work, execute COMMIT and ignore
the result.
This prevents the currently extremely common scenario where:
- Thread x does BEGIN
- Thread x does e.g. INSERT ...
Then runs out of iterations and stops. No other threads can write
anything and they just wait for 5 seconds (busy timeout) and then
try again, forever.
Add `--busy-timeout` command-line option to turso-stress with a default
value of 5000 ms. This helps prevent spurious database busy errors
during concurrent stress testing and ensure that integrity checks are
not skipped because of concurrent writes.
Commit eeab6d5ce ("stress: Retry sync on error to avoid a panic") only
enabled sync retry in the schema creation path. Let's add it to the
stress test loop too.
Spotted during Antithesis runs.
We now panic on fsync error by default to be safe against fsyncgate.
However, no reason to do that in the stress tester, especially since we
test out of disk space errors under Antithesis.
Nikita noticed that database reopen and reconnet cause most database
operations to return "database locked", which means we're not getting
the coverage we need.
This adds a `turso_assert` macro that is Antithesis aware when
`antithesis` feature flag is enabled. I did not yet convert any
call-sites to use it.
Co-authored-by: Nikita Sivukhin <sivukhin@turso.tech>
Stress runs have bunch of errors like this caused by reconnect in the
middle of a transaction:
```
Error executing query: Transaction error: cannot rollback - no transaction is active
```
This is fine, but let's add some logging that it's obvious why this
happens.
Makes it easier to test the feature:
```
$ cargo run -- --experimental-indexes
Limbo v0.0.22
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
limbo> CREATE TABLE t(x);
limbo> CREATE INDEX t_idx ON t(x);
limbo> DROP INDEX t_idx;
```
Add simple stress test run with 10k iteration to test `Delete`, `Update`
and `Insert` together.
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Closes#1585