From bb0cad459e8429b857092f257a425f359d5d78d8 Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Wed, 16 Jul 2025 11:09:54 +0300 Subject: [PATCH] sim: ignore fsync faults `FaultyQuery` causes frequent false positives in simulator due to the following chain of events: - we write rows and flush wal to disk - inject fault during fsync which fails - error is returned to caller, simulator thinks those rows dont exist because the query failed - we reopen the database i.e. read the WAL back to memory from disk, it has those extra rows we think we didn't write - assertion fails because table has more rows than simulator expected More discussion about fsync behavior in issue #2091 --- simulator/runner/file.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/simulator/runner/file.rs b/simulator/runner/file.rs index fbd80ea88..83fbbbdd7 100644 --- a/simulator/runner/file.rs +++ b/simulator/runner/file.rs @@ -177,11 +177,8 @@ impl File for SimulatorFile { fn sync(&self, mut c: turso_core::Completion) -> Result> { self.nr_sync_calls.set(self.nr_sync_calls.get() + 1); if self.fault.get() { - tracing::debug!("sync fault"); - self.nr_sync_faults.set(self.nr_sync_faults.get() + 1); - return Err(turso_core::LimboError::InternalError( - FAULT_ERROR_MSG.into(), - )); + tracing::debug!("ignoring sync fault because it causes false positives with current simulator design"); + self.fault.set(false); } if let Some(latency) = self.generate_latency_duration() { let CompletionType::Sync(sync_completion) = &mut c.completion_type else {