Skip to main content

minimize_faults

Function minimize_faults 

Source
pub fn minimize_faults<P, R>(
    num_faults: usize,
    is_paired: P,
    reproduce_with: R,
) -> MinimizedTrace
where P: Fn(usize) -> Option<usize>, R: Fn(&[usize]) -> bool,
Expand description

Minimize a fault schedule using delta debugging.

Tries removing faults one by one (with paired events like crash/restart handled together). Returns the indices of essential faults.

  • num_faults: total number of fault events in the original schedule.
  • is_paired: (idx) -> Option<usize> returns the paired event index (e.g., restart for a crash, heal for a partition).
  • reproduce_with: (&[usize]) -> bool takes a list of active fault indices and returns whether the failure reproduces.
use vortex_trace::minimize::minimize_faults;

// Example: 10 faults, only fault 3 is essential
let result = minimize_faults(
    10,
    |_| None,  // no paired events
    |active| active.contains(&3),  // only reproduces if fault 3 is active
);
assert!(result.essential_fault_indices.contains(&3));
assert!(result.minimized_faults <= 2); // fault 3 (+ maybe its pair)