Skip to content
rustfsPublic

About

Deterministic Simulation Testing (DST) framework, runtime abstraction traits, virtual simulators, and correctness verification suite for RustFS.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

RustFS DST — Deterministic Simulation Testing

License

RustFS DST is the official Deterministic Simulation Testing (DST) framework, runtime trait abstraction layer, virtual fault simulator, and multi-seed correctness verifier for RustFS.

Inspired by FoundationDB's Flow simulator, Tokio turmoil, madsim, and Antithesis, RustFS DST uses runtime traits to run a storage model against seeded faults. The scenarios execute SimECStore or the Turmoil quorum model. The upstream adoption plan describes how to apply these runtime traits to RustFS itself.

Core Architecture

                     ┌──────────────────────────────────────────────┐
                     │       RustFS Storage Engine Subsystems       │
                     │  (ECStore · Distributed Lock · Heal · GC)    │
                     └──────────────────────┬───────────────────────┘
                                            │
                            Unified Determinism Traits
                              (`rustfs-dst-runtime`)
       ┌────────────────────┬───────────────┴──────────────┬────────────────────┐
       ▼                    ▼                              ▼                    ▼
  trait Clock         trait RngSource                trait Network         trait DiskIo
  ├─ RealClock        ├─ RealRng                     ├─ SimNetwork         ├─ RealDiskIo
  └─ SimClock         └─ SimRng (ChaCha8 + fork)     │   (Swizzle-Clog,    └─ SimDiskIo
     (skew, drift,                                   │    asymmetric cuts,    (volatile vs
      virtual time)                                  │    reply drops)         durable fsync,
                                                     └─ turmoil::net           power loss,
                                                        (virtual TCP)          bitrot, ENOSPC)

Workspace Crates

Crate Purpose
rustfs-dst-runtime Unified traits (Clock, RngSource, Network, DiskIo, RuntimeEnv) with production, in-memory deterministic simulator, Tokio turmoil virtual TCP adapter, and madsim compatibility layer.
rustfs-dst-faults Two-stage deterministic Buggify injector, CodeProbe coverage tracker with Antithesis-compatible JSONL assertion emission, RustFS commit CrashPoint registry, and SwizzleClogScheduler.
rustfs-dst-sim Simulated RustFS distributed erasure-coded storage engine (SimECStore) with GF(2^8) Cauchy Reed-Solomon, xl.meta atomic two-phase commit, quorum locking, online healing, real turmoil TCP cluster tests, and a 6-invariant ConsistencyOracle.
rustfs-dst-cli Joshua-style parallel multi-seed runner (rustfs-dst run), single-seed bit-exact reproducer (rustfs-dst repro), and determinism prover (rustfs-dst verify-determinism).

Verified Invariants

  1. Sequential S3 Read-After-Write Consistency: GET responses must match a possible current version after acknowledged or indeterminate writes and deletes. LIST is checked against acknowledged live keys and their version metadata before repair.
  2. Bit-Exact Data Integrity: Every readable object matches the exact SHA-256 of an acknowledged or indeterminate write for that version. Silent bitrot up to the parity limit is detected and reconstructed transparently.
  3. Crash Atomicity (Old-or-New-Never-Mixed): Abrupt power loss (SimDiskIo::crash_and_reboot) at any RustFS xl.meta commit window drops un-fsynced page-cache state without corrupting previously committed versions.
  4. Quorum Safety: Writes fail closed on minority partitions and roll back partial drive writes cleanly; reply drops after remote apply are modeled as indeterminate outcomes.
  5. Distributed Lock Mutual Exclusion & Monotonic Fencing: Monotonic-clock quorum leases remain immune to wall-clock skew jumps and issue strictly increasing fencing epochs.
  6. Heal Convergence & Zero Orphan Leaks: Post-heal, every drive in 4x4 (16 drives, EC:4), 3x2 (6 drives, EC:3), and 4x2 (8 drives, EC:4) converges to the identical generation with zero leaked .rustfs.sys/tmp/ artifacts.

Quickstart

# Run the full unit and integration test suite
cargo test --workspace

# Compare two passing reports for every scenario
cargo run --release -p rustfs-dst-cli -- verify-determinism --topology 4x4 --seed 2026

# Run a 100-seed parallel DST campaign on 4x4 and 3x2 topologies
cargo run --release -p rustfs-dst-cli -- run --scenario all --topology 4x4 --seeds 100
cargo run --release -p rustfs-dst-cli -- run --scenario all --topology 3x2 --seeds 100

# Replay a single failing seed deterministically
cargo run --release -p rustfs-dst-cli -- repro --scenario swizzle-clog-chaos --topology 4x4 --seed 42

Supported Topologies

Topology Nodes × Drives Total Drives Parity (m) Data (k) Read Quorum (R) Write Quorum (W)
4x4 4 × 4 16 4 12 12 12
3x2 3 × 2 6 3 3 3 4
4x2 4 × 2 8 4 4 4 5

Documentation

License

Licensed under the Apache License, Version 2.0.

About

Deterministic Simulation Testing (DST) framework, runtime abstraction traits, virtual simulators, and correctness verification suite for RustFS.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages