RustFS DST is the Deterministic Simulation Testing (DST) framework, runtime trait abstraction layer, virtual fault simulator, and multi-seed correctness verifier for RustFS.
Current Verification Scope: This repository currently verifies standalone behavioral models (
SimECStore,QuorumLockClient, Turmoil virtual-TCP quorum cluster, and enterprise/scanner domain simulators) built overrustfs-dst-runtime. It does not yet link or compile upstreamrustfs/rustfsproduction crates directly. See the upstream adoption blueprint for the phased plan to wirerustfs-dst-runtimetraits intorustfs/rustfs.
Inspired by FoundationDB's Flow simulator, Tokio turmoil, madsim, and Antithesis, RustFS DST isolates time, randomness, network transport, and crash-consistent disk I/O behind deterministic traits so multi-node fault schedules replay bit-for-bit from a single 64-bit seed.
┌──────────────────────────────────────────────┐
│ Simulated RustFS Storage Subsystems │
│ (SimECStore · QuorumLock · Heal · Scanner) │
└──────────────────────┬───────────────────────┘
│
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
drift-scaled │ opaque reply loss) durable fsync,
sleep) └─ turmoil::net strict parent dir
(virtual TCP) fsync, power loss,
torn writes, bitrot,
ENOSPC)
| Crate | Purpose |
|---|---|
rustfs-dst-runtime |
Unified traits (Clock, RngSource, Network, DiskIo, RuntimeEnv) with production implementations, deterministic in-memory simulators (SimClock, SimRng, SimNetwork, SimDiskIo with both clean un-fsynced drop and ALICE/CrashMonkey 4 KiB dirty-subset & 512 B sector-tear power-loss modes), Tokio turmoil virtual TCP adapter, and a compile-time madsim cfg hook. |
rustfs-dst-faults |
Two-stage deterministic Buggify injector, zero-cost declarative macros (dst_buggify!, dst_assert_always!, dst_assert_sometimes!, dst_assert_reachable!, dst_assert_unreachable!), CodeProbe coverage tracker (ProbeRegistry) with live unhit_must_hit() gating and Antithesis-compatible JSONL output, drive-targeted CrashPoint registry, and SwizzleClogScheduler. |
rustfs-dst-sim |
Standalone behavioral models of RustFS distributed erasure-coded storage (SimECStore) with GF(2^8) Cauchy Reed-Solomon, xl.meta atomic two-phase commit, crash-safe quorum locking with storage-node fencing, online healing, Turmoil TCP quorum tests, 52 scenarios, and a 6-invariant ConsistencyOracle. |
rustfs-dst-cli |
Parallel multi-seed runner (rustfs-dst run), single-seed bit-exact reproducer (rustfs-dst repro), and determinism prover (rustfs-dst verify-determinism). |
- Linearizable S3 Read-After-Write Consistency: GET responses must match a possible current version across concurrent and sequential acknowledged/indeterminate mutations. LIST is verified against acknowledged live keys and version metadata before repair.
- 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.
- Crash Atomicity (Old-or-New-Never-Mixed): Abrupt power loss (
SimDiskIo::crash_and_reboot) at anyxl.metacommit window drops un-fsynced file data and un-fsynced directory entries (including un-fsynced ancestor directories) without corrupting committed versions. - Quorum Safety & Opaque Reply Loss: Writes fail closed below quorum and roll back partial drive writes; post-dispatch reply loss returns an opaque
NetError::ReplyLosttreated conservatively as indeterminate. - Distributed Lock Mutual Exclusion & Monotonic Fencing: Monotonic-clock quorum leases remain immune to wall-clock skew jumps, use Gray & Cheriton crash-recovery grace windows with durable epoch persistence, issue strictly increasing fencing tokens across sequential and overlapping acquisitions, and reject stale fence tokens at storage nodes.
- Heal Convergence & Zero Orphan Leaks: Post-heal, every drive in
4x4(16 drives, EC:4),3x2(6 drives, EC:3), and4x2(8 drives, EC:4) converges to the identical(generation, version_id)with zero leaked.rustfs.sys/tmp/artifacts.
# Format, lint, and run the full unit & integration test suite
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
# Compare two passing reports for every scenario across all 3 topologies
cargo run --release -p rustfs-dst-cli -- verify-determinism --topology 4x4 --seed 2026
cargo run --release -p rustfs-dst-cli -- verify-determinism --topology 3x2 --seed 2026
cargo run --release -p rustfs-dst-cli -- verify-determinism --topology 4x2 --seed 2026
# Run a multi-seed parallel DST campaign across all 52 scenarios
cargo run --release -p rustfs-dst-cli -- run --scenario all --topology 4x4 --seeds 25
cargo run --release -p rustfs-dst-cli -- run --scenario all --topology 3x2 --seeds 25
cargo run --release -p rustfs-dst-cli -- run --scenario all --topology 4x2 --seeds 25
# Replay a single failing seed deterministically
cargo run --release -p rustfs-dst-cli -- repro --scenario swizzle-clog-chaos --topology 4x4 --seed 42The multipart-commit scenario rejects missing, CRC32, and incorrect SHA256 claims on replacements of a part with a declared SHA256 checksum. Its existing commit crash windows and the final payload check cover preservation of the previously accepted part in the simulator.
cargo run --release -p rustfs-dst-cli -- run --scenario expansion-gates --start-seed 2026 --seeds 20 --json
cargo run --release -p rustfs-dst-cli -- verify-determinism --scenario expansion-gates --seed 2026
cargo run --release -p rustfs-dst-cli -- repro --scenario pool-expansion-gates --seed 2026Each seed tests startup, paired hot/cold expansion, rebalance, decommission, and rolling/full restart gates under the final RustFS product contract:
- Strict uniform stripe width
Wand effective EC parityM: appended pools must match the active pool's actual on-diskformat.jsonstripe widthWand active runtime effective EC parityM. Node count, drives per node, and set count may vary (e.g.,4x4W=16 EC:4 +4x82×16 W=16 EC:4,1x4+2x2,2x4W=4 +1x8W=4). 1x1 + 1x1accepted, mixed-width rejected:1x1(W=1, EC:0) +1x1(both same-host and new-host) is accepted across startup, hot, cold, restart, equivalence, and decommission, alongside1x4 + 1x4(path & URL),3x2 + 3x2,4x2 + 4x2, and4x4 + 4x8. Mixed-width expansions (such as2x4W=8 +1x4W=4 and1x2W=2 +1x4W=4) and same-width different-EC expansions are rejected across startup, hot, and cold paths.- Per-node durable config, drift, crash recovery, and generation fencing: models both direct API/Console submit (atomic persist + fsync + re-read of
rustfs-startup.jsonon every node with fail-closed rollback) and file-staged hot expansion (rejecting missing/stale/drifted staged files), per-node EC/W/set-membership/pool-order drift even with identical volume lists, coordinator crash / partial peer commit convergence, lost-response idempotent retry,topology_generationwrite fencing, and per-node PID/start-time preservation across hot expansion/retirement vs change across cold expansion and rolling/full restarts. - Rebalance and hardened decommission: models cross-pool rebalance (live traffic, mid-rebalance crash + idempotent resume, conflict guards, physical placement checks) and hardened decommission (post-quorum source version re-verification before source cleanup under concurrent overwrite/delete races, destination conflict,
ENOSPCcapacity failure, incomplete drain, unresolved entries, maintenance conflicts, and post-offline survivor read + restart). - RSI production regression suite (Bugs #15–#19, #21–#22): covers partitioned unversioned overwrite-then-delete adoption of strictly older superseded null generations (#15), heterogeneous 3-pool
4x4(1×16) +8x8(4×16) +12x4(3×16) stripe-width inheritance (#16), standby candidate pool mid-format-initialization retryable vs terminal preflight classification (#17), partitioned overwrite divergentrollback_dir/xl.meta.bkpreclamation and committed absence-delete settlement of pure write rollback backups enabling cleanDeleteBucket(#18A/18B), live topology hot-reload (Local -> DistErasureandDistErasure -> +Pool-> Gen-0 retirement) immediately rebinding the background scanner leader onto new-generation pools/sets and lock clients (#19), pool-leader periodic 30s decommission watchdog using non-blockingtry_refresh_pool_status_meta()(try_write_owned()after loading persisted metadata outsidedata_movement_operation_gate) so a 60sscanner_publication_leasenever starves concurrentDeleteBucketusage cleanup orScannerActivityRPCs while active persisted decommissions defer retryably and recover once the lease releases (#21), anddelete_recovery_runtime+DeleteBuckethardening: dropping stale deleted/retired bucket hints onBucketNotFoundwith zero leakedpending_keys(#22A), immediately wakingMissingQuorumdelete-recovery waiters on returning partitioned remote peers (#22B), ordinaryDeleteBucketnon-destructively settling pending recovery receipts/stale copies after partition-healed quorum delete while preserving raw metadata-less residue untouched (#22C), and multi-receiptAdoptCommitper-copy matching receipt authority selection plus clean witness-only null conflict classification withoutOutdatedXLMetaretry loops (#22D).
The --topology option selects the legacy harness preset. Multi-seed --json reports record accepted topologies, semantic manifests, aggregated required must_hit phase probes, verdicts, trace digests, and admission_policy_commit as dst_model evidence (omitting verbose per-seed model_trace on passing runs by default; full model_trace is always retained on failures, in repro, or when --include-model-trace is passed). The release gate obtains live binary evidence from the real-cluster suites.
| Topology | Nodes × Drives | Total Drives | Parity (m) |
Data (k) |
Read Quorum (R) |
Write Quorum (W) |
|---|---|---|---|---|---|---|
1x1 |
1 × 1 | 1 | 0 | 1 | 1 | 1 |
1x4 |
1 × 4 | 4 | 2 | 2 | 2 | 3 |
3x1 |
3 × 1 | 3 | 1 | 2 | 2 | 2 |
4x4 |
4 × 4 | 16 | 4 | 12 | 12 | 12 |
3x2 |
3 × 2 | 6 | 3 | 3 | 3 | 4 |
4x2 |
4 × 2 | 8 | 4 | 4 | 4 | 5 |
1x1 and 1x4 use the same names as the unmerged feat/full-audit-hardening-and-advanced-dst branch. The full campaign (--scenario all) is validated on 4x4, 3x2, and 4x2. --scenario gaps is also validated on 1x1, 1x4, and 3x1. Passing a gap scenario does not mean upstream rustfs/rustfs passed that issue.
- Coverage Matrix
- Architecture & Upstream Trait Adoption Blueprint (
rustfs/rustfs) - Production-Code-Grounded
rustfs/rustfs↔rustfs/DSTTrait Refactoring &cargo-fuzzEngineering Blueprint (中文) - Simulation Backends: In-Process, Turmoil, Madsim & Antithesis
- Jepsen Distributed Verification Companion (
rustfs/Jepsen)
Licensed under the Apache License, Version 2.0.
Run scripts/check-retention-admission.sh /path/to/rustfs against a checkout containing the native retention cancellation regression. The case uses a path-scoped pause immediately before RustFS publishes the updated metadata. It cancels the request, checks that the native write still holds the only slot, then releases the pause and checks that a rejected version can be retried and read back. The production retention workflow runs this case against a pinned RustFS revision using that checkout's Cargo lockfile.