From cc643362a4fbf175fbf3f153dc655a8b98b9e75a Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Fri, 22 Aug 2025 10:13:06 +0300 Subject: [PATCH] sim: remove "run_once faults" This kind of fault does not semantically represent anything real, since we already have fault injection for every concrete IO operation like reading, writing, syncing and so forth. Moreover, having this feature is the direct cause of the false positive simulator failure as reported in issue #2727. There, a "run_once fault" happened immediately after we fsynced following an INSERT, which caused the simulator to think the INSERT failed, and later a sim assertion failed because the on-disk database had 1 more row than it thought it would. --- simulator/runner/io.rs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/simulator/runner/io.rs b/simulator/runner/io.rs index ea8c606f4..c6b6bdbc3 100644 --- a/simulator/runner/io.rs +++ b/simulator/runner/io.rs @@ -7,17 +7,13 @@ use rand::{RngCore, SeedableRng}; use rand_chacha::ChaCha8Rng; use turso_core::{Clock, Instant, OpenFlags, PlatformIO, Result, IO}; -use crate::{ - model::FAULT_ERROR_MSG, - runner::{clock::SimulatorClock, file::SimulatorFile}, -}; +use crate::runner::{clock::SimulatorClock, file::SimulatorFile}; pub(crate) struct SimulatorIO { pub(crate) inner: Box, pub(crate) fault: Cell, pub(crate) files: RefCell>>, pub(crate) rng: RefCell, - pub(crate) nr_run_once_faults: Cell, pub(crate) page_size: usize, seed: u64, latency_probability: usize, @@ -39,7 +35,6 @@ impl SimulatorIO { let fault = Cell::new(false); let files = RefCell::new(Vec::new()); let rng = RefCell::new(ChaCha8Rng::seed_from_u64(seed)); - let nr_run_once_faults = Cell::new(0); let clock = SimulatorClock::new(ChaCha8Rng::seed_from_u64(seed), min_tick, max_tick); Ok(Self { @@ -47,7 +42,6 @@ impl SimulatorIO { fault, files, rng, - nr_run_once_faults, page_size, seed, latency_probability, @@ -63,7 +57,6 @@ impl SimulatorIO { } pub(crate) fn print_stats(&self) { - tracing::info!("run_once faults: {}", self.nr_run_once_faults.get()); for file in self.files.borrow().iter() { tracing::info!( "\n===========================\n\nPath: {}\n{}", @@ -115,13 +108,6 @@ impl IO for SimulatorIO { } fn run_once(&self) -> Result<()> { - if self.fault.get() { - self.nr_run_once_faults - .replace(self.nr_run_once_faults.get() + 1); - return Err(turso_core::LimboError::InternalError( - FAULT_ERROR_MSG.into(), - )); - } let now = self.now(); for file in self.files.borrow().iter() { file.run_queued_io(now)?;