So, I'm running some unit tests against some InnoDB tables in MySQL.
Each unit test is wrapped in a transaction:
SET autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; START TRANSACTION;
Each test does one or more queries: SELECT, INSERT, UPDATE etc.
The first time I run the tests, they all pass. But if I run them again immediately, I start getting failures. If I wait a while and then run the test a third time, the failures go away.
Any insights to what might be causing this and how I could prevent it?