diff --git a/fuzz/fuzz_targets/fuzz_redb.rs b/fuzz/fuzz_targets/fuzz_redb.rs index 5106205b..a52509da 100644 --- a/fuzz/fuzz_targets/fuzz_redb.rs +++ b/fuzz/fuzz_targets/fuzz_redb.rs @@ -494,7 +494,7 @@ fn exec_table_crash_support(config: &FuzzConfig, apply: fn(WriteTransa let mut non_durable_reference = reference.clone(); for (txn_id, transaction) in config.transactions.iter().enumerate() { - let result = handle_savepoints(db.begin_write().unwrap(), &mut non_durable_reference, transaction, &mut savepoint_manager); + let result = handle_savepoints(db.begin_write().unwrap(), &mut non_durable_reference, transaction, &mut savepoint_manager, countdown.clone()); match result { Ok(durable) => { if durable { @@ -613,7 +613,7 @@ fn run_compaction(db: &mut Database, savepoint_manager: &mut Savepoint } // Returns true if a durable commit was made -fn handle_savepoints(mut txn: WriteTransaction, reference: &mut BTreeMap, transaction: &FuzzTransaction, savepoints: &mut SavepointManager) -> Result { +fn handle_savepoints(mut txn: WriteTransaction, reference: &mut BTreeMap, transaction: &FuzzTransaction, savepoints: &mut SavepointManager, countdown: Arc) -> Result { if transaction.create_ephemeral_savepoint { savepoints.ephemeral_savepoint(&txn, &reference)?; } @@ -625,10 +625,18 @@ fn handle_savepoints(mut txn: WriteTransaction, reference: &mut BTreeM if let Some(ref restore_to) = transaction.restore_savepoint { savepoints.restore_savepoint(restore_to.value, &mut txn, reference)?; } + // Disable simulated IO failures. It's tricky to handle commit failures here in the fuzzer, + // and it doesn't add value since we already fuzz failures on the main transaction path + let old_countdown = countdown.swap(u64::MAX, Ordering::SeqCst); txn.commit()?; + countdown.store(old_countdown, Ordering::SeqCst); Ok(true) } else { + // Disable simulated IO failures. It's tricky to handle commit failures here in the fuzzer, + // and it doesn't add value since we already fuzz failures on the main transaction path + let old_countdown = countdown.swap(u64::MAX, Ordering::SeqCst); txn.abort()?; + countdown.store(old_countdown, Ordering::SeqCst); Ok(false) }