Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/synapse/patches/a927effe30f6d045 # synapse A component of the AienOS ecosystem. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/synapse#77 (code only) closed derived `a927effe30f6d045` #77 Imported from GitHub aien-dev/synapse#77 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `4862223ec7ab5e3e904aaca084d68245079c23b6` · Head `4868b3d17d1bf00385c323ba4ce6bb74c3b4ceff` ### Apply it ``` git checkout -b patch-a927effe30f6d045 4862223ec7ab5e3e904aaca084d68245079c23b6 curl -fsSL https://interplane.io/drakestapleton/synapse/patches/a927effe30f6d045.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/synapse 77 4868b3d17d1bf00385c323ba4ce6bb74c3b4ceff ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"synapse","number":77,"url":"https://github.com/aien-dev/synapse/pull/77","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:18Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/crates/synapse-bench/src/lib.rs b/crates/synapse-bench/src/lib.rs index 338ba0c..793c80b 100644 --- a/crates/synapse-bench/src/lib.rs +++ b/crates/synapse-bench/src/lib.rs @@ -32,6 +32,7 @@ pub mod query; pub mod recovery; pub mod rng; pub mod rusage; +pub mod segments; pub mod stats; pub mod synapse_arm; pub mod tree_parity; diff --git a/crates/synapse-bench/src/main.rs b/crates/synapse-bench/src/main.rs index e1ed7db..d14e90a 100644 --- a/crates/synapse-bench/src/main.rs +++ b/crates/synapse-bench/src/main.rs @@ -15,6 +15,9 @@ //! synapse-bench pmu-diag --evidence --work-dir [--fixture-repo ] //! [--source-rev R] [--sibling name=rev]... (opt-in CPU PMU diagnostics; see docs/BENCH_PMU_DIAGNOSTICS.md) //! synapse-bench pmu-verify --evidence +//! synapse-bench segments --dir --out [--agents 1,4,8,32] +//! [--changes N] [--reps N] [--blob-bytes N] [--segment-mib N] [--checkpoint-every N] [--idle-window-s S] +//! synapse-bench segments-report --raw --floor (prints the A2 report) //! ``` use std::path::PathBuf; @@ -460,6 +463,68 @@ fn c1(args: &[String]) -> Result<(), String> { Ok(()) } +/// `segments`: ADR 0003 A2 segment store measurement (raw samples to `--out`). +fn segments(args: &[String]) -> Result<(), String> { + let opts = parse_pairs( + args, + &[ + "--dir", + "--out", + "--agents", + "--changes", + "--reps", + "--blob-bytes", + "--segment-mib", + "--checkpoint-every", + "--idle-window-s", + ], + )?; + let get = |k: &str| { + opts.iter() + .rev() + .find(|(key, _)| key == k) + .map(|(_, v)| v.clone()) + }; + let num = |k: &str, d: u64| -> Result { + get(k).map_or(Ok(d), |v| v.parse().map_err(|_| format!("invalid {k}"))) + }; + let cfg = synapse_bench::segments::SegmentsConfig { + agents: parse_list(&get("--agents").unwrap_or_else(|| "1,4,8,32".into()), |x| { + x.parse().ok().filter(|n| *n > 0) + })?, + changes: num("--changes", 4000)? as usize, + reps: num("--reps", 3)? as usize, + blob_bytes: num("--blob-bytes", 11_949)? as usize, + segment_bytes: num("--segment-mib", 16)? * 1024 * 1024, + checkpoint_every: num("--checkpoint-every", 1000)? as usize, + idle_window_s: num("--idle-window-s", 30)?, + }; + let dir = PathBuf::from(get("--dir").ok_or("missing --dir")?); + let out = PathBuf::from(get("--out").ok_or("missing --out")?); + let raw = synapse_bench::segments::run_segments(&dir, &cfg)?; + synapse_bench::write_json(&out, &raw) +} + +/// `segments-report`: recompute the A2 report from `--raw` and a `--floor` report. +fn segments_report(args: &[String]) -> Result<(), String> { + use std::io::Write; + let opts = parse_pairs(args, &["--raw", "--floor"])?; + let get = |k: &str| { + opts.iter() + .rev() + .find(|(key, _)| key == k) + .map(|(_, v)| PathBuf::from(v)) + .ok_or(format!("missing {k}")) + }; + let raw: synapse_bench::segments::SegmentsRaw = synapse_bench::read_json(&get("--raw")?)?; + let floor: synapse_bench::floor::FloorReport = synapse_bench::read_json(&get("--floor")?)?; + let report = synapse_bench::segments::segments_report(&raw, &floor)?; + let bytes = serde_json::to_vec_pretty(&report).map_err(|e| e.to_string())?; + std::io::stdout() + .write_all(&bytes) + .map_err(|e| format!("write stdout: {e}")) +} + fn main() -> ExitCode { let args: Vec = std::env::args().skip(1).collect(); let outcome = match args.first().map(String::as_str) { @@ -474,6 +539,8 @@ fn main() -> ExitCode { Some("pmu-verify") => pmu_verify(&args[1..]), Some("crypto-vectors-write") => crypto_vectors_write(&args[1..]), Some("crypto-vectors-verify") => crypto_vectors_verify(&args[1..]), + Some("segments") => segments(&args[1..]), + Some("segments-report") => segments_report(&args[1..]), _ => Err("usage: synapse-bench run ... | synapse-bench child ... (see crate docs)".into()), }; match outcome { diff --git a/crates/synapse-bench/src/segments.rs b/crates/synapse-bench/src/segments.rs new file mode 100644 index 0000000..14144cc --- /dev/null +++ b/crates/synapse-bench/src/segments.rs @@ -0,0 +1,479 @@ +//! ADR 0003 A2 measurement: seconds and joules per accepted change of the segment store, +//! against the section 6.2 flush bound. +//! +//! Each cell opens a fresh store with `FsyncPolicy::GROUP_COMMIT_DEFAULT` through +//! [`SharedStore`], starts `agents` threads that submit signed one-file changesets of +//! `blob_bytes` each, and records every change's time from `submit` to durable +//! acknowledgement. Small segments make the run rotate (new segment file, pre-write, +//! directory flush) inside the timed window, and a checkpoint runs every +//! `checkpoint_every` accepted changes (blobs stay in the segments). The whole cell is one +//! energy window of the `aien_spbm` package meter; a missing meter leaves joules `None` +//! with the reason (`INSTRUMENT_UNAVAILABLE`), never a substitute. +//! +//! Bounds (fraction of bound reached = bound / measured, at most 1): +//! * latency of one change: one flush plus the change's bytes moved once at memory +//! bandwidth; +//! * steady-state interval per accepted change: the largest of flush / agents (all +//! agents' changes sharing one flush), bytes / device write bandwidth, bytes / memory +//! bandwidth, and the change's SHA-256 plus one Ed25519 verification at all-core rates; +//! * package joules per change: the idle package power for the interval bound (the +//! package draws at least that while the work runs). A floor model, not physics; NVMe +//! energy is UNMEASURED on this host. +//! +//! The flush time is the cheapest `overwrite_*_fdatasync` p50 of a `floor.json` measured +//! on the same filesystem (`synapse-bench floor`). + +use crate::energy::{idle_window, EnergyReading, EnergyWindow}; +use crate::floor::FloorReport; +use crate::stats::{summarize_us, LatencySummary}; +use ed25519_dalek::SigningKey; +use serde::{Deserialize, Serialize}; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::{Barrier, Mutex}; +use std::time::{Duration, Instant}; +use synapse_core::{ + BlobDigest, ChangesetEnvelope, FileMode, GitOid, IdempotencyKey, MutationOp, PathMutation, + RepoId, SYNAPSE_ENVELOPE_VERSION, +}; +use synapse_store::{FsyncPolicy, IngestOutcome, RecoveryPolicy, SharedStore, StoreLimits}; + +/// Memory bandwidth, bytes per second: NVIDIA DGX Spark specification, 273 GB/s (A0). +pub const MEMORY_BW_BPS: f64 = 273e9; +/// Device write bandwidth bound, bytes per second: the drive's PCIe link (A0). +pub const DEVICE_BW_BPS: f64 = 15.754e9; +/// All-core SHA-256 implementation reference, bytes per second (J3). +pub const SHA256_ALLCORE_BPS: f64 = 39.46e9; +/// All-core Ed25519 verification implementation reference, per second (J3). +pub const ED25519_ALLCORE_PER_S: f64 = 397_560.0; + +/// Run configuration. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SegmentsConfig { + pub agents: Vec, + pub changes: usize, + pub reps: usize, + pub blob_bytes: usize, + pub segment_bytes: u64, + pub checkpoint_every: usize, + pub idle_window_s: u64, +} + +/// One measured cell (raw samples). +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct CellRaw { + pub agents: usize, + pub rep: usize, + pub accepted: usize, + /// Wall time of the cell from the barrier release to the last acknowledgement. + pub elapsed_ns: u64, + /// Every accepted change's time from `submit` to durable acknowledgement. + pub latency_ns: Vec, + /// Duration of every checkpoint run during the cell. + pub checkpoint_ns: Vec, + pub batches: u64, + pub segment_files: usize, + pub blob_files: usize, + pub energy: EnergyReading, +} + +/// Figures of one cell against the bound. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct CellReport { + pub agents: usize, + pub rep: usize, + pub latency: Option, + pub interval_s: f64, + pub interval_bound_s: f64, + pub interval_fraction: f64, + pub latency_p50_s: f64, + pub latency_bound_s: f64, + pub latency_fraction: f64, + pub mean_batch: f64, + pub pkg_j_per_change: Option, + pub pkg_j_per_change_above_idle: Option, + pub pkg_mean_w: Option, + pub energy_bound_j: Option, + pub energy_fraction: Option, + pub energy_refusal: Option, +} + +/// Bound inputs used for the report. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct BoundInputs { + pub flush_s: f64, + pub flush_probe: String, + pub blob_bytes: usize, + pub memory_bw_bps: f64, + pub device_bw_bps: f64, + pub sha256_allcore_bps: f64, + pub ed25519_allcore_per_s: f64, + pub idle_pkg_w: Option, +} + +/// Raw output of a run. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SegmentsRaw { + pub config: SegmentsConfig, + pub store_dir: String, + pub idle: EnergyReading, + pub cells: Vec, +} + +/// Flush time: the cheapest overwrite-plus-`fdatasync` p50 in the floor report. +pub fn flush_from_floor(floor: &FloorReport) -> Result<(f64, String), String> { + floor + .storage + .iter() + .filter(|p| p.name.starts_with("overwrite_") && p.name.ends_with("_fdatasync")) + .filter_map(|p| p.latency.as_ref().map(|l| (l.p50_ms / 1e3, p.name.clone()))) + .min_by(|a, b| a.0.total_cmp(&b.0)) + .ok_or_else(|| "floor report has no overwrite_*_fdatasync probe".to_string()) +} + +/// Interval bound per accepted change at `agents` concurrent agents. +pub fn interval_bound_s(b: &BoundInputs, agents: usize) -> f64 { + let bytes = b.blob_bytes as f64; + let crypto = bytes / b.sha256_allcore_bps + 1.0 / b.ed25519_allcore_per_s; + (b.flush_s / agents.max(1) as f64) + .max(bytes / b.device_bw_bps) + .max(bytes / b.memory_bw_bps) + .max(crypto) +} + +/// Latency bound of one change: one flush plus its bytes moved once at memory bandwidth. +pub fn latency_bound_s(b: &BoundInputs) -> f64 { + b.flush_s + b.blob_bytes as f64 / b.memory_bw_bps +} + +/// Compute the report of one cell (pure function of the raw cell and bound inputs). +pub fn cell_report(c: &CellRaw, b: &BoundInputs, idle: &EnergyReading) -> CellReport { + let n = c.accepted.max(1) as f64; + let interval_s = c.elapsed_ns as f64 / 1e9 / n; + let us: Vec = c.latency_ns.iter().map(|v| v / 1000).collect(); + let latency = summarize_us(&us); + let mut sorted = c.latency_ns.clone(); + sorted.sort_unstable(); + let p50_ns = crate::stats::nearest_rank(&sorted, 0.5).unwrap_or(0); + let latency_p50_s = p50_ns as f64 / 1e9; + let interval_bound = interval_bound_s(b, c.agents); + let latency_bound = latency_bound_s(b); + let pkg_j_per_change = c.energy.pkg_j.map(|j| j / n); + let energy_bound_j = b.idle_pkg_w.map(|w| w * interval_bound); + CellReport { + agents: c.agents, + rep: c.rep, + latency, + interval_s, + interval_bound_s: interval_bound, + interval_fraction: interval_bound / interval_s, + latency_p50_s, + latency_bound_s: latency_bound, + latency_fraction: if latency_p50_s > 0.0 { + latency_bound / latency_p50_s + } else { + 0.0 + }, + mean_batch: c.accepted as f64 / c.batches.max(1) as f64, + pkg_j_per_change, + pkg_j_per_change_above_idle: c.energy.pkg_above_idle_j(idle).map(|j| j / n), + pkg_mean_w: c.energy.pkg_mean_w, + energy_bound_j, + energy_fraction: match (energy_bound_j, pkg_j_per_change) { + (Some(bound), Some(m)) if m > 0.0 => Some(bound / m), + _ => None, + }, + energy_refusal: c.energy.refusal.clone().or_else(|| { + c.energy + .pkg_j + .is_none() + .then(|| format!("INSTRUMENT_UNAVAILABLE: {}", c.energy.sensor)) + }), + } +} + +fn changeset( + key: &SigningKey, + label: &str, + blob_bytes: usize, +) -> (ChangesetEnvelope, Vec<(BlobDigest, Vec)>) { + let mut content = format!("// {label}\n").into_bytes(); + let mut x: u32 = label.bytes().fold(2_166_136_261u32, |a, b| { + (a ^ u32::from(b)).wrapping_mul(16_777_619) + }); + while content.len() < blob_bytes { + x ^= x << 13; + x ^= x >> 17; + x ^= x << 5; + content.push(b"abcdefghijklmnopqrstuvwxyz \n(){};"[(x % 33) as usize]); + } + let digest = BlobDigest::compute(&content); + let path = format!("src/{label}.rs"); + let mut env = ChangesetEnvelope { + version: SYNAPSE_ENVELOPE_VERSION, + repo_id: RepoId::new("aien-spark/synapse").expect("repo id"), + base_git_oid: GitOid::compute_blob(b"base"), + parent_changesets: vec![], + author_did: String::new(), + idempotency_key: IdempotencyKey::from_label(label), + created_at_ms: 1000, + intent_summary: format!("Update {path}"), + mutations: vec![PathMutation { + path, + op: MutationOp::Upsert { + mode: FileMode::Regular644, + blob_digest: digest, + size_bytes: content.len() as u64, + }, + }], + evidence_receipts: vec![], + signature: vec![], + }; + env.sign(key); + (env, vec![(digest, content)]) +} + +fn count_files(dir: &Path, pred: &dyn Fn(&str) -> bool) -> usize { + let Ok(rd) = std::fs::read_dir(dir) else { + return 0; + }; + rd.filter_map(Result::ok) + .map(|e| { + if e.file_type().map(|t| t.is_dir()).unwrap_or(false) { + count_files(&e.path(), pred) + } else { + usize::from(pred(&e.file_name().to_string_lossy())) + } + }) + .sum() +} + +fn run_cell( + dir: &Path, + cfg: &SegmentsConfig, + agents: usize, + rep: usize, +) -> Result { + let _ = std::fs::remove_dir_all(dir); + std::fs::create_dir_all(dir).map_err(|e| format!("create {}: {e}", dir.display()))?; + let limits = StoreLimits { + segment_bytes: cfg.segment_bytes, + ..Default::default() + }; + let shared = SharedStore::open( + dir, + FsyncPolicy::GROUP_COMMIT_DEFAULT, + RecoveryPolicy::StrictFailClosed, + limits, + ) + .map_err(|e| format!("open store: {e:?}"))?; + // Prepare every agent's changesets before timing (signing is the agent's own work). + let per_agent = cfg.changes.div_ceil(agents); + let work: Vec> = (0..agents) + .map(|a| { + let key = SigningKey::from_bytes(&[(a as u8).wrapping_add(1); 32]); + (0..per_agent) + .map(|i| changeset(&key, &format!("a{a}-r{rep}-c{i}"), cfg.blob_bytes)) + .collect() + }) + .collect(); + let accepted = AtomicUsize::new(0); + // Agents that finished every submission and any checkpoint they triggered. + let agents_done = AtomicUsize::new(0); + let latencies = Mutex::new(Vec::with_capacity(cfg.changes)); + let checkpoints = Mutex::new(Vec::new()); + let errors = Mutex::new(Vec::::new()); + let barrier = Barrier::new(agents + 1); + let batches_before = shared.stats().batches; + let (elapsed, energy) = std::thread::scope(|s| { + for w in &work { + let (shared, accepted, agents_done, latencies, checkpoints, errors, barrier) = ( + &shared, + &accepted, + &agents_done, + &latencies, + &checkpoints, + &errors, + &barrier, + ); + s.spawn(move || { + barrier.wait(); + for (env, blobs) in w { + let t = Instant::now(); + match shared.submit(env.clone(), blobs) { + Ok(IngestOutcome::Committed { .. }) => { + let ns = t.elapsed().as_nanos() as u64; + latencies.lock().unwrap().push(ns); + let n = accepted.fetch_add(1, Ordering::SeqCst) + 1; + if cfg.checkpoint_every > 0 && n % cfg.checkpoint_every == 0 { + let t = Instant::now(); + match shared.with_exclusive(|st| st.checkpoint_and_compact(1000)) { + Ok(_) => checkpoints + .lock() + .unwrap() + .push(t.elapsed().as_nanos() as u64), + Err(e) => { + errors.lock().unwrap().push(format!("checkpoint: {e:?}")) + } + } + } + } + Ok(other) => errors + .lock() + .unwrap() + .push(format!("not committed: {other:?}")), + Err(e) => errors.lock().unwrap().push(format!("submit: {e:?}")), + } + } + agents_done.fetch_add(1, Ordering::SeqCst); + }); + } + let window = EnergyWindow::start(); + let t0 = Instant::now(); + barrier.wait(); + // The scope joins the agents when this closure returns; time them here instead, + // up to the end of the last checkpoint an agent ran. + while agents_done.load(Ordering::SeqCst) < agents { + std::thread::sleep(Duration::from_micros(200)); + } + (t0.elapsed(), window.finish()) + }); + let errors = errors.into_inner().unwrap(); + if !errors.is_empty() { + return Err(format!( + "{} failed submissions, first: {}", + errors.len(), + errors[0] + )); + } + let batches = shared.stats().batches - batches_before; + drop(shared); + let segment_files = count_files(dir, &|n| { + synapse_store::segment::parse_segment_file_name(n).is_some() + }); + let blob_files = count_files(&dir.join("blobs"), &|_| true); + Ok(CellRaw { + agents, + rep, + accepted: accepted.into_inner(), + elapsed_ns: elapsed.as_nanos() as u64, + latency_ns: latencies.into_inner().unwrap(), + checkpoint_ns: checkpoints.into_inner().unwrap(), + batches, + segment_files, + blob_files, + energy, + }) +} + +/// Run every cell (agents x reps, agent counts interleaved inside each repetition). +pub fn run_segments(store_dir: &Path, cfg: &SegmentsConfig) -> Result { + let idle = idle_window(Duration::from_secs(cfg.idle_window_s)); + let mut cells = Vec::new(); + for rep in 0..cfg.reps { + for &agents in &cfg.agents { + let dir: PathBuf = store_dir.join(format!("cell-{agents}-{rep}")); + let cell = run_cell(&dir, cfg, agents, rep)?; + let _ = std::fs::remove_dir_all(&dir); + eprintln!( + "agents {agents} rep {rep}: {} accepted in {:.3} s, {} batches, {} segment files", + cell.accepted, + cell.elapsed_ns as f64 / 1e9, + cell.batches, + cell.segment_files + ); + cells.push(cell); + } + } + Ok(SegmentsRaw { + config: cfg.clone(), + store_dir: store_dir.display().to_string(), + idle, + cells, + }) +} + +/// Report of a run: bound inputs and every cell's figures. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SegmentsReport { + pub bounds: BoundInputs, + pub cells: Vec, +} + +/// Recompute the report from the raw run and the floor report. +pub fn segments_report(raw: &SegmentsRaw, floor: &FloorReport) -> Result { + let (flush_s, flush_probe) = flush_from_floor(floor)?; + let bounds = BoundInputs { + flush_s, + flush_probe, + blob_bytes: raw.config.blob_bytes, + memory_bw_bps: MEMORY_BW_BPS, + device_bw_bps: DEVICE_BW_BPS, + sha256_allcore_bps: SHA256_ALLCORE_BPS, + ed25519_allcore_per_s: ED25519_ALLCORE_PER_S, + idle_pkg_w: raw.idle.pkg_mean_w, + }; + let cells = raw + .cells + .iter() + .map(|c| cell_report(c, &bounds, &raw.idle)) + .collect(); + Ok(SegmentsReport { bounds, cells }) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn inputs() -> BoundInputs { + BoundInputs { + flush_s: 0.0008, + flush_probe: "overwrite_1m_fdatasync".into(), + blob_bytes: 11_949, + memory_bw_bps: MEMORY_BW_BPS, + device_bw_bps: DEVICE_BW_BPS, + sha256_allcore_bps: SHA256_ALLCORE_BPS, + ed25519_allcore_per_s: ED25519_ALLCORE_PER_S, + idle_pkg_w: Some(20.0), + } + } + + #[test] + fn interval_bound_is_flush_shared_by_agents_until_crypto_dominates() { + let b = inputs(); + assert_eq!(interval_bound_s(&b, 1), 0.0008); + assert_eq!(interval_bound_s(&b, 8), 0.0001); + // 1000 agents: the flush share (0.8 us) is below one change's crypto (2.82 us). + let crypto = 11_949.0 / SHA256_ALLCORE_BPS + 1.0 / ED25519_ALLCORE_PER_S; + assert_eq!(interval_bound_s(&b, 1000), crypto); + assert!(latency_bound_s(&b) > 0.0008); + } + + #[test] + fn fractions_are_bound_over_measured_and_refused_energy_stays_none() { + let b = inputs(); + let cell = CellRaw { + agents: 1, + rep: 0, + accepted: 4, + elapsed_ns: 8_000_000, + latency_ns: vec![1_600_000; 4], + checkpoint_ns: vec![], + batches: 4, + segment_files: 1, + blob_files: 0, + energy: EnergyReading { + refusal: Some("INSTRUMENT_UNAVAILABLE: no aien_spbm device".into()), + ..Default::default() + }, + }; + let r = cell_report(&cell, &b, &EnergyReading::default()); + assert_eq!(r.interval_s, 0.002); + assert!((r.interval_fraction - 0.4).abs() < 1e-12); + assert!(r.pkg_j_per_change.is_none() && r.energy_fraction.is_none()); + assert!(r + .energy_refusal + .unwrap() + .starts_with("INSTRUMENT_UNAVAILABLE")); + } +} diff --git a/crates/synapse-store/src/a1_tests.rs b/crates/synapse-store/src/a1_tests.rs index d131908..d361bda 100644 --- a/crates/synapse-store/src/a1_tests.rs +++ b/crates/synapse-store/src/a1_tests.rs @@ -14,13 +14,13 @@ use synapse_core::{FileMode, GitOid, PathMutation, SYNAPSE_ENVELOPE_VERSION}; const STRICT: RecoveryPolicy = RecoveryPolicy::StrictFailClosed; -fn fixture_dir(name: &str) -> PathBuf { +pub(super) fn fixture_dir(name: &str) -> PathBuf { Path::new(env!("CARGO_MANIFEST_DIR")) .join("tests/fixtures/a1-v1") .join(name) } -fn copy_tree(src: &Path, dst: &Path) { +pub(super) fn copy_tree(src: &Path, dst: &Path) { fs::create_dir_all(dst).unwrap(); for e in fs::read_dir(src).unwrap() { let e = e.unwrap(); @@ -34,19 +34,19 @@ fn copy_tree(src: &Path, dst: &Path) { } /// Copy a fixture store into a fresh temporary directory (opening a store writes to it). -fn copy_fixture(name: &str) -> PathBuf { +pub(super) fn copy_fixture(name: &str) -> PathBuf { let dir = temp_store_dir(&format!("a1-{name}")); copy_tree(&fixture_dir(name), &dir); let _ = fs::remove_file(dir.join("EXPECT")); dir } -struct Expect { - committed_seq: u64, - state_root: [u8; 32], +pub(super) struct Expect { + pub(super) committed_seq: u64, + pub(super) state_root: [u8; 32], } -fn expect(name: &str) -> Expect { +pub(super) fn expect(name: &str) -> Expect { let text = fs::read_to_string(fixture_dir(name).join("EXPECT")).unwrap(); let field = |k: &str| { text.lines() @@ -112,11 +112,26 @@ fn v1_flags(dir: &Path) -> Vec { .collect() } +/// Flags of the frames written after the current checkpoint. With the segment store +/// (ADR 0003 A2) a checkpoint keeps the segments whole, so these are the frames from the +/// replay position of the checkpoint's segment index on. fn v2_flags(dir: &Path) -> Vec { - v2_log_frames(&fs::read(dir.join(wal2::WAL_V2_FILE)).unwrap()) - .into_iter() - .map(|(_, f, _)| f) - .collect() + let binding = segment::checkpoint_binding(dir).unwrap(); + let (first, off) = segment::SegmentIndex::load(dir, &binding) + .map(|i| (i.replay_segment, i.replay_offset as usize)) + .unwrap_or((1, 0)); + let last = segment::list_segments(dir) + .unwrap() + .last() + .copied() + .unwrap_or(1); + let mut out = Vec::new(); + for id in first..=last { + let bytes = fs::read(dir.join(segment::segment_file_name(id))).unwrap(); + let from = if id == first { off } else { 0 }; + out.extend(v2_log_frames(&bytes[from..]).into_iter().map(|(_, f, _)| f)); + } + out } /// Every v1 JSON record payload in both fixtures. diff --git a/crates/synapse-store/src/group_tests.rs b/crates/synapse-store/src/group_tests.rs index f5eab6b..1bb4ae3 100644 --- a/crates/synapse-store/src/group_tests.rs +++ b/crates/synapse-store/src/group_tests.rs @@ -711,9 +711,11 @@ fn try_open( SynapseStore::open(dir, policy, recovery, StoreLimits::default()) } -/// Crash after `checkpoint.v1` is renamed into place but before the WAL files are -/// emptied: the logs still hold frames the checkpoint covers. Reconstructed by putting -/// the pre-checkpoint log files back next to the new checkpoint. +/// Crash after the checkpoint is renamed into place but before `wal.log` is replaced by +/// the marker. With the segment store (ADR 0003 A2) the checkpoint no longer empties the +/// segments: replay starts at the position its segment index names, and the index +/// vouches for the covered bytes before it. Reconstructed by putting the pre-checkpoint +/// `wal.log` back next to the new checkpoint. #[test] fn test_v2_checkpoint_crash_window_reopens_and_skips_covered_frames() { let dir = temp_store_dir("gc-ckpt-window"); @@ -730,7 +732,7 @@ fn test_v2_checkpoint_crash_window_reopens_and_skips_covered_frames() { ); } } - let (old_wal, old_v2, new_wal, root); + let (old_wal, old_v2, new_wal, root, covered_digest); { let mut store = reopen(&dir, gc, strict); for i in 3..=5u64 { @@ -747,16 +749,21 @@ fn test_v2_checkpoint_crash_window_reopens_and_skips_covered_frames() { assert_eq!(report.checkpoint_seq, WalSeq(5)); new_wal = read_file(&dir, "wal.log"); } + // The checkpoint keeps the segment bytes (no reset, no blob files). let new_v2 = read_file(&dir, wal2::WAL_V2_FILE); + assert_eq!( + new_v2[..old_v2.len()], + old_v2[..], + "segment 1 is kept whole" + ); - // Window 1: checkpoint renamed, wal.log not yet replaced, wal.v2.log not yet reset. - // Window 2: wal.log replaced by the marker, wal.v2.log not yet reset. + // Window 1: checkpoint renamed, wal.log not yet replaced by the marker. + // Window 2: wal.log replaced by the marker (the state after the checkpoint). for (label, wal_bytes) in [ ("before marker replace", &old_wal), - ("before v2 reset", &new_wal), + ("after marker replace", &new_wal), ] { write_file(&dir, "wal.log", wal_bytes); - write_file(&dir, wal2::WAL_V2_FILE, &old_v2); let store = try_open(&dir, gc, strict).unwrap_or_else(|e| { panic!("{label}: store must reopen after a checkpoint crash: {e:?}") }); @@ -765,7 +772,7 @@ fn test_v2_checkpoint_crash_window_reopens_and_skips_covered_frames() { assert_all_readable(&store, 5); } - // New commits land after the covered batches; the next reopen skips, then applies. + // New commits land after the covered batches; the next reopen applies only them. { let mut store = reopen(&dir, gc, strict); let (env, blobs) = cs(&key, "cw-6", 300); @@ -779,28 +786,41 @@ fn test_v2_checkpoint_crash_window_reopens_and_skips_covered_frames() { assert_all_readable(&store, 6); drop(store); - // Negative control: covered frames are verified, not trusted. Damage one byte of the - // first covered v2 batch and the store must refuse to open. - write_file(&dir, "wal.log", &old_wal); - let mut bad = old_v2.clone(); - bad[wal2::WAL_V2_BATCH_HEADER_LEN + WAL_HEADER_LEN + 20] ^= 0x01; + // Negative control: covered bytes are not trusted on read. Damage one byte of the + // inline blob of the first covered batch: the store opens (replay starts after the + // checkpoint) but reading that blob is refused. + let good_v2 = read_file(&dir, wal2::WAL_V2_FILE); + let mut bad = good_v2.clone(); + let p = wal2::WAL_V2_BATCH_HEADER_LEN + WAL_HEADER_LEN; + let meta_len = u32::from_le_bytes(bad[p..p + 4].try_into().unwrap()) as usize; + let d_at = p + 4 + meta_len + 4; + covered_digest = BlobDigest(bad[d_at..d_at + 32].try_into().unwrap()); + bad[d_at + 36 + 7] ^= 0x01; write_file(&dir, wal2::WAL_V2_FILE, &bad); - assert!( - try_open(&dir, gc, strict).is_err(), - "damaged covered frame must be refused" + let store = try_open(&dir, gc, strict).unwrap(); + assert_eq!( + store + .get_blob_visible(covered_digest, None, None) + .unwrap_err() + .code, + RefusalCode::BlobDigestMismatch, + "damaged covered blob must be refused on read" ); - // Negative control: covered frames that do not end at the checkpoint anchor. - write_file(&dir, "wal.log", &old_wal); - write_file(&dir, wal2::WAL_V2_FILE, &new_v2); + drop(store); + write_file(&dir, wal2::WAL_V2_FILE, &good_v2); + // Negative control: without the segment index bound to the checkpoint on disk the + // store refuses to open (it cannot know where replay starts). + let index_name = segment::SegmentIndex::file_name(&segment::checkpoint_binding(&dir).unwrap()); + let index = read_file(&dir, &index_name); + fs::remove_file(dir.join(&index_name)).unwrap(); let err = try_open(&dir, gc, strict) .err() - .expect("chain short of the checkpoint must be refused"); - assert!( - matches!( - err.code, - RefusalCode::WalSequenceGap | RefusalCode::WalChainMismatch - ), - "{err:?}" + .expect("missing segment index must be refused"); + assert_eq!(err.code, RefusalCode::CheckpointCorrupt, "{err:?}"); + write_file(&dir, &index_name, &index); + assert_eq!( + try_open(&dir, gc, strict).unwrap().committed_seq(), + WalSeq(6) ); let _ = fs::remove_dir_all(&dir); } diff --git a/crates/synapse-store/src/lib.rs b/crates/synapse-store/src/lib.rs index 4790a9b..2443d4e 100644 --- a/crates/synapse-store/src/lib.rs +++ b/crates/synapse-store/src/lib.rs @@ -3,8 +3,10 @@ //! Provides: //! - Append-only WAL (`SWAL` v1, 88-byte header) with Castagnoli CRC-32C, SHA-256 hash chain, //! monotonic `WalSeq` validation, and explicit `FsyncPolicy`. -//! - Content-addressed immutable blob store (`blobs/<2-hex>/<64-hex>`) with atomic visibility -//! tied strictly to committed `WalSeq` watermarks (preventing phantom visibility after crashes). +//! - Content-addressed immutable blobs with atomic visibility tied strictly to committed +//! `WalSeq` watermarks (preventing phantom visibility after crashes): one file each +//! (`blobs/<2-hex>/<64-hex>`) in v1 stores, inside the append-only segment files in +//! group-commit stores (ADR 0003 A2, [`segment`]). //! - Idempotent ingest (`IdempotencyKey`), snapshot reads (`snapshot_seq`), read-your-writes //! enforcement (`min_visible_seq`), deterministic replay, and admission backpressure. //! - Atomic checkpointing, WAL compaction, and root-based garbage collection (`GarbageRoot`). @@ -28,6 +30,9 @@ mod a1_tests; pub mod codec; #[cfg(test)] mod group_tests; +pub mod segment; +#[cfg(test)] +mod segment_tests; mod shared; pub mod wal2; @@ -173,6 +178,15 @@ pub struct StoreLimits { /// their blobs inline). #[serde(default = "default_max_wal_record_bytes")] pub max_wal_record_bytes: u64, + /// Segment store (ADR 0003 A2): a new segment file is started when the active one + /// holds data and the next batch would end past this many bytes. A larger batch + /// still goes into one segment on its own. + #[serde(default = "default_segment_bytes")] + pub segment_bytes: u64, +} + +fn default_segment_bytes() -> u64 { + 256 * 1024 * 1024 } fn default_wal_prealloc_bytes() -> u64 { @@ -193,6 +207,7 @@ impl Default for StoreLimits { default_retention_window_ms: 3_600_000, // 1 hour default speculative retention wal_prealloc_bytes: default_wal_prealloc_bytes(), max_wal_record_bytes: default_max_wal_record_bytes(), + segment_bytes: default_segment_bytes(), } } } @@ -231,6 +246,21 @@ pub enum FaultInjection { /// WAL v2: write the whole next batch without syncing, then terminate the process with /// exit code [`FAULT_CRASH_EXIT_CODE`]. CrashBeforeBatchSync, + /// Segment store: write and `fdatasync` the next batch, then terminate the process + /// with exit code [`FAULT_CRASH_EXIT_CODE`] before the blob index is updated or + /// anything is acknowledged (crash between payload and index). + CrashAfterBatchSyncBeforeIndex, + /// Segment store: if the next batch rotates to a new segment, create and pre-write + /// the new file, then terminate the process with exit code + /// [`FAULT_CRASH_EXIT_CODE`] before the directory flush. + CrashAfterSegmentCreateBeforeDirSync, + /// Segment store: if the next batch rotates to a new segment, report a failure of + /// the directory flush. Nothing is written into the log; nothing is acknowledged. + FailNextSegmentDirSync, + /// Segment store: in the next `checkpoint_and_compact`, write the segment index + /// file, then terminate the process with exit code [`FAULT_CRASH_EXIT_CODE`] before + /// the checkpoint replaces the previous one. + CrashAfterSegmentIndexBeforeCheckpoint, } /// Exit code used by the process-terminating fault injections. @@ -374,14 +404,16 @@ pub struct SynapseStore { torn_frames_truncated_on_open: usize, /// True once `wal.log` ends with the WAL v2 marker: all new frames go to `wal.v2.log`. v2_mode: bool, - /// WAL v2 writer (taken out by the group-commit leader while it writes a batch). - wal_v2: Option, - /// Read handle on `wal.v2.log` for inline blob reads. - wal_v2_reader: Option, - /// End of the valid WAL v2 log found by recovery. - wal_v2_recovered_end: u64, - /// Inline blob locations in `wal.v2.log`: digest to (absolute offset, length). - blob_locations: BTreeMap, + /// Layout of the log after `wal.log`, from the marker recovery found. + log_layout: LogLayout, + /// Segment writer (taken out by the group-commit leader while it writes a batch). + wal_v2: Option, + /// Read handles on the segment files, by segment id, for inline blob reads. + segment_readers: BTreeMap, + /// End of the valid log found by recovery: (segment, byte offset). + wal_v2_recovered_end: (u64, u64), + /// The blob index: digest to its location inside a segment. + blob_locations: BTreeMap, /// Set when a failed batch could not be rolled back: every write is refused until reopen. poisoned: Option, /// Codec new WAL records are written with (ADR 0003 A1). @@ -396,6 +428,19 @@ pub struct SynapseStore { tombstone_pending: bool, } +/// What follows the v1 frames of `wal.log`. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum LogLayout { + /// No marker: a v1 store (or a new one). + V1, + /// WAL v2 marker (version 2): `wal.v2.log` alone, checkpoints emptied it and moved + /// retained blobs to blob files (the layout before ADR 0003 A2). + SingleFileV2, + /// Segment marker (version 3): segments `wal.v2.log`, `wal.v2.000002.log`, ... with + /// a segment index bound to the checkpoint (ADR 0003 A2). + Segments, +} + /// One upsert check from ingest step 7, evaluated in mutation order. #[derive(Debug, Clone)] enum UpsertCheck { @@ -471,7 +516,7 @@ enum Planned { /// A WAL v2 batch in flight: the writer and fault taken out of the store, plus the /// chain position the batch starts from. pub(crate) struct V2Ticket { - writer: wal2::WalV2Writer, + writer: segment::SegmentLog, fault: FaultInjection, base_seq: WalSeq, prev_sha: [u8; 32], @@ -511,9 +556,10 @@ impl SynapseStore { canonical_heads: BTreeMap::new(), torn_frames_truncated_on_open: 0, v2_mode: false, + log_layout: LogLayout::V1, wal_v2: None, - wal_v2_reader: None, - wal_v2_recovered_end: 0, + segment_readers: BTreeMap::new(), + wal_v2_recovered_end: (1, 0), blob_locations: BTreeMap::new(), poisoned: None, codec: RecordCodec::BinaryV2, @@ -528,17 +574,19 @@ impl SynapseStore { store.write_v1_tombstone()?; } if fsync_policy.is_group_commit() { - if !store.v2_mode { - store.write_v2_marker_append()?; - } - let path = store.root_dir.join(wal2::WAL_V2_FILE); - let writer = wal2::WalV2Writer::open( - &path, - store.wal_v2_recovered_end, + if store.log_layout != LogLayout::Segments { + store.upgrade_to_segments()?; + } + let (active, end) = store.wal_v2_recovered_end; + let writer = segment::SegmentLog::open( + &store.root_dir, + active, + end, + store.limits.segment_bytes, store.limits.wal_prealloc_bytes, )?; - store.wal_v2_reader = Some(File::open(&path).map_err(io_err)?); store.wal_v2 = Some(writer); + store.open_segment_readers()?; } else if store.v2_mode { return Err(SynapseError::new( RefusalCode::WalVersionUnsupported, @@ -986,8 +1034,16 @@ impl SynapseStore { ticket: &mut V2Ticket, records: &[&wal2::EncodedRecord], ) -> Result, wal2::BatchFailure> { + use segment::RotationFault as Rot; use wal2::{BatchIoFault as Io, FrameFault as Fr}; let first_len = records.first().map_or(0, |r| r.payload.len()); + let rotation_fault = match ticket.fault { + FaultInjection::CrashAfterSegmentCreateBeforeDirSync => Rot::CrashBeforeDirSync { + code: FAULT_CRASH_EXIT_CODE, + }, + FaultInjection::FailNextSegmentDirSync => Rot::FailDirSync, + _ => Rot::None, + }; let (frame_fault, io_fault) = match ticket.fault { FaultInjection::None => (Fr::None, Io::None), FaultInjection::CrashAfterBlobWriteBeforeWalAppend => { @@ -1033,13 +1089,25 @@ impl SynapseStore { code: FAULT_CRASH_EXIT_CODE, }, ), + FaultInjection::CrashAfterBatchSyncBeforeIndex => ( + Fr::None, + Io::CrashAfterSync { + code: FAULT_CRASH_EXIT_CODE, + }, + ), + FaultInjection::CrashAfterSegmentCreateBeforeDirSync + | FaultInjection::FailNextSegmentDirSync + | FaultInjection::CrashAfterSegmentIndexBeforeCheckpoint => (Fr::None, Io::None), }; let capacity = wal2::WAL_V2_BATCH_HEADER_LEN + records .iter() .map(|r| WAL_HEADER_LEN + r.payload.len()) .sum::(); - let mut builder = wal2::BatchBuilder::new(ticket.writer.write_offset, capacity); + // The finished batch is padded to the next 4 KiB after its 8-byte trailer. + let batch_len = wal2::align_up((capacity + wal2::WAL_V2_BATCH_TRAILER.len()) as u64); + let (segment, base) = ticket.writer.reserve(batch_len, rotation_fault)?; + let mut builder = wal2::BatchBuilder::new(segment, base, capacity); let mut seq = ticket.base_seq; let mut prev = ticket.prev_sha; let mut placed = Vec::with_capacity(records.len()); @@ -1062,7 +1130,22 @@ impl SynapseStore { ticket: V2Ticket, result: Result, wal2::BatchFailure>, ) -> SynapseResult> { + let active = ticket.writer.active(); self.wal_v2 = Some(ticket.writer); + if !self.segment_readers.contains_key(&active) { + // A new segment (its directory entry is already flushed). Without a read + // handle its blobs could not be served, so a failure here poisons the store. + match File::open(self.root_dir.join(segment::segment_file_name(active))) { + Ok(f) => { + self.segment_readers.insert(active, f); + } + Err(e) => { + let msg = format!("open segment {active} for reads: {e}"); + self.poisoned = Some(msg.clone()); + return Err(SynapseError::new(RefusalCode::IoFailure, msg)); + } + } + } match result { Ok(placed) => { if let Some(last) = placed.last() { @@ -1089,24 +1172,30 @@ impl SynapseStore { for &(digest, off, len) in inline { self.blob_locations .entry(digest) - .or_insert((placed.payload_offset + u64::from(off), len)); + .or_insert(segment::BlobLoc { + segment: placed.segment, + offset: placed.payload_offset + u64::from(off), + len, + }); } self.apply_record(placed.seq, record); } - fn read_inline_blob(&self, digest: BlobDigest, off: u64, len: u32) -> SynapseResult> { - use std::os::unix::fs::FileExt; - let f = self.wal_v2_reader.as_ref().ok_or_else(|| { + fn read_inline_blob( + &self, + digest: BlobDigest, + loc: segment::BlobLoc, + ) -> SynapseResult> { + let f = self.segment_readers.get(&loc.segment).ok_or_else(|| { SynapseError::new( RefusalCode::BlobNotFound, - "WAL v2 log is not open for reads", + format!("segment {} is not open for reads", loc.segment), ) })?; - let mut bytes = vec![0u8; len as usize]; - f.read_exact_at(&mut bytes, off).map_err(|e| { + let bytes = segment::read_at(f, loc.offset, loc.len).map_err(|e| { SynapseError::new( RefusalCode::BlobNotFound, - format!("read inline blob {digest} from wal.v2.log: {e}"), + format!("read blob {digest} from segment {}: {e}", loc.segment), ) })?; let computed = BlobDigest::compute(&bytes); @@ -1119,34 +1208,108 @@ impl SynapseStore { Ok(bytes) } - /// Append the WAL v2 marker to `wal.log` (switches the store to WAL v2 for good). + /// Switch the store to the segment layout for good (ADR 0003 A2). Runs on open with + /// `GroupCommit` for a v1 store, a new store, or a single-file WAL v2 store. /// - /// Atomic: the current log plus the marker is written to `wal.log.tmp`, synced, and + /// First the segment index for the checkpoint on disk is written (replay from the + /// start of segment 1, no entries: such checkpoints keep their blobs as files), then + /// `wal.log` gets the segment marker, atomically: the current log (without a WAL v2 + /// marker at its end) plus the marker is written to `wal.log.tmp`, synced, and /// renamed over `wal.log`, then the directory is synced. A crash before the rename - /// leaves the v1 log untouched (the stray temp file is overwritten next time); after + /// leaves the old store untouched (the stray files are overwritten next time); after /// it, the complete marker is in place. An in-place append could leave a torn /// 88-byte tail that strict recovery refuses. - fn write_v2_marker_append(&mut self) -> SynapseResult<()> { - let header = v2_marker_header(self.committed_seq, self.last_frame_sha256); + fn upgrade_to_segments(&mut self) -> SynapseResult<()> { + for id in segment::list_segments(&self.root_dir)? { + if id >= 2 && self.segment_has_data(id)? { + return Err(SynapseError::new( + RefusalCode::WalVersionUnsupported, + format!("segment {id} holds data but wal.log has no segment marker"), + )); + } + } + let index = segment::SegmentIndex { + binding: segment::checkpoint_binding(&self.root_dir)?, + replay_segment: 1, + replay_offset: 0, + entries: BTreeMap::new(), + }; + let keep = index.write(&self.root_dir)?; + let (keep_len, seq, prev) = match self.log_layout { + LogLayout::SingleFileV2 => { + // Replace the WAL v2 marker (the last 88 bytes) with the segment marker + // at the same chain position. + let old = fs::read(&self.wal_path).map_err(io_err)?; + let at = old.len() - WAL_HEADER_LEN; + let seq = WalSeq(u64::from_le_bytes(old[at + 8..at + 16].try_into().unwrap())); + let prev: [u8; 32] = old[at + 16..at + 48].try_into().unwrap(); + (at as u64, seq, prev) + } + _ => { + let len = match fs::metadata(&self.wal_path) { + Ok(m) => m.len(), + Err(_) => 0, + }; + (len, self.committed_seq, self.last_frame_sha256) + } + }; + let header = marker_header(segment::WAL_SEGMENT_MARKER_VERSION, seq, prev); let tmp = self.root_dir.join("wal.log.tmp"); { let mut f = File::create(&tmp).map_err(io_err)?; - if self.wal_path.exists() { - let mut src = File::open(&self.wal_path).map_err(io_err)?; - std::io::copy(&mut src, &mut f).map_err(io_err)?; + if keep_len > 0 { + let src = File::open(&self.wal_path).map_err(io_err)?; + std::io::copy(&mut src.take(keep_len), &mut f).map_err(io_err)?; } f.write_all(&header).map_err(io_err)?; f.sync_all().map_err(io_err)?; } fs::rename(&tmp, &self.wal_path).map_err(io_err)?; sync_dir(&self.root_dir)?; + segment::remove_other_indexes(&self.root_dir, &keep)?; self.v2_mode = true; + self.log_layout = LogLayout::Segments; + Ok(()) + } + + /// True when segment `id` exists and holds a non-zero byte. + fn segment_has_data(&self, id: u64) -> SynapseResult { + let path = self.root_dir.join(segment::segment_file_name(id)); + match fs::read(&path) { + Ok(b) => Ok(b.iter().any(|x| *x != 0)), + Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(false), + Err(e) => Err(io_err(e)), + } + } + + /// Open a read handle on every segment file up to the active one. + fn open_segment_readers(&mut self) -> SynapseResult<()> { + let last = self.wal_v2.as_ref().map_or(0, |w| w.active()); + for id in 1..=last { + if self.segment_readers.contains_key(&id) { + continue; + } + let path = self.root_dir.join(segment::segment_file_name(id)); + match File::open(&path) { + Ok(f) => { + self.segment_readers.insert(id, f); + } + // Segments before the replay start may hold no retained blob; a missing + // one only fails the reads that need it (BlobNotFound). + Err(e) if e.kind() == std::io::ErrorKind::NotFound => {} + Err(e) => return Err(io_err(e)), + } + } Ok(()) } - /// Atomically replace `wal.log` with a file holding only the WAL v2 marker. - fn replace_wal_log_with_v2_marker(&self) -> SynapseResult<()> { - let header = v2_marker_header(self.committed_seq, self.last_frame_sha256); + /// Atomically replace `wal.log` with a file holding only the segment marker. + fn replace_wal_log_with_segment_marker(&self) -> SynapseResult<()> { + let header = marker_header( + segment::WAL_SEGMENT_MARKER_VERSION, + self.committed_seq, + self.last_frame_sha256, + ); let tmp = self.root_dir.join("wal.log.tmp"); { let mut f = File::create(&tmp).map_err(io_err)?; @@ -1315,8 +1478,8 @@ impl SynapseStore { ), )); } - if let Some(&(off, len)) = self.blob_locations.get(&digest) { - return self.read_inline_blob(digest, off, len); + if let Some(&loc) = self.blob_locations.get(&digest) { + return self.read_inline_blob(digest, loc); } let path = self.blob_path(digest); let bytes = fs::read(&path).map_err(|_| { @@ -1434,24 +1597,15 @@ impl SynapseStore { self.blob_first_visible_seq .retain(|digest, _| retained_blobs.contains(digest)); - // 2b. WAL v2: retained blobs stored inline in `wal.v2.log` become blob files - // (synced) before the checkpoint makes the log disposable. - if self.v2_mode { - let inline: Vec<(BlobDigest, (u64, u32))> = self - .blob_locations - .iter() - .filter(|(d, _)| retained_blobs.contains(d)) - .map(|(d, l)| (*d, *l)) - .collect(); - for (digest, (off, len)) in inline { - let bytes = self.read_inline_blob(digest, off, len)?; - self.write_blob_file(digest, &bytes)?; - } - } + // 2b. Segment store (ADR 0003 A2): retained blobs stay where they are, inside + // the segments; the segment index written below records their locations. + // No blob file is written and no segment byte is removed (no garbage + // collection of segment data before step K1). // 3. Persist the atomic binary checkpoint `checkpoint.v2`. Every logged frame is // made durable first, so frames the checkpoint covers are never torn if the - // process dies before the logs are emptied (recovery verifies and skips them). + // process dies before `wal.log` is replaced (recovery verifies and skips them; + // in the segment layout the segment index vouches for the covered prefix). // The first binary checkpoint records the last v1 state root (or the empty // root for a store that never wrote v1) and chains its own root to it; every // later one chains to the previous checkpoint root. @@ -1485,6 +1639,32 @@ impl SynapseStore { "checkpoint.v2 does not decode back to the state it was written from", )); } + // Segment store: the index bound to this checkpoint's exact bytes goes first. A + // crash before the checkpoint rename leaves the previous checkpoint and its own + // index (removed only below, after this checkpoint is durable). + let segment_index = if self.v2_mode { + let log = self.wal_v2.as_ref().ok_or_else(|| { + SynapseError::new(RefusalCode::IoFailure, "WAL v2 writer is not available") + })?; + let index = segment::SegmentIndex { + binding: segment::binding_of(Some((codec::CHECKPOINT_V2_FILE, &bytes))), + replay_segment: log.active(), + replay_offset: log.write_offset(), + entries: self + .blob_locations + .iter() + .filter(|(d, _)| retained_blobs.contains(d)) + .map(|(d, l)| (*d, *l)) + .collect(), + }; + let name = index.write(&self.root_dir)?; + if self.fault_injection == FaultInjection::CrashAfterSegmentIndexBeforeCheckpoint { + std::process::exit(FAULT_CRASH_EXIT_CODE); + } + Some((name, index)) + } else { + None + }; write_file_atomic( &self.root_dir, &self.root_dir.join("checkpoint.v2.tmp"), @@ -1498,17 +1678,13 @@ impl SynapseStore { self.write_v1_tombstone()?; // 4. Compact `wal.log` (truncate to empty since all state up to `checkpoint_seq` is in `checkpoint.v2`) - if self.v2_mode { - // WAL v2: `wal.log` keeps only the marker (so older binaries still refuse the - // store), then `wal.v2.log` is emptied and pre-written again. - self.replace_wal_log_with_v2_marker()?; - self.wal_v2 - .as_mut() - .ok_or_else(|| { - SynapseError::new(RefusalCode::IoFailure, "WAL v2 writer is not available") - })? - .reset()?; - self.blob_locations.clear(); + if let Some((name, index)) = segment_index { + // Segment store: `wal.log` keeps only the segment marker (so older binaries + // still refuse the store); the segments are kept whole, replay starts at the + // index's position, and older index files are removed. + self.replace_wal_log_with_segment_marker()?; + segment::remove_other_indexes(&self.root_dir, &name)?; + self.blob_locations = index.entries; } else { let f = OpenOptions::new() .create(true) @@ -1940,7 +2116,8 @@ impl SynapseStore { // 2. Replay wal.log (v1 frames, possibly ending in the WAL v2 marker), then wal.v2.log. // Frames the checkpoint already covers (a crash after the checkpoint rename and - // before the logs were emptied) are verified and skipped. + // before the logs were emptied) are verified and skipped. In the segment layout + // (ADR 0003 A2) replay of the segments starts at the segment index position. let mut overlap = CheckpointOverlap::default(); if self.wal_path.exists() { self.recover_v1(recovery_policy, &mut overlap)?; @@ -2037,9 +2214,12 @@ impl SynapseStore { )); } let version = u16::from_le_bytes(header[4..6].try_into().unwrap()); - if version == wal2::WAL_V2_VERSION && header[6] == WAL_V2_MARKER_KIND { - // WAL v2 marker: the log continues in wal.v2.log. It must be the last - // frame, continue the chain without advancing it, and hash correctly. + let marker_version = + version == wal2::WAL_V2_VERSION || version == segment::WAL_SEGMENT_MARKER_VERSION; + if marker_version && header[6] == WAL_V2_MARKER_KIND { + // Log marker: the log continues in wal.v2.log (version 2) or in the + // segments (version 3). It must be the last frame, continue the chain + // without advancing it, and hash correctly. if offset + WAL_HEADER_LEN as u64 != file_len { return Err(SynapseError::new( RefusalCode::WalMagicInvalid, @@ -2063,7 +2243,7 @@ impl SynapseStore { format!("WAL v2 marker at {seq} does not follow {expected_seq}"), )); } - if header != v2_marker_header(expected_seq, expected_prev) { + if header != marker_header(version, expected_seq, expected_prev) { return Err(SynapseError::new( RefusalCode::WalChainMismatch, format!("WAL v2 marker at offset {offset} does not match the chain"), @@ -2073,6 +2253,11 @@ impl SynapseStore { overlap.cursor = Some((seq, marker_prev)); } self.v2_mode = true; + self.log_layout = if version == wal2::WAL_V2_VERSION { + LogLayout::SingleFileV2 + } else { + LogLayout::Segments + }; break; } if version != WAL_VERSION { @@ -2224,34 +2409,137 @@ impl SynapseStore { Ok(()) } - /// Replay `wal.v2.log`: whole batches only (all frames valid or none applied). + /// Replay the log after `wal.log`: segment 1 (`wal.v2.log`) and, in the segment + /// layout, the segments after it, whole batches only (all frames valid or none + /// applied). In the segment layout replay starts at the position the segment index + /// of the checkpoint names, and the index supplies the locations of the blobs the + /// checkpoint retains. fn recover_v2( &mut self, recovery_policy: RecoveryPolicy, overlap: &mut CheckpointOverlap, ) -> SynapseResult<()> { - let path = self.root_dir.join(wal2::WAL_V2_FILE); - if !path.exists() { + let ids = segment::list_segments(&self.root_dir)?; + if !self.v2_mode { + for &id in &ids { + if self.segment_has_data(id)? { + return Err(SynapseError::new( + RefusalCode::WalVersionUnsupported, + format!( + "{} holds data but wal.log does not end with the WAL v2 marker", + segment::segment_file_name(id) + ), + )); + } + } return Ok(()); } - let buf = fs::read(&path).map_err(io_err)?; - if !self.v2_mode { - if buf.iter().any(|b| *b != 0) { + let (start_seg, start_off) = if self.log_layout == LogLayout::Segments { + let binding = segment::checkpoint_binding(&self.root_dir)?; + let index = segment::SegmentIndex::load(&self.root_dir, &binding)?; + self.blob_locations = index.entries.clone(); + if (index.replay_segment, index.replay_offset) != (1, 0) { + // The index vouches for every segment byte before its replay position: + // those frames are covered by the checkpoint it is bound to. + if overlap.cursor.is_some() { + overlap.cursor = Some((self.committed_seq, self.last_frame_sha256)); + } + overlap.close(self.committed_seq, self.last_frame_sha256)?; + } + (index.replay_segment, index.replay_offset) + } else { + // Single-file WAL v2: segment 1 only. + if let Some(&id) = ids.iter().find(|&&id| id >= 2) { + if self.segment_has_data(id)? { + return Err(SynapseError::new( + RefusalCode::WalVersionUnsupported, + format!( + "segment {id} holds data but wal.log has the single-file WAL v2 marker" + ), + )); + } + } + (1, 0) + }; + let last = ids.last().copied().unwrap_or(0).max(start_seg); + let max = if self.log_layout == LogLayout::Segments { + // Segments are never removed (no garbage collection before K1), so every id + // up to the last must be present; only a store that crashed before creating + // its first segment has none. + let never_created = ids.is_empty() && (start_seg, start_off) == (1, 0); + if let Some(missing) = (1..=last).find(|id| !never_created && !ids.contains(id)) { return Err(SynapseError::new( - RefusalCode::WalVersionUnsupported, - "wal.v2.log holds data but wal.log does not end with the WAL v2 marker", + RefusalCode::WalSequenceGap, + format!( + "segment file {} is missing", + segment::segment_file_name(missing) + ), )); } - return Ok(()); + last + } else { + 1 + }; + self.wal_v2_recovered_end = (start_seg, start_off); + for id in start_seg..=max { + let path = self.root_dir.join(segment::segment_file_name(id)); + if !path.exists() { + break; + } + let base = if id == start_seg { start_off } else { 0 }; + let buf = { + let mut f = File::open(&path).map_err(io_err)?; + f.seek(SeekFrom::Start(base)).map_err(io_err)?; + let mut b = Vec::new(); + f.read_to_end(&mut b).map_err(io_err)?; + b + }; + let (end, holds_data, truncated) = + self.replay_segment(id, &path, base, &buf, max, recovery_policy, overlap)?; + if holds_data || id == start_seg { + self.wal_v2_recovered_end = (id, end); + } + if truncated { + break; + } + } + Ok(()) + } + + /// True when every segment after `id` up to `max` is missing or all zero. + fn later_segments_zero(&self, id: u64, max: u64) -> SynapseResult { + for later in id + 1..=max { + if self.segment_has_data(later)? { + return Ok(false); + } } + Ok(true) + } + + /// Replay the batches of segment `id` held in `buf` (the file from byte `base` on). + /// Returns the absolute end of the valid log in this segment, whether it holds a + /// batch (or a torn tail), and whether a torn tail was truncated. + #[allow(clippy::too_many_arguments)] + fn replay_segment( + &mut self, + id: u64, + path: &Path, + base: u64, + buf: &[u8], + max: u64, + recovery_policy: RecoveryPolicy, + overlap: &mut CheckpointOverlap, + ) -> SynapseResult<(u64, bool, bool)> { let hlen = wal2::WAL_V2_BATCH_HEADER_LEN; let mut off = 0usize; + let mut holds_data = false; while off < buf.len() { let header_end = (off + hlen).min(buf.len()); let header_zero = buf[off..header_end].iter().all(|b| *b == 0); if header_zero && buf[off..].iter().all(|b| *b == 0) { - break; // clean end of the log + break; // clean end of this segment } + holds_data = true; // A batch the checkpoint covers: verify it whole (fail closed on any error, it // was acknowledged before the checkpoint) and skip it. if let Some((_, _, first)) = buf.get(off..off + hlen).and_then(wal2::parse_batch_header) @@ -2261,10 +2549,10 @@ impl SynapseStore { Some((s, h)) => (s.next(), h), // Nothing skipped yet: take the chain link the batch states; the // skipped chain must still end at the checkpoint anchor. - None => (first, wal2::first_frame_prev(&buf, off)), + None => (first, wal2::first_frame_prev(buf, off)), }; let (frames, next) = wal2::validate_batch( - &buf, + buf, off, expected_seq, expected_prev, @@ -2294,7 +2582,7 @@ impl SynapseStore { )) } else { wal2::validate_batch( - &buf, + buf, off, self.committed_seq.next(), self.last_frame_sha256, @@ -2327,8 +2615,12 @@ impl SynapseStore { } } } - for &(d, abs, len) in &fr.inline { - self.blob_locations.entry(d).or_insert((abs, len)); + for &(d, rel, len) in &fr.inline { + self.blob_locations.entry(d).or_insert(segment::BlobLoc { + segment: id, + offset: base + rel, + len, + }); } self.committed_seq = fr.seq; self.last_frame_sha256 = fr.frame_sha256; @@ -2341,8 +2633,13 @@ impl SynapseStore { if e.code == RefusalCode::QuotaPayloadTooLarge { return Err(e); } - let torn = - !wal2::valid_batch_after(&buf, off + 1) && wal2::torn_evidence(&buf, off); + // A torn tail is only the last write: nothing valid after it in this + // segment, its lost end reads back as zeros, and every later segment + // is empty (a batch never goes to a new segment before the previous + // one is durable). + let torn = !wal2::valid_batch_after(buf, off + 1) + && wal2::torn_evidence(buf, off) + && self.later_segments_zero(id, max)?; if !torn { return Err(e); } @@ -2350,26 +2647,29 @@ impl SynapseStore { RecoveryPolicy::StrictFailClosed => { return Err(SynapseError::new( RefusalCode::WalTornFrame, - format!("torn WAL v2 batch at byte offset {off}: {}", e.message), + format!( + "torn WAL v2 batch in segment {id} at byte offset {}: {}", + base + off as u64, + e.message + ), )) } RecoveryPolicy::TruncateTornTail => { use std::os::unix::fs::FileExt; let last_nonzero = buf.iter().rposition(|b| *b != 0).unwrap_or(off); let end = wal2::align_up(last_nonzero as u64 + 1) as usize; - let f = OpenOptions::new().write(true).open(&path).map_err(io_err)?; - f.write_all_at(&vec![0u8; end - off], off as u64) + let f = OpenOptions::new().write(true).open(path).map_err(io_err)?; + f.write_all_at(&vec![0u8; end - off], base + off as u64) .map_err(io_err)?; f.sync_data().map_err(io_err)?; self.torn_frames_truncated_on_open += 1; - break; + return Ok((base + off as u64, true, true)); } } } } } - self.wal_v2_recovered_end = off as u64; - Ok(()) + Ok((base + off as u64, holds_data, false)) } fn handle_torn_tail( @@ -2396,8 +2696,8 @@ impl SynapseStore { /// Log frames that `checkpoint.v1` already covers, met at the start of replay. /// -/// A crash after the checkpoint is renamed into place but before `wal.log` and -/// `wal.v2.log` are emptied leaves frames with `seq <= checkpoint_seq` in front of the +/// A crash after the checkpoint is renamed into place but before `wal.log` (and, in the +/// single-file WAL v2 layout before ADR 0003 A2, `wal.v2.log`) is emptied leaves frames with `seq <= checkpoint_seq` in front of the /// log. Recovery verifies them (CRC, frame digest, and one unbroken hash chain among /// them) and skips them; the skipped chain must end exactly at the checkpoint's sequence /// and anchor digest. Skipping is allowed only before the first frame is applied. @@ -2461,11 +2761,13 @@ impl CheckpointOverlap { /// Frame kind of the WAL v2 marker written at the end of `wal.log`. const WAL_V2_MARKER_KIND: u8 = 0xFF; -/// The 88-byte WAL v2 marker: v1 header layout with version 2, kind `0xFF`, an empty -/// payload, `seq` and `prev_frame_sha256` equal to the last committed frame. Binaries -/// that only know v1 refuse it (`WalVersionUnsupported`) instead of missing v2 commits. -fn v2_marker_header(seq: WalSeq, prev: [u8; 32]) -> [u8; WAL_HEADER_LEN] { - wal2::frame_header( +/// The 88-byte log marker: v1 header layout with `version` (2: WAL v2 in `wal.v2.log` +/// alone; 3: the segment layout of ADR 0003 A2), kind `0xFF`, an empty payload, `seq` +/// and `prev_frame_sha256` equal to the last committed frame, and the v2 frame digest. +/// Binaries that do not know the version refuse it (`WalVersionUnsupported`) instead of +/// missing the commits that follow it. +fn marker_header(version: u16, seq: WalSeq, prev: [u8; 32]) -> [u8; WAL_HEADER_LEN] { + let mut h = wal2::frame_header( seq, prev, WAL_V2_MARKER_KIND, @@ -2474,7 +2776,11 @@ fn v2_marker_header(seq: WalSeq, prev: [u8; 32]) -> [u8; WAL_HEADER_LEN] { crc32c(&[]), &wal2::payload_digest(&[]), ) - .0 + .0; + h[4..6].copy_from_slice(&version.to_le_bytes()); + let sha = wal2::frame_digest(&h[0..56], &wal2::payload_digest(&[])); + h[56..88].copy_from_slice(&sha); + h } fn compute_wal_frame_sha256(header_prefix_56: &[u8], payload: &[u8]) -> [u8; 32] { diff --git a/crates/synapse-store/src/segment.rs b/crates/synapse-store/src/segment.rs new file mode 100644 index 0000000..f46c0d1 --- /dev/null +++ b/crates/synapse-store/src/segment.rs @@ -0,0 +1,446 @@ +//! Segment store (ADR 0003 step A2, section 5.9): WAL records and blob content in +//! append-only segment files instead of one file per blob. +//! +//! * Segment `1` is `wal.v2.log`; segment `n >= 2` is `wal.v2..log`, +//! all in the store root. Every segment has the WAL v2 layout ([`super::wal2`]): 4 KiB +//! aligned batches, frames with inline blobs, zero-filled and synced space ahead of the +//! write position. A batch is one positioned write plus one `fdatasync` of the active +//! segment. +//! * Rotation: when the active segment holds data and the next batch would end past +//! `StoreLimits::segment_bytes`, a new segment file is created, zero-filled, synced +//! (`sync_all`), and the store directory is flushed before any batch is written into it. +//! The active segment is synced and the directory flushed again on every open, so a +//! file left by a process that died before its directory flush is made durable before +//! it receives a batch. +//! * Index: in memory, blob digest to `(segment, offset, length)`. Recovery rebuilds it +//! from the segment index file bound to the checkpoint plus the batches replayed after +//! it. Checkpoints never move blobs out of the segments and never empty a segment +//! (no garbage collection of segment data before ADR 0003 step K1). +//! * Segment index file `wal.v2.index.<16 hex>`: written (temp, sync, rename, directory +//! sync) before the checkpoint it is bound to. Layout, little-endian: +//! `magic "SSX1" | u16 version = 1 | u16 reserved = 0 | binding[32] | +//! u64 replay_segment | u64 replay_offset | u64 count | +//! count x (digest[32] | u64 segment | u64 offset | u32 len) | sha256[32]`, entries in +//! strictly increasing digest order, the trailing digest over +//! `"SYNAPSE_SEGMENT_INDEX_V1\0" || every preceding byte`. `binding` is the digest of the +//! checkpoint file the index belongs to ([`checkpoint_binding`]), so an index written +//! just before a crash that kept the older checkpoint is never used with it. + +use super::*; +use std::os::unix::fs::FileExt; + +/// Marker frame version in `wal.log` for the segment layout (version 2 is the WAL v2 +/// marker of the single-file layout). Binaries that predate A2 refuse version 3 +/// (`WalVersionUnsupported`) instead of missing segments 2 and up. +pub const WAL_SEGMENT_MARKER_VERSION: u16 = 3; +/// File name prefix of segment index files. +pub const SEGMENT_INDEX_PREFIX: &str = "wal.v2.index."; +/// Segment index magic. +pub const SEGMENT_INDEX_MAGIC: [u8; 4] = *b"SSX1"; +/// Segment index format version. +pub const SEGMENT_INDEX_VERSION: u16 = 1; +/// Domain tag of the segment index trailer digest. +pub const DOMAIN_SEGMENT_INDEX: &[u8] = b"SYNAPSE_SEGMENT_INDEX_V1\0"; +/// Domain tag of the checkpoint binding digest. +pub const DOMAIN_SEGMENT_BINDING: &[u8] = b"SYNAPSE_SEGMENT_CHECKPOINT_BINDING_V1\0"; + +const INDEX_HEADER_LEN: usize = 64; +const INDEX_ENTRY_LEN: usize = 52; + +/// File name of segment `id` (`id >= 1`). +pub fn segment_file_name(id: u64) -> String { + if id == 1 { + wal2::WAL_V2_FILE.to_string() + } else { + format!("wal.v2.{id:06}.log") + } +} + +/// Segment id of a file name, if it is one in canonical form. +pub fn parse_segment_file_name(name: &str) -> Option { + if name == wal2::WAL_V2_FILE { + return Some(1); + } + let digits = name.strip_prefix("wal.v2.")?.strip_suffix(".log")?; + if digits.len() < 6 || !digits.bytes().all(|b| b.is_ascii_digit()) { + return None; + } + let id: u64 = digits.parse().ok()?; + (id >= 2 && segment_file_name(id) == name).then_some(id) +} + +/// Ids of the segment files present in `root`, ascending. +pub(crate) fn list_segments(root: &Path) -> SynapseResult> { + let mut ids = Vec::new(); + for entry in fs::read_dir(root).map_err(io_err)? { + let entry = entry.map_err(io_err)?; + if let Some(id) = entry.file_name().to_str().and_then(parse_segment_file_name) { + ids.push(id); + } + } + ids.sort_unstable(); + Ok(ids) +} + +/// Location of one blob inside a segment. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub(crate) struct BlobLoc { + pub segment: u64, + pub offset: u64, + pub len: u32, +} + +/// Digest that binds a segment index to one checkpoint file's exact bytes. +pub(crate) fn binding_of(checkpoint: Option<(&str, &[u8])>) -> [u8; 32] { + let mut h = Sha256::new(); + h.update(DOMAIN_SEGMENT_BINDING); + match checkpoint { + Some((name, bytes)) => { + h.update([1u8]); + h.update((name.len() as u32).to_le_bytes()); + h.update(name.as_bytes()); + h.update(bytes); + } + None => h.update([0u8]), + } + h.finalize().into() +} + +/// Binding of the checkpoint on disk: `checkpoint.v2` when present, else a +/// `checkpoint.v1` that is not the tombstone, else none. +pub(crate) fn checkpoint_binding(root: &Path) -> SynapseResult<[u8; 32]> { + let v2 = root.join(codec::CHECKPOINT_V2_FILE); + if v2.exists() { + let bytes = fs::read(&v2).map_err(io_err)?; + return Ok(binding_of(Some((codec::CHECKPOINT_V2_FILE, &bytes)))); + } + let v1 = root.join("checkpoint.v1"); + if v1.exists() { + let bytes = fs::read(&v1).map_err(io_err)?; + if bytes != codec::v1_tombstone_bytes() { + return Ok(binding_of(Some(("checkpoint.v1", &bytes)))); + } + } + Ok(binding_of(None)) +} + +/// The segment index persisted next to a checkpoint. +#[derive(Debug, Clone, PartialEq, Eq)] +pub(crate) struct SegmentIndex { + /// [`binding_of`] the checkpoint this index belongs to. + pub binding: [u8; 32], + /// Replay starts at this segment and byte offset: everything before it is covered + /// by the checkpoint. + pub replay_segment: u64, + pub replay_offset: u64, + /// Locations of the blobs the checkpoint retains that live in segment bytes before + /// the replay position. + pub entries: BTreeMap, +} + +fn index_corrupt(what: &str) -> SynapseError { + SynapseError::new( + RefusalCode::CheckpointCorrupt, + format!("segment index: {what}"), + ) +} + +fn index_digest(bytes: &[u8]) -> [u8; 32] { + let mut h = Sha256::new(); + h.update(DOMAIN_SEGMENT_INDEX); + h.update(bytes); + h.finalize().into() +} + +impl SegmentIndex { + /// File name of the index bound to `binding`. + pub fn file_name(binding: &[u8; 32]) -> String { + format!("{SEGMENT_INDEX_PREFIX}{}", hex::encode(&binding[..8])) + } + + pub fn encode(&self) -> Vec { + let mut b = + Vec::with_capacity(INDEX_HEADER_LEN + self.entries.len() * INDEX_ENTRY_LEN + 32); + b.extend_from_slice(&SEGMENT_INDEX_MAGIC); + b.extend_from_slice(&SEGMENT_INDEX_VERSION.to_le_bytes()); + b.extend_from_slice(&0u16.to_le_bytes()); + b.extend_from_slice(&self.binding); + b.extend_from_slice(&self.replay_segment.to_le_bytes()); + b.extend_from_slice(&self.replay_offset.to_le_bytes()); + b.extend_from_slice(&(self.entries.len() as u64).to_le_bytes()); + for (d, loc) in &self.entries { + b.extend_from_slice(&d.0); + b.extend_from_slice(&loc.segment.to_le_bytes()); + b.extend_from_slice(&loc.offset.to_le_bytes()); + b.extend_from_slice(&loc.len.to_le_bytes()); + } + let sha = index_digest(&b); + b.extend_from_slice(&sha); + b + } + + /// Strict decoder: one encoding per index; every failure is `CheckpointCorrupt`. + pub fn decode(bytes: &[u8]) -> SynapseResult { + if bytes.len() < INDEX_HEADER_LEN + 32 { + return Err(index_corrupt("shorter than its header")); + } + let (body, trailer) = bytes.split_at(bytes.len() - 32); + if index_digest(body) != trailer { + return Err(index_corrupt("digest mismatch")); + } + if body[0..4] != SEGMENT_INDEX_MAGIC { + return Err(index_corrupt("bad magic")); + } + if u16::from_le_bytes([body[4], body[5]]) != SEGMENT_INDEX_VERSION || body[6..8] != [0, 0] { + return Err(index_corrupt("unsupported version or reserved bytes")); + } + let u64_at = |at: usize| u64::from_le_bytes(body[at..at + 8].try_into().expect("8")); + let binding: [u8; 32] = body[8..40].try_into().expect("32"); + let replay_segment = u64_at(40); + let replay_offset = u64_at(48); + let count = u64_at(56); + let expected = (count as u128) * INDEX_ENTRY_LEN as u128 + INDEX_HEADER_LEN as u128; + if expected != body.len() as u128 { + return Err(index_corrupt("entry count does not match the length")); + } + if replay_segment == 0 || replay_offset % wal2::WAL_V2_ALIGN != 0 { + return Err(index_corrupt("invalid replay position")); + } + let mut entries = BTreeMap::new(); + let mut prev: Option = None; + for e in body[INDEX_HEADER_LEN..].as_chunks::().0 { + let d = BlobDigest(e[0..32].try_into().expect("32")); + if prev.is_some_and(|p| p >= d) { + return Err(index_corrupt("entries not in strictly increasing order")); + } + prev = Some(d); + let loc = BlobLoc { + segment: u64::from_le_bytes(e[32..40].try_into().expect("8")), + offset: u64::from_le_bytes(e[40..48].try_into().expect("8")), + len: u32::from_le_bytes(e[48..52].try_into().expect("4")), + }; + let end = loc.offset.checked_add(u64::from(loc.len)); + let before_replay = + (loc.segment, end.unwrap_or(u64::MAX)) <= (replay_segment, replay_offset); + if loc.segment == 0 || end.is_none() || !before_replay { + return Err(index_corrupt("entry outside the covered segment bytes")); + } + entries.insert(d, loc); + } + Ok(Self { + binding, + replay_segment, + replay_offset, + entries, + }) + } + + /// Write atomically (temp file, sync, rename, directory sync); returns the file name. + pub fn write(&self, root: &Path) -> SynapseResult { + let name = Self::file_name(&self.binding); + write_file_atomic( + root, + &root.join(format!("{name}.tmp")), + &root.join(&name), + &self.encode(), + )?; + Ok(name) + } + + /// Load the index bound to `binding` (`CheckpointCorrupt` when missing or invalid). + pub fn load(root: &Path, binding: &[u8; 32]) -> SynapseResult { + let name = Self::file_name(binding); + let bytes = fs::read(root.join(&name)).map_err(|e| { + index_corrupt(&format!( + "{name} for the checkpoint on disk cannot be read: {e}" + )) + })?; + let index = Self::decode(&bytes)?; + if &index.binding != binding { + return Err(index_corrupt(&format!( + "{name} is bound to a different checkpoint" + ))); + } + Ok(index) + } +} + +/// Remove every segment index file (and leftover temp file) except `keep`. Index files +/// are metadata: this never touches segment data. +pub(crate) fn remove_other_indexes(root: &Path, keep: &str) -> SynapseResult<()> { + let mut removed = false; + for entry in fs::read_dir(root).map_err(io_err)? { + let entry = entry.map_err(io_err)?; + let name = entry.file_name(); + let Some(name) = name.to_str() else { continue }; + if name.starts_with(SEGMENT_INDEX_PREFIX) && name != keep { + fs::remove_file(entry.path()).map_err(io_err)?; + removed = true; + } + } + if removed { + sync_dir(root)?; + } + Ok(()) +} + +/// Faults injected into the next segment rotation (test hooks). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub(crate) enum RotationFault { + None, + /// Create and pre-write the new segment, then exit the process with `code` before + /// the directory flush. + CrashBeforeDirSync { + code: i32, + }, + /// The directory flush after creating the new segment fails. + FailDirSync, +} + +/// Durability events of the segment writer, in order (test camera). +#[cfg(test)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub(crate) enum SegEvent { + /// A new segment file was created. + Created(u64), + /// The segment file's data and size were synced (`sync_all`). + FileSynced(u64), + /// The store directory was flushed after this segment was created or opened. + DirSynced(u64), + /// A batch write into this segment started. + BatchWrite(u64), + /// A batch in this segment was written and `fdatasync` returned success. + BatchDurable(u64), +} + +/// Writer of the active segment, rotating to new segment files. +#[derive(Debug)] +pub(crate) struct SegmentLog { + root: PathBuf, + active: u64, + writer: wal2::WalV2Writer, + segment_bytes: u64, + chunk: u64, + #[cfg(test)] + pub trace: Vec, +} + +impl SegmentLog { + /// Open the active segment `active` with the log ending at `write_offset`. The file + /// is synced and the directory flushed before anything is written into it. + pub fn open( + root: &Path, + active: u64, + write_offset: u64, + segment_bytes: u64, + chunk: u64, + ) -> SynapseResult { + let segment_bytes = segment_bytes.max(wal2::WAL_V2_ALIGN); + let chunk = chunk.min(segment_bytes); + let path = root.join(segment_file_name(active)); + let mut writer = wal2::WalV2Writer::open(&path, write_offset, chunk)?; + writer.set_prewrite_cap(segment_bytes); + // The file may come from a process that died before flushing the directory + // entry: make both durable before the first batch lands in it. + writer.sync_all()?; + sync_dir(root)?; + Ok(Self { + root: root.to_path_buf(), + active, + writer, + segment_bytes, + chunk, + #[cfg(test)] + trace: vec![SegEvent::FileSynced(active), SegEvent::DirSynced(active)], + }) + } + + pub fn active(&self) -> u64 { + self.active + } + + pub fn write_offset(&self) -> u64 { + self.writer.write_offset + } + + /// Make room for a batch of `len` bytes and return `(segment, offset)` where it + /// goes. Rotates when the active segment holds data and the batch would end past + /// the segment size: the new file is created, zero-filled, synced, and the + /// directory flushed before this returns. On failure nothing was written into any + /// log extent and the active segment is unchanged. + pub fn reserve( + &mut self, + len: u64, + fault: RotationFault, + ) -> Result<(u64, u64), wal2::BatchFailure> { + let at = self.writer.write_offset; + if at == 0 || at.saturating_add(len) <= self.segment_bytes { + return Ok((self.active, at)); + } + let id = self.active + 1; + let fail = |e: std::io::Error| { + wal2::BatchFailure::RolledBack(SynapseError::new( + RefusalCode::IoFailure, + format!("create segment {id}: {e}"), + )) + }; + // A file with this id can only be one an earlier failed rotation of this + // process created (or an all-zero one recovery verified): never acknowledged + // data, so it is truncated and pre-written again. + let file = OpenOptions::new() + .create(true) + .truncate(true) + .read(true) + .write(true) + .open(self.root.join(segment_file_name(id))) + .map_err(fail)?; + #[cfg(test)] + self.trace.push(SegEvent::Created(id)); + let mut writer = wal2::WalV2Writer::new_empty(file, self.chunk, self.segment_bytes); + writer.ensure_space(len).map_err(fail)?; + #[cfg(test)] + self.trace.push(SegEvent::FileSynced(id)); + match fault { + RotationFault::None => {} + RotationFault::CrashBeforeDirSync { code } => std::process::exit(code), + RotationFault::FailDirSync => { + return Err(fail(std::io::Error::other( + "injected fault: directory flush failed", + ))) + } + } + File::open(&self.root) + .and_then(|d| d.sync_all()) + .map_err(fail)?; + #[cfg(test)] + self.trace.push(SegEvent::DirSynced(id)); + self.writer = writer; + self.active = id; + Ok((id, 0)) + } + + /// Write one batch at the reserved position: one write, one `fdatasync`. + pub fn write_batch( + &mut self, + buf: &[u8], + fault: wal2::BatchIoFault, + ) -> Result<(), wal2::BatchFailure> { + #[cfg(test)] + self.trace.push(SegEvent::BatchWrite(self.active)); + self.writer.write_batch(buf, fault)?; + #[cfg(test)] + self.trace.push(SegEvent::BatchDurable(self.active)); + Ok(()) + } + + pub fn sync(&self) -> SynapseResult<()> { + self.writer.sync() + } +} + +/// Read `len` bytes at `offset` of an open segment file. +pub(crate) fn read_at(f: &File, offset: u64, len: u32) -> std::io::Result> { + let mut bytes = vec![0u8; len as usize]; + f.read_exact_at(&mut bytes, offset)?; + Ok(bytes) +} diff --git a/crates/synapse-store/src/segment_tests.rs b/crates/synapse-store/src/segment_tests.rs new file mode 100644 index 0000000..971cb15 --- /dev/null +++ b/crates/synapse-store/src/segment_tests.rs @@ -0,0 +1,715 @@ +//! ADR 0003 A2 segment store tests: the extended crash suite of issue #23. +//! +//! Acceptance under test: torn segment, crash between payload and index, flush failure, +//! crash after a new segment file before its directory flush; every acknowledged change +//! survives each of them. The stores here use 64 KiB segments so a few changesets of +//! about 6 KB cross several segment files. Process crashes run the test binary again as +//! a child that terminates itself at the injected fault (exit code +//! [`FAULT_CRASH_EXIT_CODE`]); the child records every acknowledgment in `acks.txt` +//! right after the store returns it. + +use super::a1_tests::{copy_fixture, copy_tree, expect}; +use super::tests::{make_signed_changeset, temp_store_dir}; +use super::*; +use ed25519_dalek::SigningKey; +use segment::SegEvent; +use std::collections::BTreeSet; +use std::process::Command; + +/// Segment size of the test stores. +const SEG: u64 = 64 * 1024; +/// Blob size per changeset: one changeset per batch, one batch = 8 KiB on disk. +const BLOB: usize = 6000; +/// On-disk length of one batch of one changeset (asserted on the first commit). +const PER: u64 = 8192; +const CHILD_ENV: &str = "SYNAPSE_A2_CRASH_CHILD"; +const STRICT: RecoveryPolicy = RecoveryPolicy::StrictFailClosed; +const TRUNCATE: RecoveryPolicy = RecoveryPolicy::TruncateTornTail; + +fn limits() -> StoreLimits { + StoreLimits { + segment_bytes: SEG, + wal_prealloc_bytes: 16 * 1024, + ..Default::default() + } +} + +fn try_open(dir: &Path, recovery: RecoveryPolicy) -> SynapseResult { + SynapseStore::open(dir, FsyncPolicy::GROUP_COMMIT_DEFAULT, recovery, limits()) +} + +fn open(dir: &Path) -> SynapseStore { + try_open(dir, STRICT).unwrap() +} + +fn key(n: u8) -> SigningKey { + SigningKey::from_bytes(&[n; 32]) +} + +/// A signed single-file changeset with distinct content per label. +fn cs(key: &SigningKey, label: &str) -> (ChangesetEnvelope, Vec<(BlobDigest, Vec)>) { + let mut content = format!("// {label}\n").into_bytes(); + let mut x: u8 = label + .bytes() + .fold(11u8, |a, b| a.wrapping_mul(31).wrapping_add(b)); + while content.len() < BLOB { + x = x.wrapping_mul(13).wrapping_add(1); + content.push(b'a' + x % 26); + } + make_signed_changeset( + key, + label, + &format!("src/{label}.rs"), + &content, + vec![], + 1000, + ) +} + +fn committed_seq_of(out: &IngestOutcome) -> WalSeq { + match out { + IngestOutcome::Committed { + wal_seq, + durability, + .. + } => { + assert_eq!(*durability, DurabilityGuarantee::FsyncBeforeAck); + *wal_seq + } + other => panic!("expected Committed, got {other:?}"), + } +} + +fn commit(store: &mut SynapseStore, key: &SigningKey, label: &str) -> WalSeq { + let before = store + .wal_v2 + .as_ref() + .map(|w| (w.active(), w.write_offset())); + let (env, blobs) = cs(key, label); + let seq = committed_seq_of(&store.ingest_changeset(env, &blobs).unwrap()); + if before == Some((1, 0)) { + assert_eq!(offset(store), PER, "one changeset per 8 KiB batch"); + } + seq +} + +fn active(store: &SynapseStore) -> u64 { + store.wal_v2.as_ref().unwrap().active() +} + +fn offset(store: &SynapseStore) -> u64 { + store.wal_v2.as_ref().unwrap().write_offset() +} + +/// True when the next one-changeset batch starts a new segment file. +fn next_rotates(store: &SynapseStore) -> bool { + let at = offset(store); + at > 0 && at + PER > SEG +} + +/// Every changeset and its blobs are readable at the latest snapshot. +fn assert_all_readable(store: &SynapseStore, expected: usize) { + let all = store.list_changesets(None, None, None).unwrap(); + assert_eq!(all.len(), expected, "changeset count"); + for c in &all { + for m in &c.envelope.mutations { + if let MutationOp::Upsert { + blob_digest, + size_bytes, + .. + } = &m.op + { + let bytes = store.get_blob_visible(*blob_digest, None, None).unwrap(); + assert_eq!(bytes.len() as u64, *size_bytes); + } + } + } +} + +fn seg_path(dir: &Path, id: u64) -> PathBuf { + dir.join(segment::segment_file_name(id)) +} + +fn segments(dir: &Path) -> Vec { + segment::list_segments(dir).unwrap() +} + +fn index_files(dir: &Path) -> usize { + fs::read_dir(dir) + .unwrap() + .filter(|e| { + e.as_ref() + .unwrap() + .file_name() + .to_string_lossy() + .starts_with(segment::SEGMENT_INDEX_PREFIX) + }) + .count() +} + +/// Number of regular files under `blobs/` (the v1 file-per-blob layout). +fn blob_files(dir: &Path) -> usize { + fn walk(p: &Path) -> usize { + let Ok(rd) = fs::read_dir(p) else { return 0 }; + rd.map(|e| { + let e = e.unwrap(); + if e.file_type().unwrap().is_dir() { + walk(&e.path()) + } else { + 1 + } + }) + .sum() + } + walk(&dir.join("blobs")) +} + +/// Byte offsets of the batches in a segment file. +fn batch_starts(bytes: &[u8]) -> Vec { + (0..bytes.len()) + .step_by(wal2::WAL_V2_ALIGN as usize) + .filter(|&o| { + bytes + .get(o..o + wal2::WAL_V2_BATCH_HEADER_LEN) + .and_then(wal2::parse_batch_header) + .is_some() + }) + .collect() +} + +/// Position of the first `ev` in the durability trace. +fn pos(trace: &[SegEvent], ev: SegEvent) -> Option { + trace.iter().position(|e| *e == ev) +} + +/// In a new segment `k`, the file is created, then synced, then the directory flushed, +/// and only then does a batch write start in it. +fn assert_dir_flush_before_first_batch(trace: &[SegEvent], k: u64) { + let created = pos(trace, SegEvent::Created(k)).expect("segment created"); + let synced = pos(trace, SegEvent::FileSynced(k)).expect("segment file synced"); + let dir = pos(trace, SegEvent::DirSynced(k)) + .unwrap_or_else(|| panic!("no directory flush for segment {k}: {trace:?}")); + let write = pos(trace, SegEvent::BatchWrite(k)).expect("batch written"); + assert!( + created < synced && synced < dir && dir < write, + "segment {k}: create {created}, sync {synced}, dir flush {dir}, first batch {write}: {trace:?}" + ); +} + +// --- crash child plumbing -------------------------------------------------- + +fn child_dir() -> Option { + std::env::var(CHILD_ENV).ok().map(PathBuf::from) +} + +/// Run `test` again in a child process on a new store dir; it must crash at the fault. +fn run_crash_child(test: &str, label: &str) -> PathBuf { + let dir = temp_store_dir(label); + let status = Command::new(std::env::current_exe().expect("test binary path")) + .arg("--exact") + .arg(format!("segment_tests::{test}")) + .arg("--nocapture") + .env(CHILD_ENV, &dir) + .status() + .expect("spawn child process"); + assert_eq!( + status.code(), + Some(FAULT_CRASH_EXIT_CODE), + "the child must terminate at the injected fault" + ); + dir +} + +fn record_ack(dir: &Path, seq: WalSeq) { + let mut f = OpenOptions::new() + .create(true) + .append(true) + .open(dir.join("acks.txt")) + .unwrap(); + f.write_all(format!("{}\n", seq.0).as_bytes()).unwrap(); +} + +fn acks(dir: &Path) -> BTreeSet { + fs::read_to_string(dir.join("acks.txt")) + .unwrap_or_default() + .lines() + .map(|l| l.parse().unwrap()) + .collect() +} + +fn commit_acked(store: &mut SynapseStore, dir: &Path, key: &SigningKey, label: &str) { + let seq = commit(store, key, label); + record_ack(dir, seq); +} + +/// Child side: attempt one more commit with `fault` armed; the fault ends the process. +fn crash_on_commit( + store: &mut SynapseStore, + key: &SigningKey, + label: &str, + fault: FaultInjection, +) -> ! { + store.set_fault_injection(fault); + let (env, blobs) = cs(key, label); + let r = store.ingest_changeset(env, &blobs); + panic!("the injected fault did not end the process: {r:?}"); +} + +// --- torn segment ---------------------------------------------------------- + +/// Crash in the middle of a batch in segment 2: strict recovery refuses the torn tail, +/// truncating recovery drops it, and every acknowledged change survives. +#[test] +fn a2_torn_segment_crash_mid_batch_keeps_every_ack() { + if let Some(dir) = child_dir() { + let key = key(81); + let mut s = open(&dir); + for i in 0..12 { + commit_acked(&mut s, &dir, &key, &format!("torn-{i}")); + } + assert_eq!(active(&s), 2); + crash_on_commit( + &mut s, + &key, + "torn-crash", + FaultInjection::CrashMidBatchWrite { + bytes_written: 3000, + }, + ); + } + let dir = run_crash_child("a2_torn_segment_crash_mid_batch_keeps_every_ack", "a2-torn"); + assert_eq!(acks(&dir), (1..=12).collect::>()); + assert_eq!(segments(&dir), vec![1, 2]); + + let err = try_open(&dir, STRICT) + .err() + .expect("strict recovery must refuse the torn batch"); + assert_eq!(err.code, RefusalCode::WalTornFrame, "{err:?}"); + let store = try_open(&dir, TRUNCATE).unwrap(); + assert_eq!(store.torn_frames_truncated_on_open(), 1); + assert_eq!(store.committed_seq(), WalSeq(12), "no lost ack, no phantom"); + assert_all_readable(&store, 12); + drop(store); + { + let mut s = open(&dir); + assert_eq!(commit(&mut s, &key(82), "after-torn"), WalSeq(13)); + } + let store = open(&dir); + assert_eq!(store.committed_seq(), WalSeq(13)); + assert_all_readable(&store, 13); + let _ = fs::remove_dir_all(&dir); +} + +/// The same torn-looking damage is a crash tail only in the last segment holding data. +/// In an earlier segment (data after it in a later segment) it is corruption of +/// acknowledged data and both recovery policies refuse to open. +#[test] +fn a2_torn_segment_with_data_after_it_fails_closed_under_both_policies() { + let dir = temp_store_dir("a2-torn-middle"); + let key = key(83); + { + let mut s = open(&dir); + for i in 0..20 { + commit(&mut s, &key, &format!("mid-{i}")); + } + assert_eq!(active(&s), 3); + } + let tear = |id: u64| -> Vec { + let good = fs::read(seg_path(&dir, id)).unwrap(); + let mut bad = good.clone(); + let last = *batch_starts(&good).last().unwrap(); + bad[last + 3000..last + PER as usize].fill(0); + fs::write(seg_path(&dir, id), &bad).unwrap(); + good + }; + // Segment 2 is full and segment 3 holds data after it. + let good2 = tear(2); + for policy in [STRICT, TRUNCATE] { + assert!( + try_open(&dir, policy).is_err(), + "{policy:?} accepted a torn batch in segment 2 with data in segment 3" + ); + } + fs::write(seg_path(&dir, 2), &good2).unwrap(); + assert_eq!(open(&dir).committed_seq(), WalSeq(20)); + // Control: the same damage in the last segment is a torn tail. + tear(3); + let err = try_open(&dir, STRICT).err().expect("strict refuses"); + assert_eq!(err.code, RefusalCode::WalTornFrame, "{err:?}"); + let store = try_open(&dir, TRUNCATE).unwrap(); + assert_eq!(store.committed_seq(), WalSeq(19)); + assert_all_readable(&store, 19); + let _ = fs::remove_dir_all(&dir); +} + +// --- crash between payload and index --------------------------------------- + +/// Crash after a batch is written and `fdatasync` returned, before the in-memory blob +/// index is updated or anything is acknowledged. On reopen the index is rebuilt from the +/// checkpoint's segment index plus the segments: every acknowledged change survives, the +/// durable unacknowledged change is present with its blob, and a retry is a duplicate. +#[test] +fn a2_crash_between_payload_and_index_keeps_every_ack() { + if let Some(dir) = child_dir() { + let key = key(84); + let mut s = open(&dir); + for i in 0..6 { + commit_acked(&mut s, &dir, &key, &format!("pi-{i}")); + } + s.checkpoint_and_compact(1000).unwrap(); + for i in 6..10 { + commit_acked(&mut s, &dir, &key, &format!("pi-{i}")); + } + assert_eq!(active(&s), 2); + crash_on_commit( + &mut s, + &key, + "pi-pending", + FaultInjection::CrashAfterBatchSyncBeforeIndex, + ); + } + let dir = run_crash_child( + "a2_crash_between_payload_and_index_keeps_every_ack", + "a2-pi", + ); + assert_eq!(acks(&dir), (1..=10).collect::>()); + let mut store = open(&dir); + // The pending batch was durable before the crash: it is kept (never acknowledged, + // so keeping it loses nothing; the caller's retry is idempotent). + assert_eq!(store.committed_seq(), WalSeq(11)); + assert_all_readable(&store, 11); + let (env, blobs) = cs(&key(84), "pi-pending"); + assert!(matches!( + store.ingest_changeset(env, &blobs).unwrap(), + IngestOutcome::IdempotentDuplicate { wal_seq, .. } if wal_seq == WalSeq(11) + )); + store.checkpoint_and_compact(1000).unwrap(); + drop(store); + let store = open(&dir); + assert_eq!(store.committed_seq(), WalSeq(11)); + assert_all_readable(&store, 11); + assert_eq!(blob_files(&dir), 0, "blobs stay in the segments"); + let _ = fs::remove_dir_all(&dir); +} + +/// Crash after the checkpoint's segment index file is written, before the checkpoint +/// replaces the previous one: the old checkpoint and its own index still describe the +/// store, every acknowledged change survives, and the next checkpoint removes the +/// orphan index. +#[test] +fn a2_crash_after_segment_index_before_checkpoint_keeps_every_ack() { + if let Some(dir) = child_dir() { + let key = key(85); + let mut s = open(&dir); + for i in 0..6 { + commit_acked(&mut s, &dir, &key, &format!("ix-{i}")); + } + s.checkpoint_and_compact(1000).unwrap(); + for i in 6..10 { + commit_acked(&mut s, &dir, &key, &format!("ix-{i}")); + } + s.set_fault_injection(FaultInjection::CrashAfterSegmentIndexBeforeCheckpoint); + let r = s.checkpoint_and_compact(1000); + panic!("the injected fault did not end the process: {r:?}"); + } + let dir = run_crash_child( + "a2_crash_after_segment_index_before_checkpoint_keeps_every_ack", + "a2-ix", + ); + assert_eq!(acks(&dir), (1..=10).collect::>()); + assert_eq!(index_files(&dir), 2, "old index and the orphan new one"); + let mut store = open(&dir); + assert_eq!(store.committed_seq(), WalSeq(10)); + assert_all_readable(&store, 10); + store.checkpoint_and_compact(1000).unwrap(); + assert_eq!(index_files(&dir), 1); + assert_eq!(commit(&mut store, &key(86), "ix-after"), WalSeq(11)); + drop(store); + let store = open(&dir); + assert_eq!(store.committed_seq(), WalSeq(11)); + assert_all_readable(&store, 11); + let _ = fs::remove_dir_all(&dir); +} + +// --- flush failure ----------------------------------------------------------- + +fn flush_failure_case(label: &str, fault: FaultInjection) { + let dir = temp_store_dir(label); + let key = key(87); + { + let mut s = open(&dir); + while s.committed_seq() == WalSeq(0) || !next_rotates(&s) { + let n = s.committed_seq().0; + commit(&mut s, &key, &format!("{label}-{n}")); + } + assert_eq!(s.committed_seq(), WalSeq(8)); + let root = s.state_root_digest(None).unwrap(); + s.set_fault_injection(fault); + let (env, blobs) = cs(&key, &format!("{label}-x")); + let err = s + .ingest_changeset(env, &blobs) + .expect_err("a failed flush acknowledges nothing"); + assert_eq!(err.code, RefusalCode::IoFailure); + assert_eq!(s.committed_seq(), WalSeq(8)); + assert_eq!(s.state_root_digest(None).unwrap(), root); + assert!(s.poisoned().is_none()); + let trace = &s.wal_v2.as_ref().unwrap().trace; + if fault == FaultInjection::FailNextSegmentDirSync { + assert!(pos(trace, SegEvent::DirSynced(2)).is_none(), "{trace:?}"); + assert!(pos(trace, SegEvent::BatchWrite(2)).is_none(), "{trace:?}"); + assert_eq!(active(&s), 1, "the failed rotation leaves segment 1 active"); + } + assert!(pos(trace, SegEvent::BatchDurable(2)).is_none(), "{trace:?}"); + } + // Nothing of the failed attempt survives a reopen; the retry commits exactly once. + { + let mut s = open(&dir); + assert_eq!(s.committed_seq(), WalSeq(8)); + assert_all_readable(&s, 8); + assert_eq!(commit(&mut s, &key, &format!("{label}-x")), WalSeq(9)); + let (env, blobs) = cs(&key, &format!("{label}-x")); + assert!(matches!( + s.ingest_changeset(env, &blobs).unwrap(), + IngestOutcome::IdempotentDuplicate { .. } + )); + assert_eq!(active(&s), 2); + assert_dir_flush_before_first_batch(&s.wal_v2.as_ref().unwrap().trace, 2); + } + let store = open(&dir); + assert_eq!(store.committed_seq(), WalSeq(9)); + assert_all_readable(&store, 9); + let _ = fs::remove_dir_all(&dir); +} + +/// The directory flush after a new segment file is created fails: the batch is not +/// written, nothing is acknowledged, and the retry commits once. +#[test] +fn a2_flush_failure_directory_flush_of_new_segment_acks_nothing() { + flush_failure_case("a2-flush-dir", FaultInjection::FailNextSegmentDirSync); +} + +/// The `fdatasync` of the first batch in a new segment fails: it is rolled back, +/// nothing is acknowledged, and the retry commits once. +#[test] +fn a2_flush_failure_batch_sync_in_new_segment_acks_nothing() { + flush_failure_case("a2-flush-batch", FaultInjection::FailNextBatchSync); +} + +// --- crash after a new segment file before its directory flush --------------- + +/// Crash after segment 2 is created and pre-written, before the directory flush. After +/// a power loss its directory entry may survive (file kept), survive without its size +/// (empty file) or be lost (no file): every case reopens strictly with every +/// acknowledged change, and the next commit flushes the directory before writing. +#[test] +fn a2_crash_after_new_segment_file_before_directory_flush_keeps_every_ack() { + if let Some(dir) = child_dir() { + let key = key(88); + let mut s = open(&dir); + while s.committed_seq() == WalSeq(0) || !next_rotates(&s) { + let n = s.committed_seq().0; + commit_acked(&mut s, &dir, &key, &format!("nd-{n}")); + } + crash_on_commit( + &mut s, + &key, + "nd-lost", + FaultInjection::CrashAfterSegmentCreateBeforeDirSync, + ); + } + let dir = run_crash_child( + "a2_crash_after_new_segment_file_before_directory_flush_keeps_every_ack", + "a2-nodirflush", + ); + assert_eq!(acks(&dir), (1..=8).collect::>()); + assert_eq!(segments(&dir), vec![1, 2], "segment 2 was created"); + let variants = ["file kept", "file empty", "file lost"]; + for (n, variant) in variants.iter().enumerate() { + let d = temp_store_dir(&format!("a2-nodirflush-{n}")); + copy_tree(&dir, &d); + match n { + 0 => {} + 1 => fs::write(seg_path(&d, 2), b"").unwrap(), + _ => fs::remove_file(seg_path(&d, 2)).unwrap(), + } + { + let mut s = try_open(&d, STRICT) + .unwrap_or_else(|e| panic!("{variant}: strict reopen failed: {e:?}")); + assert_eq!(s.committed_seq(), WalSeq(8), "{variant}"); + assert_all_readable(&s, 8); + assert_eq!(commit(&mut s, &key(88), "nd-lost"), WalSeq(9), "{variant}"); + assert_eq!(active(&s), 2, "{variant}"); + assert_dir_flush_before_first_batch(&s.wal_v2.as_ref().unwrap().trace, 2); + } + let store = open(&d); + assert_eq!(store.committed_seq(), WalSeq(9), "{variant}"); + assert_all_readable(&store, 9); + let _ = fs::remove_dir_all(&d); + } + let _ = fs::remove_dir_all(&dir); +} + +/// Durability camera: in every new segment the directory flush precedes the first batch, +/// and a reopened store syncs its active segment file and the directory before writing. +#[test] +fn a2_directory_flush_precedes_every_batch_in_a_new_segment() { + let dir = temp_store_dir("a2-camera"); + let key = key(89); + { + let mut s = open(&dir); + for i in 0..20 { + commit(&mut s, &key, &format!("cam-{i}")); + } + assert_eq!(active(&s), 3); + let trace = &s.wal_v2.as_ref().unwrap().trace; + for k in 2..=3 { + assert_dir_flush_before_first_batch(trace, k); + } + } + let mut s = open(&dir); + commit(&mut s, &key, "cam-reopen"); + let trace = &s.wal_v2.as_ref().unwrap().trace; + assert_eq!( + trace[..3], + [ + SegEvent::FileSynced(3), + SegEvent::DirSynced(3), + SegEvent::BatchWrite(3) + ], + "{trace:?}" + ); + let _ = fs::remove_dir_all(&dir); +} + +// --- layout ----------------------------------------------------------------- + +/// A checkpoint keeps the blobs in the segments: no blob files, segment bytes untouched, +/// blobs readable across segments after reopen, and one segment index left. +#[test] +fn a2_checkpoint_keeps_blobs_in_segments_across_reopen() { + let dir = temp_store_dir("a2-ckpt"); + let key = key(90); + let (root, before); + { + let mut s = open(&dir); + for i in 0..20 { + commit(&mut s, &key, &format!("ck-{i}")); + } + before = segments(&dir) + .into_iter() + .map(|id| fs::read(seg_path(&dir, id)).unwrap()) + .collect::>(); + root = s.state_root_digest(None).unwrap(); + s.checkpoint_and_compact(1000).unwrap(); + assert_all_readable(&s, 20); + } + assert_eq!(blob_files(&dir), 0, "no file per blob"); + for (i, old) in before.iter().enumerate() { + let now = fs::read(seg_path(&dir, i as u64 + 1)).unwrap(); + assert_eq!(now[..old.len()], old[..], "segment {} rewritten", i + 1); + } + { + let mut s = open(&dir); + assert_eq!(s.committed_seq(), WalSeq(20)); + assert_eq!(s.state_root_digest(None).unwrap(), root); + assert_all_readable(&s, 20); + for i in 20..25 { + commit(&mut s, &key, &format!("ck-{i}")); + } + s.checkpoint_and_compact(1000).unwrap(); + } + let store = open(&dir); + assert_eq!(store.committed_seq(), WalSeq(25)); + assert_all_readable(&store, 25); + assert_eq!(index_files(&dir), 1); + assert_eq!(blob_files(&dir), 0); + assert_eq!(segments(&dir), vec![1, 2, 3, 4]); + let _ = fs::remove_dir_all(&dir); +} + +/// Stores written before A2 (v1 file-per-blob, single-file WAL v2) still replay, switch +/// to the segment layout on open, and keep their state across new segments. +#[test] +fn a2_pre_a2_stores_replay_and_switch_to_segments() { + for name in ["v1-wal-log", "v1-wal-v2-log"] { + let dir = copy_fixture(name); + let ex = expect(name); + let key = key(91); + { + let mut s = open(&dir); + assert_eq!(s.log_layout, LogLayout::Segments, "{name}"); + assert_eq!(s.committed_seq(), WalSeq(ex.committed_seq), "{name}"); + assert_eq!(s.state_root_digest(None).unwrap(), ex.state_root, "{name}"); + for i in 0..10 { + commit(&mut s, &key, &format!("{name}-{i}")); + } + assert!(active(&s) >= 2, "{name}"); + s.checkpoint_and_compact(1000).unwrap(); + } + let store = open(&dir); + assert_eq!( + store.committed_seq(), + WalSeq(ex.committed_seq + 10), + "{name}" + ); + let all = store.list_changesets(None, None, None).unwrap(); + assert!(all.len() >= 10, "{name}"); + assert_all_readable(&store, all.len()); + let _ = fs::remove_dir_all(&dir); + } +} + +/// The segment index decoder is strict: it round-trips, and a flipped bit, a truncated +/// file, an entry not before the replay position, or unsorted entries are refused as +/// `CheckpointCorrupt` (recovery then refuses to open rather than guess blob locations). +#[test] +fn a2_segment_index_round_trips_and_refuses_damage() { + let loc = |segment, offset, len| segment::BlobLoc { + segment, + offset, + len, + }; + let index = segment::SegmentIndex { + binding: [7u8; 32], + replay_segment: 3, + replay_offset: 8192, + entries: [ + (BlobDigest([1u8; 32]), loc(1, 4096, 100)), + (BlobDigest([2u8; 32]), loc(3, 0, 8000)), + ] + .into_iter() + .collect(), + }; + let bytes = index.encode(); + assert_eq!(segment::SegmentIndex::decode(&bytes).unwrap(), index); + let refused = |b: &[u8]| { + assert_eq!( + segment::SegmentIndex::decode(b).unwrap_err().code, + RefusalCode::CheckpointCorrupt + ) + }; + for at in [0, 5, 45, bytes.len() / 2, bytes.len() - 1] { + let mut bad = bytes.clone(); + bad[at] ^= 0x01; + refused(&bad); + } + refused(&bytes[..bytes.len() - 1]); + // An entry ending past the replay position (bytes recovery would also replay). + let mut past = index.clone(); + past.entries + .insert(BlobDigest([3u8; 32]), loc(3, 4096, 4097)); + refused(&past.encode()); + // Entries out of order: swap the two encoded entries and fix the trailing digest. + let header = bytes.len() - 32 - 2 * 52; + let mut swapped = bytes[..bytes.len() - 32].to_vec(); + let (a, b) = swapped[header..].split_at_mut(52); + a.swap_with_slice(b); + let digest: [u8; 32] = { + let mut h = Sha256::new(); + h.update(segment::DOMAIN_SEGMENT_INDEX); + h.update(&swapped); + h.finalize().into() + }; + swapped.extend_from_slice(&digest); + refused(&swapped); +} diff --git a/crates/synapse-store/src/wal2.rs b/crates/synapse-store/src/wal2.rs index 7af1340..0b590c2 100644 --- a/crates/synapse-store/src/wal2.rs +++ b/crates/synapse-store/src/wal2.rs @@ -1,4 +1,6 @@ -//! WAL v2 (`wal.v2.log`): pre-written log of 4 KiB-aligned batches with inline blobs. +//! WAL v2: pre-written log of 4 KiB-aligned batches with inline blobs. Since ADR 0003 A2 +//! the log is a sequence of segment files (`wal.v2.log`, then `wal.v2.000002.log`, ...; +//! see [`crate::segment`]), each in the format below. //! //! Why: on this host's ext4/NVMe, writing into space that is already written and synced //! and then calling `fdatasync` measured 0.81 to 1.11 ms median (4 KiB to 1 MiB), while @@ -9,7 +11,7 @@ //! instead of one file each, and commits a whole batch with one `pwrite` and one //! `fdatasync`. //! -//! Layout: +//! Layout (per segment file): //! * The file is zero-filled ahead of the write position in chunks (`sync_all` after //! each extension, so size and blocks are durable before any batch lands there). //! * A batch starts at a 4 KiB-aligned offset with a 64-byte batch header @@ -323,6 +325,7 @@ pub(crate) enum FrameFault { /// Builds one batch buffer: header, frames, zero padding to 4 KiB. pub(crate) struct BatchBuilder { buf: Vec, + segment: u64, base_offset: u64, count: u32, first_seq: Option, @@ -332,16 +335,19 @@ pub(crate) struct BatchBuilder { pub(crate) struct PlacedFrame { pub seq: WalSeq, pub frame_sha256: [u8; 32], - /// Absolute file offset of the frame payload. + /// Segment file holding the frame (ADR 0003 A2; segment 1 is `wal.v2.log`). + pub segment: u64, + /// Absolute offset of the frame payload inside its segment file. pub payload_offset: u64, } impl BatchBuilder { - pub fn new(base_offset: u64, capacity: usize) -> Self { + pub fn new(segment: u64, base_offset: u64, capacity: usize) -> Self { let mut buf = Vec::with_capacity(capacity + WAL_V2_ALIGN as usize); buf.resize(WAL_V2_BATCH_HEADER_LEN, 0); Self { buf, + segment, base_offset, count: 0, first_seq: None, @@ -388,6 +394,7 @@ impl BatchBuilder { PlacedFrame { seq, frame_sha256: sha, + segment: self.segment, payload_offset, } } @@ -425,6 +432,11 @@ pub(crate) enum BatchIoFault { CrashBeforeSync { code: i32, }, + /// Write and `fdatasync` everything, then exit the process with `code` before the + /// caller updates its index or acknowledges anything (payload durable, index not). + CrashAfterSync { + code: i32, + }, /// Write and sync the first `n` bytes, then stop as if the process had died: no /// rollback, and the store refuses further writes until reopened. TornThenStop { @@ -448,6 +460,8 @@ pub(crate) struct WalV2Writer { pub write_offset: u64, pub prewritten_end: u64, chunk: u64, + /// Pre-writing ahead stops here (the segment size), unless a batch needs more. + prewrite_cap: u64, } fn injected(msg: &str) -> std::io::Error { @@ -478,17 +492,35 @@ impl WalV2Writer { write_offset, prewritten_end: len.max(write_offset), chunk: chunk.max(WAL_V2_ALIGN), + prewrite_cap: u64::MAX, }; w.ensure_space(WAL_V2_ALIGN).map_err(io_err)?; Ok(w) } + /// A writer over a newly created, empty segment file (nothing pre-written yet). + pub fn new_empty(file: File, chunk: u64, prewrite_cap: u64) -> Self { + Self { + file, + write_offset: 0, + prewritten_end: 0, + chunk: chunk.max(WAL_V2_ALIGN), + prewrite_cap: prewrite_cap.max(WAL_V2_ALIGN), + } + } + + /// Stop pre-writing ahead past `cap` bytes (a batch that needs more still gets it). + pub fn set_prewrite_cap(&mut self, cap: u64) { + self.prewrite_cap = cap.max(WAL_V2_ALIGN); + } + /// Zero-fill and `sync_all` ahead of the write position until `need` bytes fit. pub fn ensure_space(&mut self, need: u64) -> std::io::Result<()> { if self.write_offset + need <= self.prewritten_end { return Ok(()); } - let target = align_up((self.write_offset + need).max(self.prewritten_end + self.chunk)); + let ahead = (self.prewritten_end + self.chunk).min(self.prewrite_cap); + let target = align_up((self.write_offset + need).max(ahead)); let zeros = vec![0u8; 1 << 20]; let mut at = self.prewritten_end; while at < target { @@ -536,6 +568,13 @@ impl WalV2Writer { let _ = self.file.write_all_at(buf, at); std::process::exit(code); } + BatchIoFault::CrashAfterSync { code } => { + let _ = self + .file + .write_all_at(buf, at) + .and_then(|_| self.file.sync_data()); + std::process::exit(code); + } BatchIoFault::TornThenStop { bytes_written } => { let n = bytes_written.min(buf.len().saturating_sub(1)); self.file @@ -577,18 +616,14 @@ impl WalV2Writer { } } - /// Empty the log after a checkpoint and pre-write one chunk again. - pub fn reset(&mut self) -> SynapseResult<()> { - self.file.set_len(0).map_err(io_err)?; - self.file.sync_all().map_err(io_err)?; - self.write_offset = 0; - self.prewritten_end = 0; - self.ensure_space(WAL_V2_ALIGN).map_err(io_err) - } - pub fn sync(&self) -> SynapseResult<()> { self.file.sync_data().map_err(io_err) } + + /// `fsync` data and metadata (size) of the file. + pub fn sync_all(&self) -> SynapseResult<()> { + self.file.sync_all().map_err(io_err) + } } /// A batch read back during recovery. diff --git a/docs/A2_SEGMENT_STORE.md b/docs/A2_SEGMENT_STORE.md new file mode 100644 index 0000000..73595e0 --- /dev/null +++ b/docs/A2_SEGMENT_STORE.md @@ -0,0 +1,209 @@ +# A2: Segment Store Replacing File per Blob + +ADR 0003 section 9 step A2 (issue #23), design in section 5.9. Group-commit stores (WAL v2) now keep +every blob inside append-only segment files for good. Before A2, WAL v2 already wrote blobs inline in +`wal.v2.log`, but every `checkpoint_and_compact` turned the retained inline blobs back into one file +each (`blobs/<2-hex>/<64-hex>`, temporary file, rename, directory flush) and emptied the log. A2 removes +that: no blob file is written for a segment store, and acknowledged segment bytes are never rewritten +or removed. + +## 1. Design + +- **Segments.** Segment 1 is `wal.v2.log` (so a pre-A2 single-file WAL v2 store is simply segment 1); + segment n >= 2 is `wal.v2.{n:06}.log`. Every segment uses the WAL v2 batch format unchanged + (`crates/synapse-store/src/wal2.rs`): 4 KiB-aligned batches of frames with the blobs inline, + written into pre-written zero space. A batch is one `pwrite` plus one `fdatasync`. +- **Rotation.** When the active segment holds data and the next batch would end past + `StoreLimits::segment_bytes` (default 256 MiB), the writer creates the next file, zero-fills it, + `sync_all`s it, and flushes the store directory, and only then writes the batch into it. A batch + larger than a segment goes into an empty segment on its own. Reopening a store also syncs the active + segment and flushes the directory before the first write (a file left by a crash before its + directory flush is made durable first). +- **Index.** In memory: `digest -> (segment, offset, length)` for every blob, filled as batches become + durable. On disk, next to each checkpoint: a segment index file `wal.v2.index.<16 hex>` (format `SSX1`, + documented in `crates/synapse-store/src/segment.rs`) holding the replay position (segment, offset) + and the locations of the blobs the checkpoint retains. It is bound to the checkpoint by + `SHA-256("SYNAPSE_SEGMENT_CHECKPOINT_BINDING_V1\0" || checkpoint file name || checkpoint bytes)` and + sealed by a SHA-256 trailer; a missing, damaged, or mismatched index refuses to open + (`CheckpointCorrupt`). Recovery seeds the in-memory index from it and rebuilds the rest by replaying + the segments from the replay position. +- **Checkpoint.** Order: every frame durable; segment index written atomically (temporary file, + rename, directory flush); `checkpoint.v2` renamed into place; `wal.log` replaced by the marker; older + index files removed. Only index metadata is ever removed: segment data is not swept (no garbage + collection before step K1, ADR section 9). Blob reads verify the digest of the bytes read, so a + damaged segment byte under a retained blob is refused on read (`BlobDigestMismatch`). +- **Layout marker.** `wal.log` ends with an 88-byte marker frame (kind `0xFF`); version 3 means the + segment layout, version 2 the single-file WAL v2 layout. A pre-A2 binary refuses version 3 + (`WalVersionUnsupported`), so it can never misread a segment store as single-file. +- **Upgrade.** Opening a v1 store or a single-file WAL v2 store with group commit writes the index + (replay from segment 1, offset 0) and then atomically rewrites `wal.log` with the version 3 marker. + Old WAL logs still replay; v1 blob files stay where they are and stay readable. + +## 2. Durability Contract + +A change is acknowledged only after the `fdatasync` of its batch in its segment returned success, and, +when the batch is the first in a new segment file, after that file was synced and the store directory +flushed. Whether a flush survives power loss (the drive's volatile write cache) is UNVERIFIED; the +guarantee is "survives process crash and kernel crash" (ADR section 5.9). + +Recovery rules for segments: + +- Every segment id from 1 to the last must be present (a missing middle segment is `WalSequenceGap`). +- A torn tail (the last batch written, nothing valid after it, its lost end reading back as zeros) is + accepted only in the last segment that holds data; every later segment must be all zero or empty. + Strict recovery refuses it (`WalTornFrame`); truncating recovery zeroes it. The same damage in an + earlier segment fails closed under both policies. +- A last segment file that is all zero, empty, or missing (crash after its creation, before or after its + directory flush) is not data; the next rotation truncates and pre-writes it again. + +## 3. Acceptance and Tests + +Tests are in `crates/synapse-store/src/segment_tests.rs`, named after the acceptance items. Stores use +64 KiB segments so a few 6 KB changesets cross several segment files. Process crashes rerun the test +binary as a child that terminates itself at the injected fault (exit code 42) and logs every +acknowledgement the moment `ingest_changeset` returns it; the parent then checks that every logged +acknowledgement survives. + +| Acceptance item | Test | What it shows | +| :--- | :--- | :--- | +| Torn segment | `a2_torn_segment_crash_mid_batch_keeps_every_ack` | Crash after 3,000 bytes of a batch in segment 2: strict refuses `WalTornFrame`, truncating recovery keeps all 12 acknowledged changes and nothing else, then new commits and a strict reopen work | +| Torn segment (fail closed) | `a2_torn_segment_with_data_after_it_fails_closed_under_both_policies` | The same torn-looking damage in segment 2 with data in segment 3 refuses to open under both policies; in the last segment it is a torn tail (control) | +| Crash between payload and index | `a2_crash_between_payload_and_index_keeps_every_ack` | Crash after a batch's `fdatasync`, before the in-memory index update and the acknowledgement: all 10 acknowledged changes survive, the durable unacknowledged change is present with a readable blob, and its retry returns `IdempotentDuplicate` | +| Crash between payload and index (checkpoint) | `a2_crash_after_segment_index_before_checkpoint_keeps_every_ack` | Crash after the new segment index is written, before the checkpoint rename: the old checkpoint and its own index still describe the store; all acknowledged changes survive; the next checkpoint removes the orphan index | +| Flush failure | `a2_flush_failure_directory_flush_of_new_segment_acks_nothing`, `a2_flush_failure_batch_sync_in_new_segment_acks_nothing` | A failed directory flush of a new segment, or a failed `fdatasync` of the first batch in it: nothing acknowledged, state root unchanged, store not poisoned; reopen shows nothing of the attempt; the retry commits once | +| Crash after a new segment file before its directory flush | `a2_crash_after_new_segment_file_before_directory_flush_keeps_every_ack` | Crash after segment 2 is created and pre-written, before the directory flush; reopened with the file kept, emptied, and deleted (lost directory entry): all 8 acknowledged changes survive strictly, and the next commit flushes the directory before writing | +| Durability order | `a2_directory_flush_precedes_every_batch_in_a_new_segment` | A test-only trace of the writer: in every new segment, create, then file sync, then directory flush, then the first batch; a reopened store syncs its active segment and the directory before writing | +| File per blob replaced | `a2_checkpoint_keeps_blobs_in_segments_across_reopen` | After checkpoints no file exists under `blobs/`, segment bytes are unchanged, blobs read back across four segments after reopen | +| Old stores readable | `a2_pre_a2_stores_replay_and_switch_to_segments` | The A1 fixtures written by the pre-A2 binary (v1 file-per-blob store, single-file WAL v2 store) replay to their recorded state root, switch to the segment layout, and keep working across new segments | +| Index decoder | `a2_segment_index_round_trips_and_refuses_damage` | Round trip; a flipped bit, truncation, an entry past the replay position, or unsorted entries are refused | + +Three existing tests changed with the layout, keeping their intent: two A1 migration tests read the +frames after the checkpoint's replay position instead of the whole `wal.v2.log` (a checkpoint no +longer empties it), and `test_v2_checkpoint_crash_window_reopens_and_skips_covered_frames` now covers +the A2 checkpoint window (checkpoint renamed, `wal.log` not yet replaced), checks a damaged covered +blob is refused on read, and checks a missing segment index refuses to open. + +### 3.1 Red before green + +Evidence in `evidence/a2-segment-store/red-green/`: + +- `red-main-compile.txt`: the suite against main `e863c87` cannot build (no segment store, none of the + four new fault injections). +- `red-main-behaviour.txt`: a probe with the core assertion of + `a2_checkpoint_keeps_blobs_in_segments_across_reopen`, written against main's API: main's checkpoint + writes 20 blob files for 20 changesets and empties `wal.v2.log`. Fails on main, passes here. +- `mutation-M1.txt` to `mutation-M7.txt`: each acceptance test fails when the defect it guards is put + back into this branch, and passes again without it (`green.txt`): + +| Mutation | Defect put back | Tests that fail | +| :--- | :--- | :--- | +| M1 | Rotation skips the directory flush of the new segment | the three new-segment tests and the durability-order test | +| M2 | Reopen does not flush the directory before writing | durability order | +| M3 | A torn batch is accepted with data in a later segment | torn segment (fail closed) | +| M4 | The segment index is written without blob locations | both crash-between-payload-and-index tests, checkpoint, old stores | +| M5 | Replay does not rebuild blob locations from the segments | 8 of 10 | +| M6 | A failed directory flush is ignored (the batch is acknowledged) | flush failure (directory) | +| M7 | Strict recovery truncates a torn tail like `TruncateTornTail` | both torn segment tests | + +The crash tests kill a process; they cannot see a missing flush on their own (the page cache survives a +process crash). The durability-order trace is what makes M1 and M2 fail. + +## 4. Seconds and Joules per Accepted Change + +This section is a performance report. It is not acceptance: acceptance is the crash suite in section 3. + +**Method.** `synapse-bench segments` (`crates/synapse-bench/src/segments.rs`) opens a group-commit +store (`GROUP_COMMIT_DEFAULT`, 16 MiB segments) and runs N agent threads that ingest 4,000 changesets +of one 11,949-byte blob each, with `checkpoint_and_compact` after every 1,000 accepted changes. One +cell is one (agents, repetition); its time runs from the first ingest to the end of its last +checkpoint, so checkpoint cost is inside the figure. Seconds per accepted change = cell time / 4,000. +Each acknowledgement's latency is recorded (p50, p99, max). Energy is the `aien_spbm` SoC package +counter read before and after each cell; idle power is measured once per run over a 30 s window before +the first cell. Agents 1, 4, 8, 32; 3 repetitions; medians reported with the range of the three. + +**Bounds (ADR section 6).** The flush bound is the cheapest `overwrite_*_fdatasync` p50 measured the same +morning by `synapse-bench floor`: 1.006 ms (64 KiB overwrite; 4 KiB and 1 MiB were 1.099 ms). The +interval bound per accepted change is the largest of: flush bound / agents (one flush can carry every +waiting agent), 11,949 B at the 15.754 GB/s measured write floor, 11,949 B at 273 GB/s memory +bandwidth, and the SHA-256 (39.46 GB/s) plus Ed25519 (397,560 verifies/s) cost of one change. The +latency bound is flush bound + bytes at 273 GB/s. The energy bound is idle package power times the +interval bound (the least energy the machine spends being on for that long). Fraction of bound = +bound / measured, so 1.0 is at the bound. + +**Results** (run 2026-10-16T08:13:12Z to 08:21:08Z, branch commit `0da8183`; raw samples in +`evidence/a2-segment-store/measurement/raw-a2.json`, summary in `report-a2.json`): + +| Agents | Interval per change (ms) median [range] | Interval bound (ms) | Fraction | Latency p50 / p99 / max (ms) | Latency fraction (p50) | Package energy per change (mJ) median [range] | Energy bound (mJ) | Energy fraction | Changes per flush | +| ---: | :--- | ---: | ---: | :--- | ---: | :--- | ---: | ---: | ---: | +| 1 | 1.3003 [1.2865, 1.3015] | 1.0060 | 0.774 | 1.197 / 2.200 / 12.208 | 0.841 | 27.767 [26.896, 34.392] | 20.34 | 0.733 | 1.00 | +| 4 | 0.6000 [0.5950, 0.6075] | 0.2515 | 0.419 | 2.150 / 4.287 / 41.618 | | 17.043 [14.128, 26.639] | 5.086 | 0.298 | 2.17 | +| 8 | 0.3347 [0.3345, 0.3398] | 0.1258 | 0.376 | 2.303 / 9.642 / 43.637 | | 7.970 [6.915, 14.857] | 2.543 | 0.319 | 4.01 | +| 32 | 0.1284 [0.1241, 0.1862] | 0.0314 | 0.245 | 2.573 / 39.732 / 45.933 | | 3.405 [2.866, 13.833] | 0.636 | 0.187 | 15.62 | + +Idle package power over the 30 s window was 20.222 W; average package power during the cells was +21.6 to 28.4 W. Each cell wrote 4 segment files and 0 blob files; the four checkpoints of a cell took +0.14 to 0.21 s in total. Latency fraction is given only for 1 agent: with more agents an +acknowledgement waits for the batch ahead of it by design (group commit), so p50 above the single-flush +bound is queueing, not a missed flush. + +**Comparison with main (pre-A2).** The same harness built on main `e863c87` +(`measurement/main-comparison.patch` adds only the benchmark module; `raw-main.json`, +`report-main.json`), same host, same morning: + +| Agents | Main interval per change (ms) | Main fraction | A2 interval per change (ms) | Main package energy per change (mJ) | A2 package energy per change (mJ) | +| ---: | ---: | ---: | ---: | ---: | ---: | +| 1 | 7.8461 | 0.128 | 1.3003 | 253.973 | 27.767 | +| 4 | 7.0774 | 0.036 | 0.6000 | 255.014 | 17.043 | +| 8 | 6.7881 | 0.019 | 0.3347 | 222.001 | 7.970 | +| 32 | 6.6204 | 0.005 | 0.1284 | 216.313 | 3.405 | + +On main each 1,000-change checkpoint writes 1,000 blob files (file, rename, directory flush each): +about 26 s of checkpoint per 4,000-change cell, with acknowledgements stalled up to 7.6 s behind it. +Between checkpoints both layouts write the same batches; the difference is the checkpoint. + +**What these figures do not show.** + +- The host was shared with other agent sessions (load average 2.2 at start, 5.8 at end). Energy + above idle is small against this noise and some cells read below idle; the figures above are + totals, not energy above idle, for that reason. Main's idle window read 33.0 W against A2's 20.2 W. +- The package meter is uncalibrated and covers the SoC only; NVMe energy is UNMEASURED. +- One host, one filesystem (ext4 on NVMe), one blob size, one segment size; no power-loss run. +- The remaining gap at 1 agent (0.774 of the flush bound) is per-batch work outside the flush (4 KiB + padding, encoding, signature verification, index update); it was not broken down further here. + +**Reproduce.** + +```sh +cargo build --release -p synapse-bench +target/release/synapse-bench floor --dir --out floor.json --iterations 300 +target/release/synapse-bench segments --dir --out raw.json +target/release/synapse-bench segments-report --raw raw.json --floor floor.json > report.json +``` + +`measurement/manifest.json` records the binaries' SHA-256, the host, and the run window; +`measurement/SHA256SUMS` seals the files. + +## 5. Deviations from ADR Section 5.9 + +- **Padding per batch.** Batches stay 4 KiB-aligned (the WAL v2 format), so each batch, not each + object, ends in a partly filled block. The alignment is what lets recovery tell a torn tail from + corruption (`torn_evidence`). +- **Index rebuilt from checkpoint plus segments.** The ADR says the index "is rebuilt from + checkpoints". Here the checkpoint carries a bound segment index for the blobs it retains, and the + locations of later blobs come from replaying the segments after the replay position. Covered segment + bytes before the replay position are not re-verified at open (the bound index vouches for them); + their blobs are verified on every read. +- **WAL records and content chunks share segments, content is not chunked.** Content-defined chunking + is step G2 (after X6); a blob is stored whole inside its frame. +- **No reclamation.** Segments only grow until K1 (garbage collection) lands; superseded blob bytes + stay on disk. The pre-written zero tail of each finished segment (at most one pre-write chunk) is + also not reclaimed. + +## 6. Limits + +- Power loss was not tested; flush durability on power loss is UNVERIFIED (drive write cache). +- 512-byte sector write atomicity on this drive is UNVERIFIED; the torn-tail rule assumes it (as W1). +- Energy is SoC package only, from the uncalibrated `aien_spbm` counters; NVMe energy is UNMEASURED. +- A v1 store opened with group commit keeps its existing blob files (they stay readable and are swept + only by the existing unreferenced-blob sweep). +- A pre-A2 binary refuses a segment store (marker version 3); there is no downgrade path. diff --git a/evidence/a2-segment-store/measurement/SHA256SUMS b/evidence/a2-segment-store/measurement/SHA256SUMS new file mode 100644 index 0000000..8198941 --- /dev/null +++ b/evidence/a2-segment-store/measurement/SHA256SUMS @@ -0,0 +1,12 @@ +6c386feec3998bafcb784ed47586b4c48f42d78c080c5ea0a8006b81f441c024 a2.log +7eb5cd01b2ea8360eb746c9161ded222aa646010321e01e9d22a98243b3781c8 end.txt +35947fc6749b17ab9a66c539e5ebc3f3ed9d897af02654ceadf44f57fdad2518 floor.json +01ef7b108959086c50ca5ff2469c3c06c0f98fa668dc2a7a0861add2f7c929d4 main-comparison.patch +91e8f4e096776251da0755615635dc4d34afc017b2cc555c074d452cee20e275 main.log +18a609a4e4421b7cc01e0bec3b6d9b16605b3b80bbb98a57879183ba7cab6261 manifest.json +d8e0769a2bb6677f04d0602a03639e8030e237d709c728920925762368d15745 raw-a2.json +0906bdd128bfc24b400e6a60b2b21e43c000830de9de51305aba09cada800638 raw-main.json +1dbb5eda6a3044d647e2c46b8deccbf037171137cc623772b9ada39c1c4baaff report-a2.json +53664bef16c99dec08652112bc73471adfe24d8b82004be0d6a3b6a54eaa84c7 report-main.json +fb4623abe2b4367f38350511f5edacdd146645723bc2649116a59d353cfc72be run.sh +3310ac3bd87d429d38ea83a6e95815af74d8b754e7ae6d0c47542c4108ed885e start.txt diff --git a/evidence/a2-segment-store/measurement/a2.log b/evidence/a2-segment-store/measurement/a2.log new file mode 100644 index 0000000..a0d0ff0 --- /dev/null +++ b/evidence/a2-segment-store/measurement/a2.log @@ -0,0 +1,12 @@ +agents 1 rep 0: 4000 accepted in 5.201 s, 4000 batches, 4 segment files +agents 4 rep 0: 4000 accepted in 2.380 s, 1841 batches, 4 segment files +agents 8 rep 0: 4000 accepted in 1.339 s, 974 batches, 4 segment files +agents 32 rep 0: 4000 accepted in 0.514 s, 256 batches, 4 segment files +agents 1 rep 1: 4000 accepted in 5.206 s, 4000 batches, 4 segment files +agents 4 rep 1: 4000 accepted in 2.400 s, 1841 batches, 4 segment files +agents 8 rep 1: 4000 accepted in 1.338 s, 1011 batches, 4 segment files +agents 32 rep 1: 4000 accepted in 0.497 s, 254 batches, 4 segment files +agents 1 rep 2: 4000 accepted in 5.146 s, 4000 batches, 4 segment files +agents 4 rep 2: 4000 accepted in 2.430 s, 1871 batches, 4 segment files +agents 8 rep 2: 4000 accepted in 1.359 s, 998 batches, 4 segment files +agents 32 rep 2: 4000 accepted in 0.745 s, 257 batches, 4 segment files diff --git a/evidence/a2-segment-store/measurement/end.txt b/evidence/a2-segment-store/measurement/end.txt new file mode 100644 index 0000000..41a791f --- /dev/null +++ b/evidence/a2-segment-store/measurement/end.txt @@ -0,0 +1,2 @@ +2026-10-16T08:21:08Z +5.79 4.59 4.36 4/3173 464487 diff --git a/evidence/a2-segment-store/measurement/floor.json b/evidence/a2-segment-store/measurement/floor.json new file mode 100644 index 0000000..563e43d --- /dev/null +++ b/evidence/a2-segment-store/measurement/floor.json @@ -0,0 +1,1071 @@ +{ + "dir": "/home/drakestapleton/workspace/backlog-sweep/synapse/23/bench/floor/synapse-floor-340489", + "iterations": 300, + "idle": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 5.000225955, + "valid": true, + "refusal": null, + "samples": 52, + "largest_gap_ms": 100.695, + "pkg_j": 100.059, + "cpu_p_j": 18.538, + "cpu_e_j": 2.483, + "rest_j": 79.038, + "pkg_mean_w": 20.01089568761298, + "pkg_edge_sd_j": 1.6338827910237375, + "sys_total_mean_w": 20.479692307692307, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.22, + 3.66, + 4.28 + ], + "loadavg_end": [ + 2.12, + 3.61, + 4.27 + ], + "machine_busy_cpu_s": 3.409999999916181 + }, + "counter_cadence": { + "reads": 113965, + "changes": 10, + "median_gap_ms": 100.539, + "min_gap_ms": 100.512, + "max_gap_ms": 100.569 + }, + "storage": [ + { + "name": "append_4k_fsync", + "description": "append 4 KiB to a growing file, then fsync (today's WAL pattern per frame)", + "n": 300, + "latency": { + "n": 300, + "min_ms": 2.578, + "p50_ms": 3.578, + "p95_ms": 4.861, + "p99_ms": 5.678, + "max_ms": 12.902, + "mean_ms": 3.674 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 1.10250884, + "valid": true, + "refusal": null, + "samples": 13, + "largest_gap_ms": 100.32, + "pkg_j": 24.555, + "cpu_p_j": 6.032, + "cpu_e_j": 0.806, + "rest_j": 17.717, + "pkg_mean_w": 22.271930264069354, + "pkg_edge_sd_j": 1.8184954911273374, + "sys_total_mean_w": 25.04169230769231, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.12, + 3.61, + 4.27 + ], + "loadavg_end": [ + 2.12, + 3.61, + 4.27 + ], + "machine_busy_cpu_s": 1.2399999999906868 + }, + "pkg_j_per_op": 0.08184999999999999, + "pkg_j_per_op_above_idle": 0.008309368693629367, + "error": null + }, + { + "name": "append_4k_fdatasync", + "description": "append 4 KiB to a growing file, then fdatasync (size change needs a journal commit)", + "n": 300, + "latency": { + "n": 300, + "min_ms": 2.489, + "p50_ms": 3.201, + "p95_ms": 4.047, + "p99_ms": 4.614, + "max_ms": 4.907, + "mean_ms": 3.217 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 0.965530383, + "valid": true, + "refusal": null, + "samples": 11, + "largest_gap_ms": 100.724, + "pkg_j": 24.257, + "cpu_p_j": 7.099, + "cpu_e_j": 0.884, + "rest_j": 16.274, + "pkg_mean_w": 25.122979480594967, + "pkg_edge_sd_j": 2.051282684862321, + "sys_total_mean_w": 27.010818181818184, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.12, + 3.61, + 4.27 + ], + "loadavg_end": [ + 2.27, + 3.62, + 4.27 + ], + "machine_busy_cpu_s": 1.3299999998416752 + }, + "pkg_j_per_op": 0.08085666666666667, + "pkg_j_per_op_above_idle": 0.0164529074085533, + "error": null + }, + { + "name": "overwrite_4k_fdatasync", + "description": "overwrite 4 KiB inside an already written, synced file, then fdatasync (no metadata change)", + "n": 300, + "latency": { + "n": 300, + "min_ms": 0.866, + "p50_ms": 1.099, + "p95_ms": 1.961, + "p99_ms": 2.264, + "max_ms": 2.873, + "mean_ms": 1.24 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 0.37235193, + "valid": true, + "refusal": null, + "samples": 5, + "largest_gap_ms": 100.224, + "pkg_j": 8.373, + "cpu_p_j": 1.759, + "cpu_e_j": 0.252, + "rest_j": 6.361999999999999, + "pkg_mean_w": 22.486790923844545, + "pkg_edge_sd_j": 1.8360387905355693, + "sys_total_mean_w": 23.5158, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.27, + 3.62, + 4.27 + ], + "loadavg_end": [ + 2.27, + 3.62, + 4.27 + ], + "machine_busy_cpu_s": 0.22999999998137355 + }, + "pkg_j_per_op": 0.027909999999999997, + "pkg_j_per_op_above_idle": 0.003073014565628765, + "error": null + }, + { + "name": "odirect_dsync_4k_overwrite", + "description": "O_DIRECT | O_DSYNC 4 KiB overwrite inside an already written file (device write with FUA or flush)", + "n": 300, + "latency": { + "n": 300, + "min_ms": 1.488, + "p50_ms": 1.785, + "p95_ms": 2.769, + "p99_ms": 2.972, + "max_ms": 3.337, + "mean_ms": 1.954 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 0.586501575, + "valid": true, + "refusal": null, + "samples": 7, + "largest_gap_ms": 100.267, + "pkg_j": 10.452, + "cpu_p_j": 1.005, + "cpu_e_j": 0.183, + "rest_j": 9.264, + "pkg_mean_w": 17.820924010306367, + "pkg_edge_sd_j": 1.455072352338797, + "sys_total_mean_w": 18.511285714285712, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.27, + 3.62, + 4.27 + ], + "loadavg_end": [ + 2.27, + 3.62, + 4.27 + ], + "machine_busy_cpu_s": 0.14000000013038516 + }, + "pkg_j_per_op": 0.03484, + "pkg_j_per_op_above_idle": -0.004281406126485733, + "error": null + }, + { + "name": "overwrite_64k_fdatasync", + "description": "overwrite 64 KiB inside an already written, synced file, then fdatasync", + "n": 100, + "latency": { + "n": 100, + "min_ms": 0.795, + "p50_ms": 1.006, + "p95_ms": 1.761, + "p99_ms": 2.094, + "max_ms": 2.126, + "mean_ms": 1.186 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 0.118759327, + "valid": true, + "refusal": null, + "samples": 3, + "largest_gap_ms": 100.346, + "pkg_j": 1.803, + "cpu_p_j": 0.2, + "cpu_e_j": 0.034, + "rest_j": 1.569, + "pkg_mean_w": 15.181965455226939, + "pkg_edge_sd_j": 1.2396022885955644, + "sys_total_mean_w": 19.658, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.27, + 3.62, + 4.27 + ], + "loadavg_end": [ + 2.27, + 3.62, + 4.27 + ], + "machine_busy_cpu_s": 0.02000000001862645 + }, + "pkg_j_per_op": 0.01803, + "pkg_j_per_op_above_idle": -0.005734805045281197, + "error": null + }, + { + "name": "overwrite_1m_fdatasync", + "description": "overwrite 1024 KiB inside an already written, synced file, then fdatasync", + "n": 100, + "latency": { + "n": 100, + "min_ms": 0.798, + "p50_ms": 1.099, + "p95_ms": 1.795, + "p99_ms": 2.577, + "max_ms": 2.991, + "mean_ms": 1.247 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 0.124880008, + "valid": true, + "refusal": null, + "samples": 3, + "largest_gap_ms": 100.278, + "pkg_j": 1.846, + "cpu_p_j": 0.241, + "cpu_e_j": 0.032, + "rest_j": 1.573, + "pkg_mean_w": 14.78218995629789, + "pkg_edge_sd_j": 1.20696075579414, + "sys_total_mean_w": 20.324, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.27, + 3.62, + 4.27 + ], + "loadavg_end": [ + 2.27, + 3.62, + 4.27 + ], + "machine_busy_cpu_s": 0.05000000004656613 + }, + "pkg_j_per_op": 0.01846, + "pkg_j_per_op_above_idle": -0.006529608135562741, + "error": null + }, + { + "name": "fallocate_4k_overwrite_fdatasync", + "description": "write 4 KiB into fallocate()d (unwritten) space, then fdatasync", + "n": 300, + "latency": { + "n": 300, + "min_ms": 2.587, + "p50_ms": 3.526, + "p95_ms": 4.942, + "p99_ms": 5.882, + "max_ms": 6.166, + "mean_ms": 3.648 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 1.094826486, + "valid": true, + "refusal": null, + "samples": 12, + "largest_gap_ms": 100.267, + "pkg_j": 20.61, + "cpu_p_j": 2.926, + "cpu_e_j": 0.448, + "rest_j": 17.235999999999997, + "pkg_mean_w": 18.824900807158585, + "pkg_edge_sd_j": 1.5370467145348576, + "sys_total_mean_w": 20.487583333333333, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.27, + 3.62, + 4.27 + ], + "loadavg_end": [ + 2.27, + 3.62, + 4.27 + ], + "machine_busy_cpu_s": 0.4599999999627471 + }, + "pkg_j_per_op": 0.0687, + "pkg_j_per_op_above_idle": -0.0043281953579395824, + "error": null + }, + { + "name": "prewrite_64m_zeros_fsync", + "description": "extend a file by 64 MiB of zeros, then fsync (WAL segment pre-writing, amortized)", + "n": 5, + "latency": { + "n": 5, + "min_ms": 15.493, + "p50_ms": 15.926, + "p95_ms": null, + "p99_ms": null, + "max_ms": 16.594, + "mean_ms": 15.927 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 0.079750508, + "valid": true, + "refusal": null, + "samples": 2, + "largest_gap_ms": 79.726, + "pkg_j": 1.948, + "cpu_p_j": 0.341, + "cpu_e_j": 0.027, + "rest_j": 1.58, + "pkg_mean_w": 24.426176695952833, + "pkg_edge_sd_j": 1.994388975738199, + "sys_total_mean_w": 20.9415, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.27, + 3.62, + 4.27 + ], + "loadavg_end": [ + 2.27, + 3.62, + 4.27 + ], + "machine_busy_cpu_s": 0.06999999983236194 + }, + "pkg_j_per_op": 0.3896, + "pkg_j_per_op_above_idle": 0.07042418067557113, + "error": null + }, + { + "name": "append_64k_fdatasync", + "description": "append 64 KiB, then fdatasync", + "n": 100, + "latency": { + "n": 100, + "min_ms": 2.592, + "p50_ms": 3.508, + "p95_ms": 4.638, + "p99_ms": 5.737, + "max_ms": 6.009, + "mean_ms": 3.637 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 0.363884836, + "valid": true, + "refusal": null, + "samples": 5, + "largest_gap_ms": 100.224, + "pkg_j": 8.385, + "cpu_p_j": 1.766, + "cpu_e_j": 0.189, + "rest_j": 6.43, + "pkg_mean_w": 23.043004737905594, + "pkg_edge_sd_j": 1.8814534582801312, + "sys_total_mean_w": 23.1532, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.27, + 3.62, + 4.27 + ], + "loadavg_end": [ + 2.27, + 3.62, + 4.27 + ], + "machine_busy_cpu_s": 0.38000000012107193 + }, + "pkg_j_per_op": 0.08385, + "pkg_j_per_op_above_idle": 0.011033385044998435, + "error": null + }, + { + "name": "append_1m_fdatasync", + "description": "append 1024 KiB, then fdatasync", + "n": 100, + "latency": { + "n": 100, + "min_ms": 2.753, + "p50_ms": 3.811, + "p95_ms": 4.859, + "p99_ms": 5.348, + "max_ms": 5.812, + "mean_ms": 3.844 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 0.384642091, + "valid": true, + "refusal": null, + "samples": 5, + "largest_gap_ms": 100.208, + "pkg_j": 7.681, + "cpu_p_j": 1.124, + "cpu_e_j": 0.17, + "rest_j": 6.3870000000000005, + "pkg_mean_w": 19.96921340571643, + "pkg_edge_sd_j": 1.630479446958358, + "sys_total_mean_w": 21.1302, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.27, + 3.62, + 4.27 + ], + "loadavg_end": [ + 2.27, + 3.62, + 4.27 + ], + "machine_busy_cpu_s": 0.13999999989755452 + }, + "pkg_j_per_op": 0.07681, + "pkg_j_per_op_above_idle": -0.0001603276006633969, + "error": null + }, + { + "name": "blob_file_create_fsync_rename_dirfsync_12k", + "description": "new 12 KB blob file: create tmp, write, fsync, rename, fsync shard directory (today's write_blob_file)", + "n": 300, + "latency": { + "n": 300, + "min_ms": 5.497, + "p50_ms": 6.11, + "p95_ms": 7.802, + "p99_ms": 9.193, + "max_ms": 13.334, + "mean_ms": 6.312 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 1.894004635, + "valid": true, + "refusal": null, + "samples": 20, + "largest_gap_ms": 100.227, + "pkg_j": 41.652, + "cpu_p_j": 10.138, + "cpu_e_j": 1.213, + "rest_j": 30.301000000000002, + "pkg_mean_w": 21.991498452695183, + "pkg_edge_sd_j": 1.7955983296102993, + "sys_total_mean_w": 23.89675, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.27, + 3.62, + 4.27 + ], + "loadavg_end": [ + 2.41, + 3.63, + 4.26 + ], + "machine_busy_cpu_s": 1.8900000001303852 + }, + "pkg_j_per_op": 0.13884, + "pkg_j_per_op_above_idle": 0.012504236057198359, + "error": null + }, + { + "name": "concurrent_32_append_4k_fdatasync_round", + "description": "32 threads each append 4 KiB to their own file and fdatasync; time per round (all 32 done)", + "n": 30, + "latency": { + "n": 30, + "min_ms": 5.835, + "p50_ms": 6.896, + "p95_ms": 7.52, + "p99_ms": null, + "max_ms": 9.057, + "mean_ms": 6.867 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 0.223323413, + "valid": true, + "refusal": null, + "samples": 4, + "largest_gap_ms": 100.352, + "pkg_j": 4.849, + "cpu_p_j": 1.358, + "cpu_e_j": 0.217, + "rest_j": 3.274, + "pkg_mean_w": 21.712904772774543, + "pkg_edge_sd_j": 1.772851250897972, + "sys_total_mean_w": 27.608, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.41, + 3.63, + 4.26 + ], + "loadavg_end": [ + 2.41, + 3.63, + 4.26 + ], + "machine_busy_cpu_s": 0.3499999998603016 + }, + "pkg_j_per_op": 0.16163333333333335, + "pkg_j_per_op_above_idle": 0.012669949261842934, + "error": null + }, + { + "name": "concurrent_32_blob_file_create_round", + "description": "32 threads each create one 12 KB blob file with fsync, rename, directory fsync; time per round (all 32 done)", + "n": 30, + "latency": { + "n": 30, + "min_ms": 11.334, + "p50_ms": 12.202, + "p95_ms": 13.188, + "p99_ms": null, + "max_ms": 14.144, + "mean_ms": 12.357 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 0.378290533, + "valid": true, + "refusal": null, + "samples": 5, + "largest_gap_ms": 100.229, + "pkg_j": 11.072, + "cpu_p_j": 4.266, + "cpu_e_j": 0.331, + "rest_j": 6.474999999999999, + "pkg_mean_w": 29.26850934437738, + "pkg_edge_sd_j": 2.3897637808535332, + "sys_total_mean_w": 30.982, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.41, + 3.63, + 4.26 + ], + "loadavg_end": [ + 2.41, + 3.63, + 4.26 + ], + "machine_busy_cpu_s": 0.8100000000558794 + }, + "pkg_j_per_op": 0.36906666666666665, + "pkg_j_per_op_above_idle": 0.11673558681751614, + "error": null + } + ], + "bandwidth": [ + { + "name": "sequential_buffered_1m_writes_then_fsync", + "bytes": 268435456, + "seconds": 0.064348, + "seconds_per_gib": 0.257393132, + "error": null + }, + { + "name": "sequential_odirect_1m_writes_then_fsync", + "bytes": 268435456, + "seconds": 0.034057000000000004, + "seconds_per_gib": 0.136228192, + "error": null + } + ], + "cpu": [ + { + "name": "sha256_request_sized", + "description": "SHA-256 over a buffer the size of a typical JSON submit request", + "n": 143992, + "latency": { + "n": 143992, + "min_ms": 0.02, + "p50_ms": 0.02, + "p95_ms": 0.021, + "p99_ms": 0.022, + "max_ms": 0.755, + "mean_ms": 0.02 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 3.012560137, + "valid": true, + "refusal": null, + "samples": 32, + "largest_gap_ms": 100.653, + "pkg_j": 62.922, + "cpu_p_j": 14.362, + "cpu_e_j": 1.354, + "rest_j": 47.205999999999996, + "pkg_mean_w": 20.886554006739154, + "pkg_edge_sd_j": 1.7053799933864817, + "sys_total_mean_w": 21.32746875, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.41, + 3.63, + 4.26 + ], + "loadavg_end": [ + 2.41, + 3.63, + 4.26 + ], + "machine_busy_cpu_s": 3.890000000130385 + }, + "pkg_j_per_op": 0.000436982610145008, + "pkg_j_per_op_above_idle": 0.000018320277139229477, + "error": null + }, + { + "name": "sha256_content_12k", + "description": "SHA-256 over 12 KB (typical content per proposal)", + "n": 533511, + "latency": { + "n": 533511, + "min_ms": 0.005, + "p50_ms": 0.005, + "p95_ms": 0.005, + "p99_ms": 0.005, + "max_ms": 0.073, + "mean_ms": 0.005 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 3.024447156, + "valid": true, + "refusal": null, + "samples": 32, + "largest_gap_ms": 100.455, + "pkg_j": 71.045, + "cpu_p_j": 21.733, + "cpu_e_j": 1.646, + "rest_j": 47.666, + "pkg_mean_w": 23.49024345128945, + "pkg_edge_sd_j": 1.9179703463137747, + "sys_total_mean_w": 24.9404375, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.41, + 3.63, + 4.26 + ], + "loadavg_end": [ + 2.3, + 3.58, + 4.25 + ], + "machine_busy_cpu_s": 5.439999999944121 + }, + "pkg_j_per_op": 0.00013316501440457647, + "pkg_j_per_op_above_idle": 0.000019724248325875684, + "error": null + }, + { + "name": "ed25519_verify", + "description": "one Ed25519 signature verification (256-byte message)", + "n": 125675, + "latency": { + "n": 125675, + "min_ms": 0.023, + "p50_ms": 0.023, + "p95_ms": 0.023, + "p99_ms": 0.025, + "max_ms": 0.247, + "mean_ms": 0.023 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 2.999288318, + "valid": true, + "refusal": null, + "samples": 31, + "largest_gap_ms": 100.641, + "pkg_j": 92.321, + "cpu_p_j": 42.492, + "cpu_e_j": 2.46, + "rest_j": 47.369, + "pkg_mean_w": 30.780968753801545, + "pkg_edge_sd_j": 2.513255574512213, + "sys_total_mean_w": 33.86438709677419, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.3, + 3.58, + 4.25 + ], + "loadavg_end": [ + 2.36, + 3.57, + 4.24 + ], + "machine_busy_cpu_s": 9.820000000065193 + }, + "pkg_j_per_op": 0.0007346011537696439, + "pkg_j_per_op_above_idle": 0.0002570324593708041, + "error": null + }, + { + "name": "ed25519_sign", + "description": "one Ed25519 signature (256-byte message)", + "n": 303334, + "latency": { + "n": 303334, + "min_ms": 0.009, + "p50_ms": 0.009, + "p95_ms": 0.009, + "p99_ms": 0.01, + "max_ms": 0.104, + "mean_ms": 0.009 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 3.010616066, + "valid": true, + "refusal": null, + "samples": 32, + "largest_gap_ms": 100.535, + "pkg_j": 82.574, + "cpu_p_j": 33.116, + "cpu_e_j": 1.165, + "rest_j": 48.293, + "pkg_mean_w": 27.42760889790588, + "pkg_edge_sd_j": 2.239454888816303, + "sys_total_mean_w": 29.54065625, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.36, + 3.57, + 4.24 + ], + "loadavg_end": [ + 2.36, + 3.57, + 4.24 + ], + "machine_busy_cpu_s": 6.349999999860302 + }, + "pkg_j_per_op": 0.00027222137973323136, + "pkg_j_per_op_above_idle": 0.00007361151716531034, + "error": null + }, + { + "name": "json_encode_submit_request", + "description": "serde_json encode of a typical signed submit request", + "n": 88999, + "latency": { + "n": 88999, + "min_ms": 0.033, + "p50_ms": 0.033, + "p95_ms": 0.033, + "p99_ms": 0.035, + "max_ms": 0.103, + "mean_ms": 0.033 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 2.995059018, + "valid": true, + "refusal": null, + "samples": 31, + "largest_gap_ms": 101.538, + "pkg_j": 74.724, + "cpu_p_j": 26.345, + "cpu_e_j": 1.833, + "rest_j": 46.54600000000001, + "pkg_mean_w": 24.949091003187704, + "pkg_edge_sd_j": 2.037084750135745, + "sys_total_mean_w": 27.301193548387094, + "nvme_temp_k": 312.0, + "loadavg_start": [ + 2.36, + 3.57, + 4.24 + ], + "loadavg_end": [ + 2.41, + 3.56, + 4.23 + ], + "machine_busy_cpu_s": 5.1100000001024455 + }, + "pkg_j_per_op": 0.0008396049393813414, + "pkg_j_per_op_above_idle": 0.00016618373703701657, + "error": null + }, + { + "name": "json_decode_submit_request", + "description": "serde_json decode of a typical signed submit request", + "n": 38946, + "latency": { + "n": 38946, + "min_ms": 0.074, + "p50_ms": 0.076, + "p95_ms": 0.077, + "p99_ms": 0.078, + "max_ms": 0.16, + "mean_ms": 0.076 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 2.975793775, + "valid": true, + "refusal": null, + "samples": 31, + "largest_gap_ms": 101.406, + "pkg_j": 77.75, + "cpu_p_j": 29.376, + "cpu_e_j": 1.749, + "rest_j": 46.62499999999999, + "pkg_mean_w": 26.127482573956254, + "pkg_edge_sd_j": 2.1333000189884026, + "sys_total_mean_w": 28.719161290322578, + "nvme_temp_k": 312.0, + "loadavg_start": [ + 2.41, + 3.56, + 4.23 + ], + "loadavg_end": [ + 2.41, + 3.56, + 4.23 + ], + "machine_busy_cpu_s": 5.739999999990687 + }, + "pkg_j_per_op": 0.0019963539259487497, + "pkg_j_per_op_above_idle": 0.0004673573969246379, + "error": null + }, + { + "name": "auth_payload_digest", + "description": "synapse-auth payload digest: serde_json encode of the payload plus SHA-256", + "n": 56480, + "latency": { + "n": 56480, + "min_ms": 0.052, + "p50_ms": 0.052, + "p95_ms": 0.054, + "p99_ms": 0.055, + "max_ms": 0.913, + "mean_ms": 0.052 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 3.000690547, + "valid": true, + "refusal": null, + "samples": 32, + "largest_gap_ms": 100.4, + "pkg_j": 92.765, + "cpu_p_j": 42.388, + "cpu_e_j": 1.596, + "rest_j": 48.781000000000006, + "pkg_mean_w": 30.914550683256444, + "pkg_edge_sd_j": 2.5241624933795785, + "sys_total_mean_w": 33.405, + "nvme_temp_k": 312.0, + "loadavg_start": [ + 2.41, + 3.56, + 4.23 + ], + "loadavg_end": [ + 2.29, + 3.52, + 4.21 + ], + "machine_busy_cpu_s": 8.199999999953434 + }, + "pkg_j_per_op": 0.0016424398016997167, + "pkg_j_per_op_above_idle": 0.0005792934573862725, + "error": null + }, + { + "name": "envelope_validate", + "description": "ChangesetEnvelope::validate (canonical bytes, path rules, Ed25519 verify, id digest)", + "n": 107525, + "latency": { + "n": 107525, + "min_ms": 0.027, + "p50_ms": 0.027, + "p95_ms": 0.028, + "p99_ms": 0.029, + "max_ms": 0.062, + "mean_ms": 0.027 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 2.998998051, + "valid": true, + "refusal": null, + "samples": 31, + "largest_gap_ms": 100.313, + "pkg_j": 103.728, + "cpu_p_j": 51.472, + "cpu_e_j": 2.563, + "rest_j": 49.69299999999999, + "pkg_mean_w": 34.587551654264146, + "pkg_edge_sd_j": 2.8240617668367793, + "sys_total_mean_w": 38.43538709677419, + "nvme_temp_k": 313.0, + "loadavg_start": [ + 2.29, + 3.52, + 4.21 + ], + "loadavg_end": [ + 2.35, + 3.51, + 4.21 + ], + "machine_busy_cpu_s": 10.879999999888241 + }, + "pkg_j_per_op": 0.0009646872820274355, + "pkg_j_per_op_above_idle": 0.0004065599891567948, + "error": null + }, + { + "name": "blob_digest_12k", + "description": "BlobDigest::compute over 12 KB of content", + "n": 533466, + "latency": { + "n": 533466, + "min_ms": 0.005, + "p50_ms": 0.005, + "p95_ms": 0.005, + "p99_ms": 0.005, + "max_ms": 0.869, + "mean_ms": 0.005 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 3.048299594, + "valid": true, + "refusal": null, + "samples": 32, + "largest_gap_ms": 100.618, + "pkg_j": 68.585, + "cpu_p_j": 17.666, + "cpu_e_j": 1.449, + "rest_j": 49.47, + "pkg_mean_w": 22.499428906199565, + "pkg_edge_sd_j": 1.8370706774738395, + "sys_total_mean_w": 22.73871875, + "nvme_temp_k": 312.0, + "loadavg_start": [ + 2.35, + 3.51, + 4.21 + ], + "loadavg_end": [ + 2.35, + 3.51, + 4.21 + ], + "machine_busy_cpu_s": 4.400000000139698 + }, + "pkg_j_per_op": 0.00012856489448249747, + "pkg_j_per_op_above_idle": 0.000014219828067530077, + "error": null + }, + { + "name": "crc32c_request_sized", + "description": "synapse_store::crc32c over a request-sized buffer", + "n": 1501082, + "latency": { + "n": 1501082, + "min_ms": 0.001, + "p50_ms": 0.001, + "p95_ms": 0.001, + "p99_ms": 0.001, + "max_ms": 0.035, + "mean_ms": 0.001 + }, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 2.248432676, + "valid": true, + "refusal": null, + "samples": 24, + "largest_gap_ms": 100.585, + "pkg_j": 52.785, + "cpu_p_j": 16.071, + "cpu_e_j": 1.389, + "rest_j": 35.324999999999996, + "pkg_mean_w": 23.476353356465804, + "pkg_edge_sd_j": 1.9168362248205477, + "sys_total_mean_w": 25.38041666666667, + "nvme_temp_k": 312.0, + "loadavg_start": [ + 2.35, + 3.51, + 4.21 + ], + "loadavg_end": [ + 2.24, + 3.47, + 4.19 + ], + "machine_busy_cpu_s": 3.4799999999813735 + }, + "pkg_j_per_op": 0.00003516463457692518, + "pkg_j_per_op_above_idle": 5.190821194274182e-6, + "error": null + } + ], + "typical_request_json_bytes": 44668 +} \ No newline at end of file diff --git a/evidence/a2-segment-store/measurement/main-comparison.patch b/evidence/a2-segment-store/measurement/main-comparison.patch new file mode 100644 index 0000000..3bd55fc --- /dev/null +++ b/evidence/a2-segment-store/measurement/main-comparison.patch @@ -0,0 +1,586 @@ +diff --git a/crates/synapse-bench/src/lib.rs b/crates/synapse-bench/src/lib.rs +index c6ba08a..49dc260 100644 +--- a/crates/synapse-bench/src/lib.rs ++++ b/crates/synapse-bench/src/lib.rs +@@ -29,6 +29,7 @@ pub mod query; + pub mod recovery; + pub mod rng; + pub mod rusage; ++pub mod segments; + pub mod stats; + pub mod synapse_arm; + pub mod workload; +diff --git a/crates/synapse-bench/src/main.rs b/crates/synapse-bench/src/main.rs +index 6127f10..e176589 100644 +--- a/crates/synapse-bench/src/main.rs ++++ b/crates/synapse-bench/src/main.rs +@@ -12,6 +12,9 @@ + //! [--repo-root ] [--source-rev R] [--hwmon-root ] + //! synapse-bench bounds-verify --evidence + //! synapse-bench bounds-report --evidence (prints report.json recomputed from protocol.json and raw.json) ++//! synapse-bench segments --dir --out [--agents 1,4,8,32] ++//! [--changes N] [--reps N] [--blob-bytes N] [--segment-mib N] [--checkpoint-every N] [--idle-window-s S] ++//! synapse-bench segments-report --raw --floor (prints the A2 report) + //! ``` + + use std::path::PathBuf; +@@ -305,6 +308,68 @@ fn crypto_vectors_verify(args: &[String]) -> Result<(), String> { + Ok(()) + } + ++/// `segments`: ADR 0003 A2 segment store measurement (raw samples to `--out`). ++fn segments(args: &[String]) -> Result<(), String> { ++ let opts = parse_pairs( ++ args, ++ &[ ++ "--dir", ++ "--out", ++ "--agents", ++ "--changes", ++ "--reps", ++ "--blob-bytes", ++ "--segment-mib", ++ "--checkpoint-every", ++ "--idle-window-s", ++ ], ++ )?; ++ let get = |k: &str| { ++ opts.iter() ++ .rev() ++ .find(|(key, _)| key == k) ++ .map(|(_, v)| v.clone()) ++ }; ++ let num = |k: &str, d: u64| -> Result { ++ get(k).map_or(Ok(d), |v| v.parse().map_err(|_| format!("invalid {k}"))) ++ }; ++ let cfg = synapse_bench::segments::SegmentsConfig { ++ agents: parse_list(&get("--agents").unwrap_or_else(|| "1,4,8,32".into()), |x| { ++ x.parse().ok().filter(|n| *n > 0) ++ })?, ++ changes: num("--changes", 4000)? as usize, ++ reps: num("--reps", 3)? as usize, ++ blob_bytes: num("--blob-bytes", 11_949)? as usize, ++ segment_bytes: num("--segment-mib", 16)? * 1024 * 1024, ++ checkpoint_every: num("--checkpoint-every", 1000)? as usize, ++ idle_window_s: num("--idle-window-s", 30)?, ++ }; ++ let dir = PathBuf::from(get("--dir").ok_or("missing --dir")?); ++ let out = PathBuf::from(get("--out").ok_or("missing --out")?); ++ let raw = synapse_bench::segments::run_segments(&dir, &cfg)?; ++ synapse_bench::write_json(&out, &raw) ++} ++ ++/// `segments-report`: recompute the A2 report from `--raw` and a `--floor` report. ++fn segments_report(args: &[String]) -> Result<(), String> { ++ use std::io::Write; ++ let opts = parse_pairs(args, &["--raw", "--floor"])?; ++ let get = |k: &str| { ++ opts.iter() ++ .rev() ++ .find(|(key, _)| key == k) ++ .map(|(_, v)| PathBuf::from(v)) ++ .ok_or(format!("missing {k}")) ++ }; ++ let raw: synapse_bench::segments::SegmentsRaw = synapse_bench::read_json(&get("--raw")?)?; ++ let floor: synapse_bench::floor::FloorReport = synapse_bench::read_json(&get("--floor")?)?; ++ let report = synapse_bench::segments::segments_report(&raw, &floor)?; ++ let bytes = serde_json::to_vec_pretty(&report).map_err(|e| e.to_string())?; ++ std::io::stdout() ++ .write_all(&bytes) ++ .map_err(|e| format!("write stdout: {e}")) ++} ++ + fn main() -> ExitCode { + let args: Vec = std::env::args().skip(1).collect(); + let outcome = match args.first().map(String::as_str) { +@@ -316,6 +381,8 @@ fn main() -> ExitCode { + Some("bounds-report") => bounds_report(&args[1..]), + Some("crypto-vectors-write") => crypto_vectors_write(&args[1..]), + Some("crypto-vectors-verify") => crypto_vectors_verify(&args[1..]), ++ Some("segments") => segments(&args[1..]), ++ Some("segments-report") => segments_report(&args[1..]), + _ => Err("usage: synapse-bench run ... | synapse-bench child ... (see crate docs)".into()), + }; + match outcome { +diff --git a/crates/synapse-bench/src/segments.rs b/crates/synapse-bench/src/segments.rs +new file mode 100644 +index 0000000..5119dbe +--- /dev/null ++++ b/crates/synapse-bench/src/segments.rs +@@ -0,0 +1,476 @@ ++//! ADR 0003 A2 measurement: seconds and joules per accepted change of the segment store, ++//! against the section 6.2 flush bound. ++//! ++//! Each cell opens a fresh store with `FsyncPolicy::GROUP_COMMIT_DEFAULT` through ++//! [`SharedStore`], starts `agents` threads that submit signed one-file changesets of ++//! `blob_bytes` each, and records every change's time from `submit` to durable ++//! acknowledgement. Small segments make the run rotate (new segment file, pre-write, ++//! directory flush) inside the timed window, and a checkpoint runs every ++//! `checkpoint_every` accepted changes (blobs stay in the segments). The whole cell is one ++//! energy window of the `aien_spbm` package meter; a missing meter leaves joules `None` ++//! with the reason (`INSTRUMENT_UNAVAILABLE`), never a substitute. ++//! ++//! Bounds (fraction of bound reached = bound / measured, at most 1): ++//! * latency of one change: one flush plus the change's bytes moved once at memory ++//! bandwidth; ++//! * steady-state interval per accepted change: the largest of flush / agents (all ++//! agents' changes sharing one flush), bytes / device write bandwidth, bytes / memory ++//! bandwidth, and the change's SHA-256 plus one Ed25519 verification at all-core rates; ++//! * package joules per change: the idle package power for the interval bound (the ++//! package draws at least that while the work runs). A floor model, not physics; NVMe ++//! energy is UNMEASURED on this host. ++//! ++//! The flush time is the cheapest `overwrite_*_fdatasync` p50 of a `floor.json` measured ++//! on the same filesystem (`synapse-bench floor`). ++ ++use crate::energy::{idle_window, EnergyReading, EnergyWindow}; ++use crate::floor::FloorReport; ++use crate::stats::{summarize_us, LatencySummary}; ++use ed25519_dalek::SigningKey; ++use serde::{Deserialize, Serialize}; ++use std::path::{Path, PathBuf}; ++use std::sync::atomic::{AtomicUsize, Ordering}; ++use std::sync::{Barrier, Mutex}; ++use std::time::{Duration, Instant}; ++use synapse_core::{ ++ BlobDigest, ChangesetEnvelope, FileMode, GitOid, IdempotencyKey, MutationOp, PathMutation, ++ RepoId, SYNAPSE_ENVELOPE_VERSION, ++}; ++use synapse_store::{FsyncPolicy, IngestOutcome, RecoveryPolicy, SharedStore, StoreLimits}; ++ ++/// Memory bandwidth, bytes per second: NVIDIA DGX Spark specification, 273 GB/s (A0). ++pub const MEMORY_BW_BPS: f64 = 273e9; ++/// Device write bandwidth bound, bytes per second: the drive's PCIe link (A0). ++pub const DEVICE_BW_BPS: f64 = 15.754e9; ++/// All-core SHA-256 implementation reference, bytes per second (J3). ++pub const SHA256_ALLCORE_BPS: f64 = 39.46e9; ++/// All-core Ed25519 verification implementation reference, per second (J3). ++pub const ED25519_ALLCORE_PER_S: f64 = 397_560.0; ++ ++/// Run configuration. ++#[derive(Debug, Clone, Serialize, Deserialize)] ++pub struct SegmentsConfig { ++ pub agents: Vec, ++ pub changes: usize, ++ pub reps: usize, ++ pub blob_bytes: usize, ++ pub segment_bytes: u64, ++ pub checkpoint_every: usize, ++ pub idle_window_s: u64, ++} ++ ++/// One measured cell (raw samples). ++#[derive(Debug, Clone, Serialize, Deserialize)] ++pub struct CellRaw { ++ pub agents: usize, ++ pub rep: usize, ++ pub accepted: usize, ++ /// Wall time of the cell from the barrier release to the last acknowledgement. ++ pub elapsed_ns: u64, ++ /// Every accepted change's time from `submit` to durable acknowledgement. ++ pub latency_ns: Vec, ++ /// Duration of every checkpoint run during the cell. ++ pub checkpoint_ns: Vec, ++ pub batches: u64, ++ pub segment_files: usize, ++ pub blob_files: usize, ++ pub energy: EnergyReading, ++} ++ ++/// Figures of one cell against the bound. ++#[derive(Debug, Clone, Serialize, Deserialize)] ++pub struct CellReport { ++ pub agents: usize, ++ pub rep: usize, ++ pub latency: Option, ++ pub interval_s: f64, ++ pub interval_bound_s: f64, ++ pub interval_fraction: f64, ++ pub latency_p50_s: f64, ++ pub latency_bound_s: f64, ++ pub latency_fraction: f64, ++ pub mean_batch: f64, ++ pub pkg_j_per_change: Option, ++ pub pkg_j_per_change_above_idle: Option, ++ pub pkg_mean_w: Option, ++ pub energy_bound_j: Option, ++ pub energy_fraction: Option, ++ pub energy_refusal: Option, ++} ++ ++/// Bound inputs used for the report. ++#[derive(Debug, Clone, Serialize, Deserialize)] ++pub struct BoundInputs { ++ pub flush_s: f64, ++ pub flush_probe: String, ++ pub blob_bytes: usize, ++ pub memory_bw_bps: f64, ++ pub device_bw_bps: f64, ++ pub sha256_allcore_bps: f64, ++ pub ed25519_allcore_per_s: f64, ++ pub idle_pkg_w: Option, ++} ++ ++/// Raw output of a run. ++#[derive(Debug, Clone, Serialize, Deserialize)] ++pub struct SegmentsRaw { ++ pub config: SegmentsConfig, ++ pub store_dir: String, ++ pub idle: EnergyReading, ++ pub cells: Vec, ++} ++ ++/// Flush time: the cheapest overwrite-plus-`fdatasync` p50 in the floor report. ++pub fn flush_from_floor(floor: &FloorReport) -> Result<(f64, String), String> { ++ floor ++ .storage ++ .iter() ++ .filter(|p| p.name.starts_with("overwrite_") && p.name.ends_with("_fdatasync")) ++ .filter_map(|p| p.latency.as_ref().map(|l| (l.p50_ms / 1e3, p.name.clone()))) ++ .min_by(|a, b| a.0.total_cmp(&b.0)) ++ .ok_or_else(|| "floor report has no overwrite_*_fdatasync probe".to_string()) ++} ++ ++/// Interval bound per accepted change at `agents` concurrent agents. ++pub fn interval_bound_s(b: &BoundInputs, agents: usize) -> f64 { ++ let bytes = b.blob_bytes as f64; ++ let crypto = bytes / b.sha256_allcore_bps + 1.0 / b.ed25519_allcore_per_s; ++ (b.flush_s / agents.max(1) as f64) ++ .max(bytes / b.device_bw_bps) ++ .max(bytes / b.memory_bw_bps) ++ .max(crypto) ++} ++ ++/// Latency bound of one change: one flush plus its bytes moved once at memory bandwidth. ++pub fn latency_bound_s(b: &BoundInputs) -> f64 { ++ b.flush_s + b.blob_bytes as f64 / b.memory_bw_bps ++} ++ ++/// Compute the report of one cell (pure function of the raw cell and bound inputs). ++pub fn cell_report(c: &CellRaw, b: &BoundInputs, idle: &EnergyReading) -> CellReport { ++ let n = c.accepted.max(1) as f64; ++ let interval_s = c.elapsed_ns as f64 / 1e9 / n; ++ let us: Vec = c.latency_ns.iter().map(|v| v / 1000).collect(); ++ let latency = summarize_us(&us); ++ let mut sorted = c.latency_ns.clone(); ++ sorted.sort_unstable(); ++ let p50_ns = crate::stats::nearest_rank(&sorted, 0.5).unwrap_or(0); ++ let latency_p50_s = p50_ns as f64 / 1e9; ++ let interval_bound = interval_bound_s(b, c.agents); ++ let latency_bound = latency_bound_s(b); ++ let pkg_j_per_change = c.energy.pkg_j.map(|j| j / n); ++ let energy_bound_j = b.idle_pkg_w.map(|w| w * interval_bound); ++ CellReport { ++ agents: c.agents, ++ rep: c.rep, ++ latency, ++ interval_s, ++ interval_bound_s: interval_bound, ++ interval_fraction: interval_bound / interval_s, ++ latency_p50_s, ++ latency_bound_s: latency_bound, ++ latency_fraction: if latency_p50_s > 0.0 { ++ latency_bound / latency_p50_s ++ } else { ++ 0.0 ++ }, ++ mean_batch: c.accepted as f64 / c.batches.max(1) as f64, ++ pkg_j_per_change, ++ pkg_j_per_change_above_idle: c.energy.pkg_above_idle_j(idle).map(|j| j / n), ++ pkg_mean_w: c.energy.pkg_mean_w, ++ energy_bound_j, ++ energy_fraction: match (energy_bound_j, pkg_j_per_change) { ++ (Some(bound), Some(m)) if m > 0.0 => Some(bound / m), ++ _ => None, ++ }, ++ energy_refusal: c.energy.refusal.clone().or_else(|| { ++ c.energy ++ .pkg_j ++ .is_none() ++ .then(|| format!("INSTRUMENT_UNAVAILABLE: {}", c.energy.sensor)) ++ }), ++ } ++} ++ ++fn changeset( ++ key: &SigningKey, ++ label: &str, ++ blob_bytes: usize, ++) -> (ChangesetEnvelope, Vec<(BlobDigest, Vec)>) { ++ let mut content = format!("// {label}\n").into_bytes(); ++ let mut x: u32 = label.bytes().fold(2_166_136_261u32, |a, b| { ++ (a ^ u32::from(b)).wrapping_mul(16_777_619) ++ }); ++ while content.len() < blob_bytes { ++ x ^= x << 13; ++ x ^= x >> 17; ++ x ^= x << 5; ++ content.push(b"abcdefghijklmnopqrstuvwxyz \n(){};"[(x % 33) as usize]); ++ } ++ let digest = BlobDigest::compute(&content); ++ let path = format!("src/{label}.rs"); ++ let mut env = ChangesetEnvelope { ++ version: SYNAPSE_ENVELOPE_VERSION, ++ repo_id: RepoId::new("aien-spark/synapse").expect("repo id"), ++ base_git_oid: GitOid::compute_blob(b"base"), ++ parent_changesets: vec![], ++ author_did: String::new(), ++ idempotency_key: IdempotencyKey::from_label(label), ++ created_at_ms: 1000, ++ intent_summary: format!("Update {path}"), ++ mutations: vec![PathMutation { ++ path, ++ op: MutationOp::Upsert { ++ mode: FileMode::Regular644, ++ blob_digest: digest, ++ size_bytes: content.len() as u64, ++ }, ++ }], ++ evidence_receipts: vec![], ++ signature: vec![], ++ }; ++ env.sign(key); ++ (env, vec![(digest, content)]) ++} ++ ++fn count_files(dir: &Path, pred: &dyn Fn(&str) -> bool) -> usize { ++ let Ok(rd) = std::fs::read_dir(dir) else { ++ return 0; ++ }; ++ rd.filter_map(Result::ok) ++ .map(|e| { ++ if e.file_type().map(|t| t.is_dir()).unwrap_or(false) { ++ count_files(&e.path(), pred) ++ } else { ++ usize::from(pred(&e.file_name().to_string_lossy())) ++ } ++ }) ++ .sum() ++} ++ ++fn run_cell( ++ dir: &Path, ++ cfg: &SegmentsConfig, ++ agents: usize, ++ rep: usize, ++) -> Result { ++ let _ = std::fs::remove_dir_all(dir); ++ std::fs::create_dir_all(dir).map_err(|e| format!("create {}: {e}", dir.display()))?; ++ let limits = StoreLimits::default(); // main: no segments (comparison build) ++ let shared = SharedStore::open( ++ dir, ++ FsyncPolicy::GROUP_COMMIT_DEFAULT, ++ RecoveryPolicy::StrictFailClosed, ++ limits, ++ ) ++ .map_err(|e| format!("open store: {e:?}"))?; ++ // Prepare every agent's changesets before timing (signing is the agent's own work). ++ let per_agent = cfg.changes.div_ceil(agents); ++ let work: Vec> = (0..agents) ++ .map(|a| { ++ let key = SigningKey::from_bytes(&[(a as u8).wrapping_add(1); 32]); ++ (0..per_agent) ++ .map(|i| changeset(&key, &format!("a{a}-r{rep}-c{i}"), cfg.blob_bytes)) ++ .collect() ++ }) ++ .collect(); ++ let accepted = AtomicUsize::new(0); ++ // Agents that finished every submission and any checkpoint they triggered. ++ let agents_done = AtomicUsize::new(0); ++ let latencies = Mutex::new(Vec::with_capacity(cfg.changes)); ++ let checkpoints = Mutex::new(Vec::new()); ++ let errors = Mutex::new(Vec::::new()); ++ let barrier = Barrier::new(agents + 1); ++ let batches_before = shared.stats().batches; ++ let (elapsed, energy) = std::thread::scope(|s| { ++ for w in &work { ++ let (shared, accepted, agents_done, latencies, checkpoints, errors, barrier) = ( ++ &shared, ++ &accepted, ++ &agents_done, ++ &latencies, ++ &checkpoints, ++ &errors, ++ &barrier, ++ ); ++ s.spawn(move || { ++ barrier.wait(); ++ for (env, blobs) in w { ++ let t = Instant::now(); ++ match shared.submit(env.clone(), blobs) { ++ Ok(IngestOutcome::Committed { .. }) => { ++ let ns = t.elapsed().as_nanos() as u64; ++ latencies.lock().unwrap().push(ns); ++ let n = accepted.fetch_add(1, Ordering::SeqCst) + 1; ++ if cfg.checkpoint_every > 0 && n % cfg.checkpoint_every == 0 { ++ let t = Instant::now(); ++ match shared.with_exclusive(|st| st.checkpoint_and_compact(1000)) { ++ Ok(_) => checkpoints ++ .lock() ++ .unwrap() ++ .push(t.elapsed().as_nanos() as u64), ++ Err(e) => { ++ errors.lock().unwrap().push(format!("checkpoint: {e:?}")) ++ } ++ } ++ } ++ } ++ Ok(other) => errors ++ .lock() ++ .unwrap() ++ .push(format!("not committed: {other:?}")), ++ Err(e) => errors.lock().unwrap().push(format!("submit: {e:?}")), ++ } ++ } ++ agents_done.fetch_add(1, Ordering::SeqCst); ++ }); ++ } ++ let window = EnergyWindow::start(); ++ let t0 = Instant::now(); ++ barrier.wait(); ++ // The scope joins the agents when this closure returns; time them here instead, ++ // up to the end of the last checkpoint an agent ran. ++ while agents_done.load(Ordering::SeqCst) < agents { ++ std::thread::sleep(Duration::from_micros(200)); ++ } ++ (t0.elapsed(), window.finish()) ++ }); ++ let errors = errors.into_inner().unwrap(); ++ if !errors.is_empty() { ++ return Err(format!( ++ "{} failed submissions, first: {}", ++ errors.len(), ++ errors[0] ++ )); ++ } ++ let batches = shared.stats().batches - batches_before; ++ drop(shared); ++ let segment_files = count_files(dir, &|n| { ++ n.starts_with("wal.v2") ++ }); ++ let blob_files = count_files(&dir.join("blobs"), &|_| true); ++ Ok(CellRaw { ++ agents, ++ rep, ++ accepted: accepted.into_inner(), ++ elapsed_ns: elapsed.as_nanos() as u64, ++ latency_ns: latencies.into_inner().unwrap(), ++ checkpoint_ns: checkpoints.into_inner().unwrap(), ++ batches, ++ segment_files, ++ blob_files, ++ energy, ++ }) ++} ++ ++/// Run every cell (agents x reps, agent counts interleaved inside each repetition). ++pub fn run_segments(store_dir: &Path, cfg: &SegmentsConfig) -> Result { ++ let idle = idle_window(Duration::from_secs(cfg.idle_window_s)); ++ let mut cells = Vec::new(); ++ for rep in 0..cfg.reps { ++ for &agents in &cfg.agents { ++ let dir: PathBuf = store_dir.join(format!("cell-{agents}-{rep}")); ++ let cell = run_cell(&dir, cfg, agents, rep)?; ++ let _ = std::fs::remove_dir_all(&dir); ++ eprintln!( ++ "agents {agents} rep {rep}: {} accepted in {:.3} s, {} batches, {} segment files", ++ cell.accepted, ++ cell.elapsed_ns as f64 / 1e9, ++ cell.batches, ++ cell.segment_files ++ ); ++ cells.push(cell); ++ } ++ } ++ Ok(SegmentsRaw { ++ config: cfg.clone(), ++ store_dir: store_dir.display().to_string(), ++ idle, ++ cells, ++ }) ++} ++ ++/// Report of a run: bound inputs and every cell's figures. ++#[derive(Debug, Clone, Serialize, Deserialize)] ++pub struct SegmentsReport { ++ pub bounds: BoundInputs, ++ pub cells: Vec, ++} ++ ++/// Recompute the report from the raw run and the floor report. ++pub fn segments_report(raw: &SegmentsRaw, floor: &FloorReport) -> Result { ++ let (flush_s, flush_probe) = flush_from_floor(floor)?; ++ let bounds = BoundInputs { ++ flush_s, ++ flush_probe, ++ blob_bytes: raw.config.blob_bytes, ++ memory_bw_bps: MEMORY_BW_BPS, ++ device_bw_bps: DEVICE_BW_BPS, ++ sha256_allcore_bps: SHA256_ALLCORE_BPS, ++ ed25519_allcore_per_s: ED25519_ALLCORE_PER_S, ++ idle_pkg_w: raw.idle.pkg_mean_w, ++ }; ++ let cells = raw ++ .cells ++ .iter() ++ .map(|c| cell_report(c, &bounds, &raw.idle)) ++ .collect(); ++ Ok(SegmentsReport { bounds, cells }) ++} ++ ++#[cfg(test)] ++mod tests { ++ use super::*; ++ ++ fn inputs() -> BoundInputs { ++ BoundInputs { ++ flush_s: 0.0008, ++ flush_probe: "overwrite_1m_fdatasync".into(), ++ blob_bytes: 11_949, ++ memory_bw_bps: MEMORY_BW_BPS, ++ device_bw_bps: DEVICE_BW_BPS, ++ sha256_allcore_bps: SHA256_ALLCORE_BPS, ++ ed25519_allcore_per_s: ED25519_ALLCORE_PER_S, ++ idle_pkg_w: Some(20.0), ++ } ++ } ++ ++ #[test] ++ fn interval_bound_is_flush_shared_by_agents_until_crypto_dominates() { ++ let b = inputs(); ++ assert_eq!(interval_bound_s(&b, 1), 0.0008); ++ assert_eq!(interval_bound_s(&b, 8), 0.0001); ++ // 1000 agents: the flush share (0.8 us) is below one change's crypto (2.82 us). ++ let crypto = 11_949.0 / SHA256_ALLCORE_BPS + 1.0 / ED25519_ALLCORE_PER_S; ++ assert_eq!(interval_bound_s(&b, 1000), crypto); ++ assert!(latency_bound_s(&b) > 0.0008); ++ } ++ ++ #[test] ++ fn fractions_are_bound_over_measured_and_refused_energy_stays_none() { ++ let b = inputs(); ++ let cell = CellRaw { ++ agents: 1, ++ rep: 0, ++ accepted: 4, ++ elapsed_ns: 8_000_000, ++ latency_ns: vec![1_600_000; 4], ++ checkpoint_ns: vec![], ++ batches: 4, ++ segment_files: 1, ++ blob_files: 0, ++ energy: EnergyReading { ++ refusal: Some("INSTRUMENT_UNAVAILABLE: no aien_spbm device".into()), ++ ..Default::default() ++ }, ++ }; ++ let r = cell_report(&cell, &b, &EnergyReading::default()); ++ assert_eq!(r.interval_s, 0.002); ++ assert!((r.interval_fraction - 0.4).abs() < 1e-12); ++ assert!(r.pkg_j_per_change.is_none() && r.energy_fraction.is_none()); ++ assert!(r ++ .energy_refusal ++ .unwrap() ++ .starts_with("INSTRUMENT_UNAVAILABLE")); ++ } ++} diff --git a/evidence/a2-segment-store/measurement/main.log b/evidence/a2-segment-store/measurement/main.log new file mode 100644 index 0000000..088128e --- /dev/null +++ b/evidence/a2-segment-store/measurement/main.log @@ -0,0 +1,12 @@ +agents 1 rep 0: 4000 accepted in 31.385 s, 4000 batches, 1 segment files +agents 4 rep 0: 4000 accepted in 28.721 s, 1838 batches, 1 segment files +agents 8 rep 0: 4000 accepted in 27.152 s, 988 batches, 1 segment files +agents 32 rep 0: 4000 accepted in 26.493 s, 260 batches, 1 segment files +agents 1 rep 1: 4000 accepted in 31.191 s, 4000 batches, 1 segment files +agents 4 rep 1: 4000 accepted in 28.310 s, 1855 batches, 1 segment files +agents 8 rep 1: 4000 accepted in 26.937 s, 993 batches, 1 segment files +agents 32 rep 1: 4000 accepted in 26.482 s, 254 batches, 1 segment files +agents 1 rep 2: 4000 accepted in 31.639 s, 4000 batches, 1 segment files +agents 4 rep 2: 4000 accepted in 27.955 s, 1808 batches, 1 segment files +agents 8 rep 2: 4000 accepted in 27.367 s, 996 batches, 1 segment files +agents 32 rep 2: 4000 accepted in 26.433 s, 254 batches, 1 segment files diff --git a/evidence/a2-segment-store/measurement/manifest.json b/evidence/a2-segment-store/measurement/manifest.json new file mode 100644 index 0000000..c5dedfc --- /dev/null +++ b/evidence/a2-segment-store/measurement/manifest.json @@ -0,0 +1,17 @@ +{ + "step": "ADR 0003 A2 (issue #23): seconds and joules per accepted change against the flush bound", + "host": "spark-b87b, 20 CPUs, kernel 7.0.0-1019-nvidia, store on /dev/nvme0n1p2 ext4", + "a2_binary": {"commit": "0da8183", "sha256": "5be8ce2b44add8554436d731d1ed6531b43dad8deccdbff461be537fe8524369", "build": "cargo build --release -p synapse-bench"}, + "main_binary": {"commit": "e863c87 (main) plus main-comparison.patch (the segments subcommand; StoreLimits::default(), no segment size)", "sha256": "ddb4fa95edd00d6b895bc61ff1a91d532c1db18cbd16504f35da254e26f14282"}, + "commands": [ + "synapse-bench floor --dir --out floor.json --iterations 300", + "synapse-bench segments --dir --out raw-a2.json (defaults: --agents 1,4,8,32 --changes 4000 --reps 3 --blob-bytes 11949 --segment-mib 16 --checkpoint-every 1000 --idle-window-s 30)", + "main build: synapse-bench segments --dir --out raw-main.json (same defaults; no segments on main)", + "synapse-bench segments-report --raw raw-.json --floor floor.json > report-.json" + ], + "run_start_utc": "2026-10-16T08:13:12Z", "loadavg_start": "2.22 3.66 4.28", + "run_end_utc": "2026-10-16T08:21:08Z", "loadavg_end": "5.79 4.59 4.36", + "clock": "std::time::Instant (CLOCK_MONOTONIC), ns", + "energy": "aien_spbm hwmon, SoC package only, 1 mJ step, 10 Hz sampling, uncalibrated; NVMe UNMEASURED", + "note": "Shared host: other agent sessions were running (load average 2 to 6)." +} diff --git a/evidence/a2-segment-store/measurement/raw-a2.json b/evidence/a2-segment-store/measurement/raw-a2.json new file mode 100644 index 0000000..ee08b5b --- /dev/null +++ b/evidence/a2-segment-store/measurement/raw-a2.json @@ -0,0 +1,48574 @@ +{ + "config": { + "agents": [ + 1, + 4, + 8, + 32 + ], + "changes": 4000, + "reps": 3, + "blob_bytes": 11949, + "segment_bytes": 16777216, + "checkpoint_every": 1000, + "idle_window_s": 30 + }, + "store_dir": "/home/drakestapleton/workspace/backlog-sweep/synapse/23/bench/a2", + "idle": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 30.000113039, + "valid": true, + "refusal": null, + "samples": 301, + "largest_gap_ms": 102.773, + "pkg_j": 606.671, + "cpu_p_j": 117.707, + "cpu_e_j": 16.891, + "rest_j": 472.07300000000004, + "pkg_mean_w": 20.222290469750256, + "pkg_edge_sd_j": 1.6511431027078423, + "sys_total_mean_w": 21.201800664451827, + "nvme_temp_k": 312.0, + "loadavg_start": [ + 2.24, + 3.47, + 4.19 + ], + "loadavg_end": [ + 1.56, + 3.18, + 4.07 + ], + "machine_busy_cpu_s": 23.3499999998603 + }, + "cells": [ + { + "agents": 1, + "rep": 0, + "accepted": 4000, + "elapsed_ns": 5201163187, + "latency_ns": [ + 10861219, + 2155357, + 1456500, + 1711367, + 1228177, + 1500932, + 1115839, + 1200528, + 981326, + 1608502, + 1442323, + 1148624, + 898300, + 1500532, + 898972, + 900477, + 898876, + 1501764, + 1001182, + 1114607, + 1406995, + 1881849, + 1108847, + 983694, + 900172, + 1940954, + 1174384, + 983086, + 899548, + 1501076, + 1731304, + 1682886, + 983902, + 1500164, + 898588, + 898828, + 901677, + 1499540, + 898636, + 1293666, + 1751159, + 1654519, + 900892, + 898796, + 899933, + 1500084, + 899420, + 1213793, + 1301473, + 1583670, + 899452, + 898844, + 900716, + 1756744, + 1042750, + 999310, + 901228, + 1809945, + 1431779, + 955997, + 1214752, + 1584518, + 899244, + 899388, + 900604, + 1499925, + 901740, + 1073919, + 1448483, + 1674967, + 899596, + 899388, + 1304562, + 2000091, + 1436372, + 1701351, + 1198128, + 2072780, + 1412067, + 1218097, + 1288833, + 1898746, + 963597, + 1013054, + 986109, + 1824777, + 974893, + 1112479, + 987677, + 1629815, + 1292801, + 1300098, + 1087407, + 1587989, + 899564, + 900236, + 899677, + 1627302, + 1299889, + 1297970, + 1381859, + 1912922, + 978541, + 899324, + 899116, + 1727384, + 1081054, + 992798, + 898716, + 1500468, + 899645, + 899212, + 900076, + 1499988, + 1012110, + 1099407, + 988605, + 1499381, + 899068, + 901388, + 1002174, + 1805016, + 1218721, + 972173, + 899980, + 1500036, + 900045, + 900748, + 899436, + 1823481, + 1299937, + 976078, + 898732, + 1713415, + 987677, + 898285, + 899948, + 1499652, + 900028, + 900972, + 1027422, + 1878170, + 1305154, + 988045, + 899292, + 1499796, + 899661, + 899964, + 899724, + 1500356, + 1038575, + 961245, + 898844, + 1500852, + 899836, + 899212, + 1008302, + 1899850, + 1322642, + 1281217, + 1298066, + 1901754, + 1301009, + 1114543, + 1429412, + 2280559, + 1286625, + 972397, + 900493, + 1499204, + 1015774, + 1197088, + 1126223, + 1559829, + 899436, + 899405, + 899900, + 1500292, + 900796, + 902413, + 896316, + 1499604, + 899532, + 900125, + 899404, + 1501060, + 899212, + 899324, + 900173, + 1500820, + 899036, + 899980, + 900253, + 1499524, + 899884, + 899628, + 900029, + 1499396, + 1016302, + 1197664, + 1294753, + 1802601, + 1200080, + 1199792, + 1297490, + 1819721, + 1197488, + 1185824, + 1218513, + 1894345, + 1101119, + 1302450, + 1292337, + 1903738, + 972157, + 899324, + 899309, + 1728199, + 1083695, + 1115311, + 1290081, + 1893674, + 1110047, + 978605, + 899164, + 1710440, + 1090094, + 1021662, + 977197, + 1499717, + 899020, + 900236, + 900252, + 1657047, + 1272449, + 970397, + 899276, + 1814025, + 1312466, + 1302641, + 1411411, + 1865338, + 1221760, + 1298370, + 1198272, + 1687111, + 1312290, + 1414259, + 1171712, + 1587253, + 899196, + 1024958, + 976717, + 1498341, + 900124, + 899212, + 899212, + 1600998, + 899244, + 899948, + 902045, + 1497860, + 900140, + 901708, + 1110511, + 1587270, + 900124, + 899628, + 900668, + 1500981, + 898540, + 899500, + 1012078, + 1587813, + 901949, + 1110014, + 986350, + 1500372, + 899276, + 900029, + 900700, + 1501988, + 897964, + 1019550, + 1186144, + 1908170, + 984829, + 1014750, + 1197072, + 1779848, + 1008558, + 898348, + 1000206, + 1608342, + 1278033, + 1535829, + 976717, + 1499028, + 900172, + 899708, + 1027150, + 1696887, + 966813, + 1209952, + 1101167, + 1800696, + 1099743, + 1099455, + 986477, + 1500021, + 899804, + 900396, + 1009150, + 1823961, + 966365, + 898988, + 899228, + 1501796, + 1029726, + 968989, + 899117, + 1610821, + 1320706, + 968333, + 1016942, + 1901082, + 1315138, + 965293, + 1212672, + 1898506, + 1300226, + 1200608, + 1298385, + 1801305, + 1299105, + 1300306, + 1298162, + 1800376, + 1098063, + 1300850, + 1200352, + 1900650, + 1299329, + 1298498, + 1298673, + 1898570, + 1302002, + 1198672, + 1315954, + 1572613, + 899484, + 900572, + 1112352, + 1586613, + 900428, + 1032030, + 1293266, + 1899417, + 1298690, + 1260065, + 1341138, + 1902362, + 1081631, + 1299009, + 1310738, + 1888954, + 1316225, + 972750, + 900380, + 1608342, + 1202928, + 1200160, + 986510, + 1628934, + 970909, + 899276, + 900124, + 1611574, + 987469, + 1116095, + 1112815, + 1698743, + 1398659, + 1301058, + 1099263, + 1571941, + 899244, + 899293, + 901244, + 1629686, + 1292561, + 976606, + 900124, + 1499108, + 900268, + 899725, + 900348, + 1614038, + 1198368, + 1317810, + 1296273, + 1572374, + 1232416, + 1092527, + 974077, + 1500245, + 899020, + 900060, + 899404, + 1633526, + 1314658, + 1280737, + 1197793, + 1572869, + 1498948, + 900268, + 899629, + 1614357, + 1310914, + 1121231, + 1379955, + 1901370, + 971773, + 898684, + 899644, + 1499909, + 899884, + 1029950, + 1299921, + 1696984, + 972621, + 899436, + 899852, + 1500148, + 900317, + 901964, + 1104767, + 1803496, + 1296722, + 1199648, + 1112703, + 1578789, + 899181, + 899788, + 900028, + 1502052, + 897837, + 1025725, + 1299522, + 1799896, + 1098063, + 1187376, + 986734, + 1500404, + 900604, + 1036734, + 1289618, + 1795576, + 1300210, + 1188192, + 987901, + 1822793, + 1189168, + 986509, + 899485, + 1499876, + 899708, + 900460, + 899484, + 1610310, + 1197664, + 1104815, + 986990, + 1499572, + 899548, + 899484, + 900365, + 1627846, + 1295489, + 1280754, + 1324306, + 1699383, + 971389, + 900188, + 899340, + 1500292, + 901629, + 1206144, + 1204016, + 1586710, + 900956, + 898316, + 899948, + 1499669, + 901388, + 901308, + 1105823, + 1800648, + 1097183, + 1117247, + 976270, + 1501092, + 897356, + 900396, + 901373, + 1807096, + 1198960, + 992302, + 899164, + 1499860, + 899836, + 899741, + 899772, + 1502244, + 1007774, + 1198656, + 991469, + 1499685, + 899788, + 900140, + 899228, + 1746120, + 1167536, + 1099071, + 986253, + 1499940, + 899709, + 898796, + 900204, + 1500916, + 1013470, + 1295154, + 1207168, + 1692471, + 1300161, + 1198593, + 1198016, + 1798984, + 1300018, + 1300769, + 1197297, + 1594597, + 898300, + 1008766, + 1303010, + 1794520, + 1299890, + 1198384, + 1199216, + 1800265, + 1301297, + 1097967, + 1301250, + 1801784, + 1198784, + 1297058, + 1200880, + 1900010, + 1200672, + 992446, + 1004829, + 1903402, + 1199840, + 1198080, + 1201873, + 1899418, + 1214192, + 1077615, + 1205616, + 1797112, + 1222977, + 1078910, + 1198993, + 1799752, + 1300850, + 1104575, + 1202032, + 1694423, + 1299425, + 1195713, + 1302129, + 1900458, + 1099983, + 1104111, + 986653, + 1608246, + 1298882, + 1198480, + 1201120, + 1800104, + 1197297, + 993949, + 899196, + 1706455, + 1101007, + 1099071, + 1298978, + 1806712, + 1214497, + 1280721, + 1298130, + 1702183, + 990541, + 898380, + 900349, + 1500420, + 1011246, + 1294481, + 1302002, + 1797880, + 1300402, + 1100655, + 1198784, + 1798920, + 1198896, + 1299633, + 1115583, + 1683303, + 1200208, + 993006, + 899580, + 1706567, + 1201024, + 1199457, + 992125, + 1607206, + 1296497, + 1302162, + 1201056, + 1691479, + 1206736, + 1300578, + 1298674, + 1799576, + 1200736, + 1197217, + 1102623, + 1798808, + 1293553, + 1207473, + 1199968, + 1801000, + 1295250, + 1202736, + 1198384, + 1800105, + 1300610, + 1196800, + 1300385, + 1799865, + 1301409, + 1297906, + 1303906, + 1897081, + 1199104, + 1199313, + 1300065, + 1799625, + 1197792, + 1300450, + 1100270, + 1800857, + 1297425, + 1201105, + 1199392, + 1801224, + 1299186, + 1097935, + 1200704, + 1800824, + 1097886, + 1199873, + 1100303, + 1798744, + 1201824, + 1099071, + 1099423, + 1704231, + 988365, + 897885, + 901788, + 1597829, + 1316882, + 1299522, + 1295745, + 1801257, + 1295649, + 1301906, + 1297874, + 1799448, + 1200128, + 989438, + 899148, + 1500484, + 898748, + 902493, + 1005485, + 1803417, + 1198832, + 1101391, + 987341, + 1500981, + 899100, + 900028, + 901644, + 1498564, + 898445, + 1009245, + 1217489, + 1573269, + 899228, + 901116, + 899405, + 1500468, + 1212288, + 1199745, + 1100750, + 1797081, + 1300529, + 1299362, + 1300162, + 1696807, + 1300113, + 1198624, + 1102591, + 1897850, + 1197904, + 1195873, + 1205408, + 1799976, + 1201713, + 1303793, + 1095775, + 1799592, + 1099679, + 1200705, + 985629, + 1710487, + 1202064, + 1100063, + 1099903, + 1586102, + 899052, + 900844, + 899468, + 1613478, + 1196032, + 1102079, + 987054, + 1500548, + 898588, + 900156, + 899852, + 1613654, + 1296642, + 1201056, + 1198016, + 1903562, + 1198672, + 1199505, + 987341, + 1499572, + 900077, + 899212, + 899900, + 1613446, + 1198064, + 989277, + 898685, + 1500516, + 899596, + 899948, + 899436, + 1612886, + 1095183, + 991646, + 899388, + 1500740, + 899100, + 1116175, + 1199089, + 1702295, + 981469, + 900316, + 899180, + 1499685, + 901532, + 899340, + 1013870, + 1801768, + 983054, + 898780, + 900940, + 1499684, + 899388, + 900909, + 898620, + 1616614, + 1198592, + 1200320, + 983422, + 1500772, + 899132, + 898940, + 900316, + 1500741, + 1015933, + 1196673, + 1301057, + 1797897, + 987341, + 899324, + 900396, + 1496469, + 1017213, + 1201841, + 1295617, + 1895690, + 1102623, + 1200368, + 985854, + 1713287, + 1100863, + 1199488, + 983933, + 1615878, + 1199840, + 1197873, + 985853, + 1498804, + 900685, + 899100, + 1104111, + 1801864, + 1097231, + 1204176, + 1299762, + 1704039, + 1099007, + 1220640, + 1182400, + 1585782, + 1013070, + 1197760, + 1202000, + 1584086, + 899596, + 1011981, + 1201217, + 1702647, + 1099615, + 1198800, + 1200240, + 1697783, + 986606, + 1015661, + 1300578, + 1797736, + 1099551, + 1299058, + 1297473, + 1701319, + 1301746, + 1298802, + 1395651, + 1814648, + 974173, + 899324, + 1017278, + 1898730, + 1301554, + 1196512, + 1309506, + 1886889, + 1296498, + 1110463, + 982333, + 1809241, + 1300273, + 986718, + 1108126, + 1807193, + 1198384, + 1298002, + 1298369, + 1698903, + 1197169, + 1308449, + 1300818, + 1711415, + 968413, + 900797, + 899372, + 1499700, + 899932, + 899372, + 899805, + 1500580, + 898860, + 899884, + 900380, + 1500213, + 900284, + 899036, + 899900, + 1502117, + 898028, + 899820, + 898684, + 1500500, + 899613, + 900140, + 899516, + 1500948, + 898989, + 899932, + 899740, + 1500164, + 1012318, + 1099903, + 1310546, + 1814456, + 1078831, + 1198608, + 1197488, + 1697991, + 1297762, + 990685, + 897725, + 1501588, + 1018734, + 1292609, + 1200896, + 1894714, + 1205872, + 1294978, + 989597, + 1498693, + 899708, + 900092, + 1020526, + 1793720, + 1310178, + 974381, + 898924, + 1501493, + 898140, + 900588, + 899196, + 1500789, + 899420, + 899580, + 900524, + 1501780, + 897613, + 899820, + 899548, + 1499860, + 899436, + 899837, + 899980, + 1502308, + 1031054, + 1295730, + 1299905, + 1879194, + 2004475, + 1198976, + 1201392, + 1585334, + 899436, + 899164, + 901164, + 1499781, + 1014222, + 1198192, + 1320626, + 1774824, + 1205200, + 1294306, + 1208224, + 1796856, + 1199920, + 1301009, + 1096495, + 1703511, + 1199024, + 1236081, + 1263585, + 1801305, + 1199856, + 1196560, + 1097151, + 1701575, + 1199040, + 1305538, + 1092175, + 1708103, + 1297569, + 1301346, + 931837, + 893644, + 899676, + 1499172, + 900060, + 900781, + 899612, + 1499396, + 900540, + 1115839, + 1301186, + 1899322, + 1199648, + 1196944, + 1199632, + 1797929, + 1199088, + 1201856, + 986126, + 1499140, + 899004, + 901420, + 1002590, + 1804200, + 11447931, + 1051230, + 999758, + 1699975, + 1191008, + 1199264, + 1097455, + 1808008, + 999086, + 996926, + 1001693, + 1701623, + 1092079, + 1199296, + 1095567, + 1699831, + 1009598, + 998637, + 999934, + 1698839, + 1199360, + 1098431, + 1214496, + 1692903, + 995694, + 997277, + 1001694, + 1611254, + 1178879, + 1196961, + 1101183, + 1805448, + 1195968, + 1201184, + 1193489, + 1612917, + 1000382, + 997117, + 1001902, + 1604694, + 1002589, + 991454, + 998237, + 1695975, + 1197296, + 1201617, + 1217536, + 1793592, + 1102175, + 1193648, + 1199905, + 1807736, + 1195504, + 1199937, + 1198304, + 1795592, + 1102447, + 992382, + 1201264, + 1802808, + 1200432, + 999022, + 994925, + 1599254, + 1111823, + 989261, + 1004222, + 1599910, + 994013, + 999550, + 1003469, + 1596070, + 1004574, + 995389, + 1003086, + 1597733, + 995902, + 1000333, + 997390, + 1599109, + 1003022, + 998493, + 998142, + 1601622, + 1000221, + 997870, + 1000461, + 1600262, + 998621, + 999294, + 1000029, + 1602166, + 997582, + 1000461, + 998654, + 1600085, + 998718, + 1001581, + 1106591, + 1792505, + 1196496, + 1207264, + 1206513, + 1808216, + 980445, + 1206721, + 996845, + 1598422, + 1007869, + 988686, + 1002893, + 1593846, + 1005646, + 995597, + 1000094, + 1605909, + 1002654, + 1089711, + 1003741, + 1602534, + 995629, + 994942, + 998477, + 1605334, + 995838, + 997901, + 1006366, + 1600629, + 995742, + 996541, + 998094, + 1599333, + 1000862, + 998381, + 999566, + 1599814, + 1000285, + 998030, + 1000845, + 1601238, + 1105055, + 1201584, + 1197264, + 1705463, + 1093183, + 1207552, + 1002958, + 1694999, + 991149, + 1001918, + 997709, + 1609206, + 993934, + 997629, + 998750, + 1602710, + 1097950, + 997742, + 1000077, + 1618806, + 988750, + 996861, + 997214, + 1710039, + 1190176, + 1209584, + 1202193, + 1890937, + 1238817, + 1358562, + 1199921, + 1797912, + 1201280, + 1196688, + 1197825, + 1803112, + 1105199, + 992589, + 1288578, + 2010139, + 1491092, + 1397827, + 1400435, + 1999451, + 1297890, + 1176816, + 1242320, + 1698791, + 1108591, + 990622, + 993869, + 1604726, + 996173, + 1109455, + 988542, + 1598005, + 997470, + 1001293, + 1007086, + 1603942, + 999741, + 1003038, + 987613, + 1597494, + 999181, + 999182, + 998797, + 1600870, + 1085583, + 1097599, + 1101759, + 1699479, + 1104079, + 1213328, + 1393219, + 1705383, + 1087071, + 1399635, + 1385154, + 2007612, + 1396482, + 1315922, + 1097199, + 1809625, + 992333, + 897004, + 898956, + 1499269, + 899484, + 900236, + 900444, + 1498948, + 899837, + 900444, + 899388, + 1499108, + 900156, + 900157, + 898588, + 1504356, + 896220, + 899836, + 901917, + 1720439, + 1206112, + 1393955, + 1379219, + 2020251, + 1379539, + 1394243, + 1399251, + 1999931, + 1301553, + 1391267, + 1328482, + 1876425, + 1402627, + 1396963, + 1395587, + 1818633, + 1179632, + 1602790, + 1414611, + 1864377, + 924348, + 898877, + 899564, + 1612470, + 1206336, + 987997, + 1114239, + 1767528, + 1013902, + 893916, + 899708, + 1500485, + 898332, + 902508, + 898972, + 1500596, + 897757, + 900108, + 907740, + 1714311, + 1194656, + 1196977, + 1097423, + 1800760, + 1200112, + 1198144, + 1103951, + 1689175, + 1214193, + 1200784, + 1092879, + 1703831, + 1292433, + 1101039, + 1191056, + 1712183, + 986158, + 891564, + 899292, + 1499092, + 898620, + 899709, + 900668, + 1500676, + 897884, + 900204, + 899853, + 1501108, + 1027054, + 1296977, + 1297826, + 1698935, + 1198672, + 1304546, + 1298081, + 1690327, + 1103791, + 1307026, + 1299234, + 1800888, + 972573, + 1125167, + 974317, + 1499493, + 899356, + 900012, + 900156, + 1499621, + 899676, + 1123151, + 1483620, + 1991147, + 1397651, + 1409059, + 1395731, + 1999851, + 1393091, + 1391923, + 1126943, + 1891081, + 1308226, + 1195728, + 1206289, + 1796648, + 1098015, + 1205216, + 1298578, + 1896553, + 1304626, + 1200528, + 980494, + 1620502, + 1297185, + 1201392, + 1202481, + 1900713, + 1301058, + 1200272, + 1298610, + 1797976, + 1297474, + 1197248, + 1300993, + 1800393, + 1308882, + 1189888, + 1302289, + 1576262, + 1017341, + 1134048, + 1358770, + 1806249, + 1113263, + 1076654, + 1000190, + 1597909, + 1000030, + 999293, + 999166, + 1601446, + 998349, + 999246, + 998653, + 1603318, + 1001101, + 999310, + 998877, + 1602150, + 1000702, + 997229, + 1004158, + 1594549, + 998558, + 999357, + 999294, + 1600454, + 998685, + 1001022, + 999645, + 1599798, + 998957, + 1000862, + 1099183, + 1599685, + 999918, + 999933, + 1214737, + 1695399, + 1195504, + 1201152, + 1200097, + 1840536, + 1308914, + 1148192, + 1298721, + 1701495, + 990622, + 895852, + 900252, + 1500996, + 897660, + 901789, + 898508, + 1500532, + 901148, + 898236, + 899005, + 1500884, + 899740, + 909516, + 992142, + 1498676, + 899084, + 899468, + 900157, + 1502260, + 898060, + 899772, + 899676, + 1500821, + 898748, + 899356, + 900364, + 1499893, + 899660, + 899836, + 899804, + 1500036, + 899693, + 900108, + 899660, + 1600246, + 900236, + 1014734, + 1205360, + 1849721, + 1032910, + 896604, + 898940, + 1503333, + 896380, + 900924, + 902940, + 1500180, + 896349, + 899228, + 900380, + 1500340, + 899628, + 1799081, + 900428, + 1499028, + 899148, + 900348, + 899901, + 1500388, + 899500, + 900012, + 900172, + 1537237, + 963085, + 1115663, + 985278, + 1498612, + 899212, + 900172, + 902685, + 1496340, + 900108, + 900076, + 1026078, + 1799960, + 974990, + 899836, + 898652, + 1499796, + 900044, + 1024446, + 1198881, + 1895625, + 1194704, + 1251009, + 1157440, + 1696503, + 1197696, + 1201056, + 987854, + 1590789, + 998590, + 899052, + 900492, + 1499540, + 901837, + 899724, + 898140, + 1498740, + 901021, + 907132, + 893580, + 1839033, + 968493, + 894268, + 898108, + 1499972, + 898253, + 899676, + 901100, + 1499268, + 899740, + 898973, + 899932, + 1500644, + 899020, + 900076, + 899901, + 1499748, + 1126143, + 975549, + 893244, + 1500580, + 900108, + 900236, + 928269, + 1682198, + 998286, + 995821, + 998414, + 1601350, + 1006509, + 995198, + 999933, + 1607622, + 989613, + 1010910, + 1091007, + 1610054, + 990733, + 998718, + 997597, + 1603654, + 995517, + 1003566, + 994637, + 1610086, + 994046, + 997549, + 999582, + 1605045, + 994686, + 1000445, + 997342, + 1710151, + 992589, + 998510, + 999485, + 1599030, + 998366, + 1111743, + 993965, + 1597174, + 1103503, + 995469, + 997822, + 1600101, + 1104639, + 1111759, + 990990, + 1598901, + 999246, + 996781, + 996270, + 1599461, + 1000014, + 1002670, + 997357, + 1600438, + 998461, + 1000414, + 999869, + 1613750, + 988029, + 996590, + 999869, + 1622054, + 982670, + 995117, + 1001230, + 1598517, + 999006, + 1025982, + 1084479, + 1897561, + 991854, + 999693, + 1103055, + 1810025, + 1188272, + 1196656, + 1098927, + 2204238, + 1202320, + 1189232, + 1200288, + 1815337, + 1290705, + 1188416, + 1018974, + 1604054, + 983741, + 998462, + 1013005, + 1587942, + 1015758, + 983821, + 995373, + 1601206, + 1007550, + 1001421, + 1091311, + 1598342, + 998013, + 999358, + 998557, + 1600358, + 1026526, + 1078270, + 995934, + 1602678, + 996941, + 999182, + 998765, + 1601462, + 1205136, + 1197632, + 1195440, + 1802089, + 1208960, + 990190, + 1013613, + 1584614, + 1003757, + 994190, + 997005, + 1599990, + 998109, + 1000126, + 998926, + 1613285, + 992062, + 996637, + 998462, + 1600277, + 998766, + 999534, + 1000477, + 1599078, + 999709, + 1100927, + 997790, + 1711735, + 1192912, + 1198960, + 1202272, + 1796665, + 1206464, + 989933, + 998606, + 1719367, + 1189968, + 1196369, + 997693, + 1705015, + 1196384, + 1198897, + 1102014, + 1800057, + 1200608, + 1195184, + 1202064, + 1802296, + 1211408, + 1090015, + 990157, + 1601574, + 996862, + 999229, + 999422, + 1684199, + 1030285, + 1173712, + 1195936, + 1699895, + 915245, + 1388339, + 1392547, + 2000651, + 1325378, + 1372482, + 1212097, + 1796872, + 1191504, + 1135999, + 1266833, + 1816713, + 1104783, + 1002398, + 992285, + 1797544, + 1200881, + 1204112, + 1198816, + 1796280, + 1202689, + 1200832, + 1197840, + 1713719, + 1083279, + 997998, + 998861, + 1602182, + 997101, + 998894, + 999773, + 1598902, + 1000141, + 998430, + 999710, + 1601669, + 998206, + 1000413, + 1112415, + 1796889, + 1195440, + 1198592, + 1204272, + 1692215, + 1299826, + 1196816, + 1219952, + 1766936, + 1502245, + 1920426, + 1295473, + 1790473, + 1198720, + 1197408, + 1191504, + 1807593, + 1199600, + 1003245, + 998782, + 1599462, + 1110127, + 989997, + 1107631, + 1721015, + 1277746, + 988477, + 1196064, + 1604934, + 997341, + 1000334, + 1110063, + 1677959, + 1103150, + 1004142, + 1097295, + 1907866, + 993117, + 899564, + 1098271, + 1910682, + 1304338, + 1290897, + 1088559, + 1605909, + 897325, + 900140, + 899548, + 1596389, + 1208337, + 1208400, + 1291746, + 2013867, + 1499428, + 979853, + 899293, + 1501412, + 1022782, + 1070510, + 993198, + 1601429, + 1194273, + 1194848, + 1008077, + 1599542, + 1000142, + 999853, + 1085839, + 1797384, + 1809032, + 1953979, + 1430547, + 1818137, + 1000781, + 997646, + 1000109, + 2165454, + 2120780, + 1210737, + 999277, + 1598774, + 999133, + 1087695, + 1197104, + 1886122, + 1234561, + 992397, + 1106255, + 1675991, + 1017517, + 1103855, + 1180032, + 1800057, + 1111999, + 999293, + 1299938, + 1932858, + 1069326, + 1193889, + 1499364, + 1986251, + 1213008, + 1268529, + 1419779, + 1900394, + 1208624, + 1183985, + 1102814, + 2465778, + 1451299, + 1085519, + 1302514, + 1703127, + 997725, + 1001886, + 1085118, + 1797193, + 1672646, + 1241761, + 998110, + 1598645, + 1001166, + 998669, + 1002158, + 1949050, + 1654935, + 1191808, + 1413939, + 1586933, + 1384371, + 1143504, + 1073070, + 1597606, + 1087806, + 1200641, + 1209088, + 1871897, + 1322898, + 1190512, + 1283874, + 2143341, + 1085342, + 1323650, + 1775624, + 2538435, + 1159791, + 997166, + 999485, + 1601366, + 1348146, + 1465892, + 1274705, + 1797272, + 1199073, + 1235488, + 1182048, + 1679911, + 1117983, + 993678, + 999549, + 2729573, + 1273233, + 1496069, + 1097182, + 1597990, + 999998, + 1452339, + 947933, + 1597814, + 1085438, + 1016062, + 997053, + 1599926, + 999534, + 1000749, + 998190, + 2291071, + 2011819, + 1196352, + 999486, + 1599605, + 997774, + 1001725, + 999790, + 2111420, + 2489090, + 1531701, + 1348834, + 1720247, + 993006, + 1262001, + 1218032, + 2719653, + 1417651, + 1079951, + 997341, + 1789416, + 1182352, + 1431396, + 2052620, + 2070204, + 1069934, + 1081295, + 1199776, + 1798472, + 1199728, + 1802057, + 2162557, + 2118061, + 1032382, + 996941, + 1106895, + 2285775, + 2496482, + 2218766, + 1662166, + 1916490, + 1010686, + 1312738, + 2073820, + 2428768, + 1096463, + 1595685, + 998334, + 1000045, + 1205905, + 1793128, + 1310241, + 1471523, + 1684631, + 1922330, + 1298386, + 1203504, + 1298866, + 1800952, + 1313234, + 1502340, + 1483092, + 2226126, + 1072111, + 898428, + 900844, + 1499140, + 900668, + 899549, + 899756, + 1498980, + 1206624, + 1219521, + 1298209, + 2093965, + 980717, + 902524, + 1921466, + 2287567, + 1814473, + 1377442, + 1110831, + 1583926, + 898924, + 1114495, + 1123871, + 1980251, + 1091119, + 1203264, + 1098431, + 1586725, + 1014158, + 983629, + 8728038, + 1284946, + 1197584, + 1589893, + 898412, + 1328370, + 1376627, + 2107581, + 1299201, + 1513573, + 1072446, + 1500452, + 1012814, + 1198112, + 1086719, + 2267279, + 1264641, + 969437, + 896156, + 1501044, + 1362835, + 1459923, + 1495109, + 2083788, + 1415171, + 1499556, + 1287474, + 1591909, + 1318002, + 1697303, + 1098543, + 1805816, + 977133, + 900717, + 1197344, + 1602614, + 898700, + 899548, + 899436, + 1919738, + 1080399, + 898108, + 901068, + 1499892, + 900684, + 999406, + 1273393, + 2123149, + 1205888, + 2018939, + 1860090, + 1726967, + 992893, + 1007230, + 1685735, + 3068729, + 2621620, + 1219072, + 1151248, + 1536613, + 899132, + 900060, + 898876, + 1501444, + 1086735, + 1011566, + 898860, + 1690999, + 1009357, + 994910, + 1003581, + 1808313, + 1310690, + 1706359, + 1586709, + 1902922, + 1897081, + 986926, + 897964, + 1500484, + 898380, + 1726040, + 975325, + 1498724, + 1395955, + 1003134, + 899500, + 1500756, + 897724, + 1041454, + 1278866, + 2420656, + 1400051, + 958429, + 897980, + 1500933, + 899308, + 1119599, + 981597, + 1934298, + 2090157, + 1517940, + 1353506, + 1901866, + 1208977, + 989325, + 1213920, + 2165758, + 1157423, + 961117, + 899004, + 1500309, + 899100, + 900604, + 1197616, + 2441105, + 961421, + 897612, + 899885, + 1500020, + 900892, + 897628, + 901596, + 1500597, + 1201568, + 1439267, + 1400931, + 2292383, + 1939531, + 1447123, + 1487284, + 2305903, + 1328466, + 1568950, + 1318161, + 2009324, + 1369490, + 982541, + 900317, + 1500100, + 898140, + 901052, + 899484, + 1969595, + 1029582, + 899116, + 900764, + 1499781, + 1141791, + 1067310, + 1295714, + 1898810, + 1094014, + 899421, + 1676230, + 2805542, + 1575189, + 1405251, + 1547717, + 2347184, + 1650342, + 1745048, + 1435971, + 1967723, + 1137359, + 1198241, + 1462659, + 2055436, + 1742040, + 1151983, + 995486, + 1951946, + 1698567, + 1242033, + 1388707, + 1903337, + 1862090, + 1555557, + 991741, + 2210046, + 1950682, + 1220177, + 1545237, + 2863206, + 1207584, + 1795848, + 2149421, + 1944907, + 1191920, + 1501588, + 1198768, + 2149981, + 1991723, + 1592182, + 1460051, + 2155390, + 1625366, + 1413027, + 1018141, + 1679639, + 1019950, + 997549, + 997918, + 1600950, + 998845, + 999438, + 999885, + 1600038, + 998141, + 999934, + 999581, + 1600678, + 999677, + 999582, + 1000429, + 1599702, + 999102, + 1000061, + 999902, + 1601157, + 998190, + 1197040, + 1194608, + 1799305, + 1194368, + 1206512, + 1008750, + 1688902, + 1198113, + 1200896, + 1198144, + 1797896, + 1204945, + 1113391, + 994461, + 3097610, + 2045868, + 1343410, + 1200752, + 1853305, + 1323986, + 1228817, + 2489393, + 1609526, + 1617846, + 1890922, + 1086958, + 2286607, + 2688405, + 1511284, + 1438052, + 2367296, + 1203744, + 999949, + 997918, + 1690519, + 1196672, + 1199744, + 1199520, + 2401009, + 1310050, + 1000653, + 997214, + 1599317, + 999374, + 999005, + 1001182, + 2718084, + 1183632, + 1136800, + 1063038, + 1813193, + 2175901, + 1206689, + 997277, + 1599606, + 998381, + 1000142, + 1001421, + 2286911, + 1510629, + 1294561, + 1464436, + 1641990, + 997086, + 999325, + 1085423, + 1800280, + 1014478, + 1367058, + 1131152, + 1599733, + 998702, + 1000477, + 998222, + 2007867, + 992109, + 1001006, + 997693, + 1599510, + 1000478, + 988445, + 998814, + 2031995, + 969757, + 997902, + 999181, + 1599958, + 1916538, + 1557013, + 1473412, + 1851465, + 997485, + 1000238, + 998285, + 1602630, + 997821, + 1107743, + 1572982, + 2361216, + 1738487, + 1017982, + 998589, + 1688119, + 1123295, + 2224431, + 1423715, + 2026555, + 1008542, + 998797, + 999502, + 1687207, + 1199408, + 1721079, + 1396147, + 1803944, + 990046, + 998701, + 998830, + 1943434, + 1057374, + 998750, + 999134, + 1976170, + 1212961, + 1011021, + 998302, + 1600517, + 1085823, + 1819689, + 1703367, + 1589717, + 999326, + 998957, + 1555045, + 1645447, + 1703191, + 1546261, + 1247152, + 1785625, + 1199104, + 1760856, + 1052558, + 1599893, + 998638, + 998845, + 999389, + 2083948, + 1309778, + 1210864, + 889260, + 1500037, + 899500, + 899980, + 1164848, + 1724887, + 1009086, + 899708, + 900412, + 1500020, + 1218513, + 980989, + 899388, + 1712215, + 1199104, + 987502, + 900348, + 2205230, + 1310210, + 981933, + 899516, + 1501316, + 1006366, + 1308466, + 1625638, + 2105020, + 1050798, + 899644, + 900221, + 1618085, + 981406, + 1244289, + 1390882, + 1907818, + 1056158, + 897565, + 901068, + 1500228, + 1013454, + 1201840, + 1489156, + 2464417, + 1357459, + 970717, + 900284, + 1498900, + 899453, + 900732, + 1041934, + 2086028, + 1900698, + 1478068, + 1121087, + 1991291, + 978461, + 897660, + 1552421, + 1648919, + 898332, + 900396, + 900268, + 1817001, + 982589, + 898332, + 900412, + 1942090, + 1577046, + 1712247, + 1379491, + 1946410, + 1039390, + 899132, + 900860, + 1500517, + 898924, + 1203040, + 1430835, + 2298976, + 2215693, + 1168576, + 1518085, + 1661702, + 1016318, + 1200752, + 981502, + 1499828, + 899084, + 901436, + 1116495, + 1675415, + 1205680, + 1200256, + 1197744, + 1798329, + 1202816, + 1198256, + 1098751, + 1798744, + 1199249, + 1471235, + 1443620, + 1963290, + 1614390, + 2033004, + 1294625, + 1755736, + 2225998, + 2341600, + 2276606, + 2372000, + 1214145, + 991181, + 1000526, + 1598901, + 1350931, + 1848489, + 2199469, + 1697719, + 998046, + 999437, + 1001198, + 1960202, + 1820841, + 1204016, + 1200896, + 2063180, + 1476740, + 1170992, + 997901, + 1683735, + 1016942, + 999453, + 1483636, + 1798233, + 1199744, + 1422723, + 994014, + 1781912, + 1540388, + 1281234, + 994797, + 1598342, + 998093, + 1422484, + 1080094, + 1679111, + 1363890, + 951981, + 1108143, + 1591894, + 997373, + 999934, + 1000221, + 1685687, + 1197456, + 1199936, + 1099727, + 2913159, + 1509460, + 1617734, + 1385346, + 1785513, + 1001933, + 996622, + 999613, + 2499762, + 999821, + 2298015, + 1201153, + 1786792, + 1113503, + 2275215, + 1507076, + 2407216, + 1105439, + 997949, + 1001421, + 1597174, + 999806, + 1000237, + 1112239, + 1774568, + 1442212, + 968829, + 1711431, + 1898841, + 1373459, + 1811208, + 2296959, + 2026155, + 977549, + 1097951, + 998365, + 1600710, + 1466868, + 1960138, + 1172016, + 1599446, + 998285, + 998366, + 1000413, + 1599910, + 1099215, + 1747543, + 2350400, + 2384288, + 1017566, + 1404851, + 1100271, + 2298607, + 2328463, + 1770120, + 1360259, + 1938106, + 1080847, + 1012301, + 999566, + 1948602, + 1356274, + 994382, + 1081582, + 2300398, + 1620101, + 1093183, + 997134, + 1950618, + 1589958, + 1266001, + 992333, + 1598902, + 999613, + 999902, + 1549493, + 1834488, + 1463684, + 1675575, + 1256865, + 1821912, + 1188368, + 1202705, + 1201088, + 1711847, + 992253, + 1112959, + 1197489, + 1796712, + 1294849, + 1203873, + 1196912, + 1701559, + 1208096, + 1190960, + 1198608, + 1807577, + 1201968, + 1297858, + 1298977, + 1799000, + 1197201, + 1095662, + 987581, + 1499220, + 899740, + 899148, + 900476, + 1499525, + 899340, + 900060, + 901196, + 1498244, + 899516, + 899868, + 900012, + 1500356, + 900844, + 898541, + 1219216, + 1899034, + 1200000, + 1098351, + 1199216, + 1797240, + 1302770, + 1301233, + 1200081, + 1799240, + 1299585, + 1099119, + 1300594, + 1697287, + 1300705, + 1199425, + 983837, + 1716951, + 1196464, + 984734, + 899276, + 1616645, + 1299634, + 1199872, + 1099775, + 1582501, + 899901, + 899532, + 901356, + 1716423, + 982861, + 1118496, + 1401634, + 1813913, + 1296913, + 1097135, + 1288738, + 1796600, + 1099727, + 985165, + 1032862, + 1901434, + 1179008, + 1294065, + 990494, + 1615541, + 984318, + 900300, + 1128703, + 1802904, + 967342, + 898844, + 899788, + 1500196, + 1023278, + 1210304, + 1183184, + 1814361, + 1298369, + 1300114, + 1309010, + 1893849, + 965117, + 899468, + 899676, + 1617158, + 1105439, + 1300130, + 1290321, + 1798297, + 1322049, + 965693, + 898557, + 1500340, + 899420, + 900396, + 1032734, + 1567285, + 1231329, + 1464180, + 1003997, + 1499189, + 899212, + 899628, + 902956, + 1720343, + 1295410, + 1193808, + 1296369, + 1802265, + 1100767, + 993197, + 998238, + 1600501, + 1003358, + 1013133, + 999726, + 1682999, + 1097278, + 1002798, + 997981, + 1602054, + 1118959, + 1173792, + 1224113, + 1898729, + 1085023, + 890556, + 1007310, + 1792664, + 1206704, + 1103423, + 889356, + 1624550, + 1198240, + 1098943, + 1107743, + 1769000, + 998925, + 899500, + 900941, + 1498468, + 1223904, + 1300530, + 1097807, + 1701911, + 975965, + 898284, + 899948, + 1602934, + 997677, + 899245, + 899132, + 1500948, + 899452, + 899836, + 899340, + 1613030, + 988302, + 898492, + 900396, + 1625830, + 1098591, + 1285153, + 1200688, + 1799337, + 1201712, + 985965, + 1014798, + 1797416, + 1099503, + 1197952, + 1097375, + 1923690, + 1301442, + 1082494, + 1301650, + 1796056, + 984973, + 1027198, + 1198512, + 1903418, + 1097727, + 1185056, + 985421, + 1500101, + 899596, + 1023694, + 1298129, + 1882522, + 1201520, + 1109247, + 976253, + 1498772, + 900012, + 899917, + 1019677, + 1789033, + 991581, + 899452, + 899564, + 1499413, + 899964, + 1014365, + 985806, + 1717143, + 982525, + 1138256, + 1292641, + 1801960, + 965357, + 900460, + 898941, + 1500628, + 899532, + 1113503, + 1314274, + 1898825, + 972542, + 900044, + 899404, + 1614854, + 1312577, + 1299106, + 1100447, + 1572709, + 899292, + 899932, + 1206177, + 1918826, + 975117, + 898396, + 900636, + 1641446, + 1072719, + 984861, + 899980, + 1500709, + 898540, + 900268, + 1212976, + 1587062, + 900556, + 1028526, + 970493, + 1630310, + 1312802, + 1286689, + 1183520, + 1585621, + 898764, + 1229617, + 1101887, + 1795432, + 1297378, + 1303281, + 1115215, + 1556677, + 899293, + 899804, + 900076, + 1623094, + 1097039, + 1206320, + 1298945, + 1882890, + 991501, + 898077, + 900044, + 1500484, + 899820, + 1424243, + 976093, + 1629703, + 969693, + 1113263, + 985069, + 1500708, + 899452, + 899773, + 899820, + 1632454, + 1293825, + 1317426, + 1286561, + 1902714, + 1295058, + 1431987, + 1165856, + 1900073, + 1300226, + 1254609, + 1015422, + 1647702, + 1073358, + 977934, + 899452, + 1627798, + 1299153, + 1278306, + 1106798, + 1798440, + 1110079, + 978557, + 897420, + 1500516, + 1028510, + 1182032, + 1314274, + 1576629, + 896940, + 899965, + 900828, + 1498628, + 899660, + 900524, + 1030782, + 1895018, + 1199424, + 1085503, + 1094526, + 1718743, + 1301713, + 1281010, + 990909, + 1630022, + 995806, + 1494356, + 900572, + 899116, + 900700, + 1598918, + 900044, + 900620, + 1033054, + 1899322, + 1181136, + 1084846, + 899740, + 1631078, + 969470, + 1231712, + 1082431, + 1716055, + 1093839, + 1309105, + 1178896, + 1701511, + 984078, + 899452, + 899580, + 1815241, + 1114111, + 970813, + 898412, + 1500196, + 901756, + 1025118, + 973117, + 1499764, + 1228865, + 1300834, + 970349, + 1627830, + 1502052, + 1297458, + 1297569, + 1572757, + 1114911, + 985534, + 897980, + 1931930, + 1182352, + 1116687, + 969693, + 1499204, + 899981, + 898924, + 900956, + 1501124, + 1229313, + 1295473, + 1299666, + 1889337, + 983726, + 899644, + 900124, + 1681767, + 1018429, + 899100, + 899789, + 1827976, + 1186784, + 1315074, + 969869, + 1613766, + 986381, + 899244, + 8009932, + 889756, + 899292, + 1502148, + 898924, + 1014734, + 1196976, + 1799144, + 1198753, + 1200352, + 1201504, + 1700151, + 1190032, + 1209136, + 1102767, + 1927322, + 1292194, + 962445, + 899468, + 1500116, + 1031230, + 1287970, + 980877, + 1641734, + 1274049, + 1213905, + 1188816, + 1811864, + 967293, + 900252, + 898093, + 1500356, + 899692, + 1116159, + 1213632, + 1822889, + 1275409, + 972813, + 898093, + 1502116, + 897356, + 900300, + 899724, + 1638662, + 2196750, + 1280849, + 1105583, + 1807401, + 969773, + 899628, + 900668, + 1499124, + 1017342, + 1197728, + 1201553, + 1803656, + 978205, + 899420, + 1033310, + 1782152, + 984622, + 899612, + 899148, + 1499940, + 899708, + 900189, + 899772, + 1631814, + 968509, + 1114991, + 985933, + 1497188, + 900925, + 1230944, + 1299922, + 1568869, + 899532, + 899116, + 899996, + 1500229, + 1149903, + 1280962, + 969021, + 1499460, + 901420, + 903148, + 895580, + 1630870, + 1183360, + 1135504, + 1283713, + 1802936, + 1194337, + 1180815, + 1096431, + 1589078, + 898956, + 899004, + 900268, + 1501492, + 901357, + 1112063, + 1096718, + 1803673, + 1098719, + 985261, + 898956, + 1626758, + 1308706, + 1079262, + 1199313, + 1585605, + 898556, + 899884, + 900268, + 1502181, + 896876, + 1031566, + 1294513, + 1884330, + 1200368, + 1323954, + 1299345, + 1899642, + 1297474, + 967117, + 901244, + 1633366, + 1299585, + 1181712, + 1198257, + 1715927, + 968349, + 899772, + 900412, + 1614358, + 1298466, + 1201744, + 1195936, + 1799832, + 1102383, + 985165, + 899453, + 1498884, + 901836, + 897884, + 1212016, + 1917289, + 1099663, + 970701, + 899837, + 1499668, + 899516, + 900012, + 1026830, + 1573781, + 898828, + 899453, + 900028, + 1612933, + 1202161, + 985293, + 899020, + 1499652, + 1114911, + 1328898, + 1292610, + 1892474, + 1098334, + 971693, + 899517, + 1710823, + 1117535, + 1296769, + 1105727, + 1691991, + 976109, + 1224513, + 1289409, + 1586470, + 899308, + 897964, + 1164912, + 1767416, + 1183920, + 983293, + 1012029, + 1797017, + 989853, + 899516, + 900972, + 1626902, + 1300066, + 1275617, + 1231201, + 1695671, + 969245, + 898732, + 899676, + 1501172, + 1014830, + 1109599, + 1086287, + 1798488, + 1199536, + 989613, + 899180, + 1500021, + 900156, + 899180, + 899724, + 1733896, + 1292737, + 1307362, + 966045, + 1499556, + 1019646, + 980413, + 899564, + 1500244, + 1214209, + 1298161, + 987198, + 1498388, + 900684, + 1032158, + 1284993, + 1795896, + 986734, + 1229136, + 1197744, + 2101341, + 1099535, + 971261, + 898716, + 1499460, + 900668, + 899533, + 900012, + 1629654, + 1300081, + 1295618, + 1187440, + 1698039, + 1087374, + 899548, + 1114767, + 1976283, + 1335826, + 1093663, + 1314610, + 1891017, + 972781, + 898892, + 900701, + 1612821, + 1415859, + 1298834, + 1280801, + 1799641, + 1235184, + 1168576, + 1301138, + 1796600, + 1107855, + 1086478, + 1313522, + 1793128, + 1303154, + 1195936, + 1099135, + 1703543, + 1096143, + 1300753, + 1194528, + 1807961, + 1197376, + 1100223, + 1199840, + 1999515, + 1197936, + 1303202, + 1199936, + 1700855, + 1296561, + 1199985, + 1300209, + 1796664, + 1099343, + 984270, + 901052, + 1615078, + 1298641, + 1299490, + 1201664, + 1796216, + 1299346, + 1299761, + 1098975, + 1802104, + 1190656, + 1197521, + 1104351, + 1811256, + 1409091, + 963949, + 899052, + 1828985, + 971037, + 899244, + 899116, + 1501444, + 1151808, + 948797, + 898764, + 1500964, + 899164, + 899196, + 1136064, + 1978394, + 1195841, + 1198752, + 1197632, + 1797736, + 1203584, + 1200529, + 1204352, + 1805304, + 1189040, + 1291106, + 1209008, + 1806632, + 1194385, + 1200032, + 1300161, + 1799401, + 1199968, + 1298049, + 1102255, + 1798680, + 1101598, + 983934, + 1013485, + 1901530, + 1102447, + 1003053, + 978270, + 1709847, + 1303345, + 1101503, + 1198752, + 1585894, + 1015661, + 1294658, + 1199552, + 1903738, + 1192944, + 1201504, + 1302290, + 1804120, + 1097679, + 1298481, + 1295954, + 1803976, + 1190816, + 1208833, + 1200096, + 1901625, + 983470, + 898924, + 907116, + 1502500, + 1005630, + 985837, + 897740, + 1501029, + 897804, + 900668, + 899436, + 1505252, + 894620, + 899437, + 905724, + 1495348, + 899148, + 900268, + 905068, + 1494517, + 899692, + 900540, + 898940, + 1501236, + 898684, + 898813, + 901100, + 1499636, + 899452, + 901276, + 907788, + 1595094, + 895564, + 905788, + 895084, + 1499141, + 899260, + 906556, + 894268, + 1499508, + 899468, + 899469, + 907036, + 1501140, + 903420, + 990222, + 898620, + 1501780, + 898652, + 898892, + 903564, + 1496533, + 899404, + 900572, + 898700, + 1500804, + 899693, + 899596, + 900076, + 1499828, + 899692, + 900460, + 899404, + 1500325, + 899276, + 900300, + 899756, + 1500036, + 912493, + 888620, + 908716, + 1490404, + 898892, + 899996, + 899900, + 1499685, + 900332, + 1017566, + 1194080, + 1800968, + 1298546, + 1200208, + 1303121, + 1692231, + 1203776, + 1302098, + 1098671, + 1803896, + 1300146, + 981597, + 1220576, + 1799145, + 1298209, + 1300642, + 1297153, + 1802665, + 1301089, + 1297554, + 1301313, + 1899626, + 1098479, + 1300513, + 1093855, + 1805976, + 1297202, + 981389, + 898972, + 1822361, + 1199904, + 1294370, + 1198192, + 1703863, + 1298561, + 1196640, + 1302498, + 1582021, + 1017598, + 1196512, + 1299426, + 1699735, + 985085, + 899212, + 899644, + 1499397, + 999933, + 1306018, + 1127695, + 1682119, + 1188832, + 1235072, + 960285, + 1710823, + 1308850, + 1192032, + 1099775, + 1800856, + 987774, + 895516, + 900012, + 1635910, + 966157, + 1214096, + 1189552, + 1904058, + 1303266, + 1299457, + 1298050, + 1810376, + 1177264, + 1011966, + 1298513, + 1697191, + 1297970, + 1219216, + 974093, + 1521445, + 988109, + 989997, + 905469, + 1493508, + 899340, + 1009598, + 899660, + 1492212, + 898508, + 899868, + 899564, + 1499876, + 899485, + 900172, + 900460, + 1501844, + 915869, + 988845, + 894668, + 1498420, + 898668, + 900924, + 898797, + 1500324, + 903644, + 907820, + 893132, + 1496421, + 899292, + 900220, + 904060, + 1499636, + 894396, + 900621, + 899196, + 1500628, + 899596, + 899676, + 900076, + 1499765, + 899420, + 900092, + 899868, + 1600246, + 900540, + 898652, + 900220, + 1513109, + 987965, + 898540, + 900428, + 1499780, + 900332, + 900269, + 900268, + 1499012, + 899404, + 1124495, + 1298578, + 1578165, + 1023710, + 1094127, + 1299489, + 1806649, + 973645, + 899820, + 1119471, + 1706535, + 1197408, + 1004462, + 976813, + 1495540, + 897724, + 1800201, + 899212, + 1500196, + 900140, + 899340, + 900140, + 1622390, + 1299346, + 1202256, + 1195488, + 1799416, + 1287922, + 1208800, + 1197920, + 1696263, + 1199520, + 1197441, + 1106255, + 1793928, + 1298609, + 1200672, + 1199649, + 1898665, + 1196016, + 1103087, + 1198928, + 1902218, + 1302258, + 985789, + 1110111, + 1798472, + 991742, + 1112255, + 1415955, + 1780648, + 1197504, + 992797, + 898989, + 1499540, + 899820, + 1054638, + 1059166, + 1801689, + 1298769, + 1614294, + 1285441, + 1700519, + 985102, + 1006189, + 1333858, + 1674183, + 1293745, + 991134, + 898332, + 1499124, + 899884, + 902172, + 897644, + 1500661, + 900332, + 899164, + 898940, + 1614470, + 1101919, + 1292625, + 991358, + 1499796, + 900012, + 1006926, + 1201488, + 2081708, + 1123343, + 985133, + 1108063, + 1591878, + 899756, + 1010638, + 1403378, + 1798361, + 1194384, + 1199552, + 1100367, + 1800072, + 1300770, + 1298129, + 1100543, + 1706919, + 1092735, + 1203856, + 1095343, + 1900682, + 1340578, + 1256833, + 992685, + 1599430, + 1207248, + 1200080, + 1200176, + 1798825, + 991565, + 899180, + 1015358, + 1585861, + 898844, + 1008734, + 1106191, + 1792536, + 1298978, + 993789, + 899500, + 1611110, + 987725, + 1114367, + 986094, + 1609445, + 1328082, + 1168608, + 993421, + 1614918, + 1347282, + 1243969, + 991838, + 1499188, + 1112639, + 1293873, + 1200144, + 1905290, + 1283570, + 1003485, + 898748, + 1500052, + 901709, + 1364434, + 1342082, + 1592086, + 898620, + 1113391, + 1198880, + 1903450, + 984221, + 899036, + 1008958, + 1706023, + 1193248, + 1097231, + 1201040, + 1898745, + 1108415, + 984286, + 900636, + 1598581, + 900509, + 1109487, + 1199360, + 1800440, + 1197296, + 992334, + 1007261, + 1593446, + 899596, + 898844, + 1207840, + 1898842, + 1204256, + 1106831, + 982013, + 1714903, + 984414, + 1015341, + 1228417, + 1763384, + 1201504, + 1104671, + 1094271, + 1589461, + 899260, + 1108303, + 992302, + 1499812, + 898844, + 900716, + 899916, + 1610150, + 989501, + 1009566, + 989773, + 1499205, + 900764, + 899148, + 900060, + 1500068, + 1014990, + 1370755, + 1129679, + 1695959, + 1102511, + 985949, + 897980, + 1609350, + 991053, + 1006286, + 1200336, + 1999483, + 1105263, + 1192976, + 1201072, + 1807368, + 1101151, + 983406, + 911180, + 1489316, + 1006094, + 1113695, + 979533, + 1499348, + 899100, + 900092, + 898957, + 1500484, + 899948, + 899468, + 901884, + 1498500, + 899629, + 899372, + 900028, + 1500708, + 899436, + 899052, + 901132, + 1499045, + 899388, + 899964, + 900844, + 1499620, + 999966, + 906396, + 892956, + 1499540, + 900093, + 899772, + 900252, + 1500548, + 899164, + 899964, + 1017342, + 1795144, + 1201473, + 986205, + 899228, + 1500084, + 920173, + 980941, + 897900, + 1500372, + 899004, + 900221, + 899548, + 1500308, + 899916, + 899452, + 900124, + 1915578, + 1296082, + 1496868, + 1104927, + 1586373, + 899580, + 898429, + 900460, + 1500772, + 899964, + 1107679, + 1198224, + 1800680, + 992238, + 899788, + 900076, + 1499332, + 900045, + 1026541, + 1283362, + 1802296, + 1200352, + 1198032, + 1303874, + 1811240, + 1088911, + 984797, + 898045, + 1500036, + 898908, + 902236, + 897980, + 1499829, + 900076, + 899772, + 900140, + 1500484, + 898892, + 900492, + 899261, + 1502148, + 898300, + 900124, + 899388, + 1500228, + 899804, + 899404, + 899788, + 1500452, + 899148, + 899900, + 901021, + 1498452, + 900572, + 902028, + 898844, + 1616806, + 1200928, + 1296898, + 1200080, + 1699239, + 1300050, + 1299169, + 1296785, + 1900073, + 1275153, + 1224161, + 1519940, + 1681511 + ], + "checkpoint_ns": [ + 29250588, + 36788673, + 34578307, + 39555430 + ], + "batches": 4000, + "segment_files": 4, + "blob_files": 0, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 5.201250548, + "valid": true, + "refusal": null, + "samples": 54, + "largest_gap_ms": 101.286, + "pkg_j": 107.585, + "cpu_p_j": 23.01, + "cpu_e_j": 2.495, + "rest_j": 82.07999999999998, + "pkg_mean_w": 20.6844486738615, + "pkg_edge_sd_j": 1.688878162058295, + "sys_total_mean_w": 22.860925925925926, + "nvme_temp_k": 312.0, + "loadavg_start": [ + 1.56, + 3.18, + 4.07 + ], + "loadavg_end": [ + 1.52, + 3.15, + 4.05 + ], + "machine_busy_cpu_s": 3.9799999999813735 + } + }, + { + "agents": 4, + "rep": 0, + "accepted": 4000, + "elapsed_ns": 2379809627, + "latency_ns": [ + 10651808, + 12339959, + 12099443, + 12076163, + 892044, + 2672484, + 1111503, + 1995115, + 2008411, + 1198448, + 2310479, + 1905354, + 3103370, + 3103226, + 1204560, + 3110042, + 1193760, + 2397568, + 2399904, + 1196912, + 2389552, + 1803736, + 3001225, + 3000008, + 1198929, + 3001513, + 1392002, + 2586179, + 2583683, + 994622, + 2382368, + 1499044, + 2498561, + 2496274, + 1009486, + 2511362, + 1301633, + 2308175, + 2308095, + 1111263, + 2451329, + 1679847, + 2798966, + 2796918, + 1110079, + 2754997, + 1096751, + 2104829, + 2170381, + 1209344, + 2300255, + 3088217, + 3090313, + 2791477, + 2817638, + 999534, + 2004667, + 1941739, + 996733, + 1977099, + 1600246, + 2598339, + 2603347, + 997229, + 2586915, + 1006910, + 2011275, + 2014635, + 994605, + 2009003, + 1602022, + 2497506, + 2548562, + 995261, + 2592051, + 2054348, + 1971515, + 1912505, + 2093501, + 2634211, + 2721077, + 1196032, + 2894103, + 3013625, + 1193105, + 2386432, + 1097390, + 2292751, + 2292831, + 1805993, + 2810838, + 1415795, + 3186971, + 3222331, + 2599587, + 1212000, + 2513298, + 2415793, + 2457281, + 1790344, + 1196272, + 2954376, + 2981320, + 2989640, + 1192832, + 1207121, + 2692660, + 2692916, + 2699540, + 1793080, + 1222416, + 2786310, + 2801222, + 2832950, + 1184208, + 1199424, + 2318399, + 2318655, + 2305535, + 1791401, + 1206384, + 3027945, + 3036553, + 3098890, + 1192768, + 1118255, + 2440273, + 2511538, + 2534163, + 1782296, + 1202800, + 2722789, + 2744933, + 2725348, + 1201841, + 2770277, + 2895847, + 2913032, + 3389165, + 1209137, + 3030041, + 2902503, + 2889255, + 1194992, + 1118319, + 2312895, + 2313951, + 2313023, + 1785544, + 3012105, + 3107946, + 3102490, + 1188288, + 2600035, + 1208768, + 2367664, + 2384464, + 1798680, + 3067849, + 1191680, + 2989160, + 2977240, + 2128413, + 1206784, + 2387969, + 2323600, + 2337903, + 1794808, + 2778629, + 2930167, + 2891799, + 1188720, + 2697077, + 1208049, + 2365440, + 2386016, + 3213371, + 1286146, + 3795203, + 3719986, + 3703858, + 1193152, + 1221552, + 2414576, + 2415633, + 2416000, + 2721589, + 3972054, + 3919381, + 4297946, + 1241441, + 2788645, + 2500418, + 2235278, + 2774246, + 3155466, + 1193280, + 2834998, + 3001112, + 1205552, + 2339584, + 2398320, + 2592355, + 2000987, + 3367086, + 3327693, + 1297074, + 3269500, + 1399075, + 2610915, + 2613187, + 1396355, + 2796966, + 3115626, + 3039721, + 1221120, + 2950103, + 3161962, + 1082095, + 2460065, + 1199312, + 2364000, + 2094589, + 1801576, + 2995448, + 1202832, + 3006505, + 3007000, + 2142093, + 1205296, + 2378464, + 2302671, + 2298591, + 1789865, + 1199248, + 2986264, + 2985496, + 2986088, + 1094591, + 1130079, + 2225790, + 2225806, + 2225502, + 1765144, + 1432371, + 3217099, + 3214603, + 3213212, + 1390723, + 1408243, + 2801014, + 2800470, + 2801478, + 2000923, + 1393362, + 3394654, + 3394750, + 3394109, + 1381299, + 1446196, + 2828758, + 2832278, + 2831718, + 1994026, + 2869831, + 2840039, + 3000712, + 999997, + 2136989, + 2170157, + 2126445, + 1925674, + 3203099, + 3084794, + 996221, + 2913160, + 1002958, + 1861945, + 2002299, + 994157, + 2046091, + 1600646, + 2856551, + 3001320, + 998429, + 2556323, + 1001630, + 1723367, + 2034748, + 1005213, + 2011131, + 1597382, + 2618787, + 2609155, + 996733, + 2597187, + 999550, + 1979163, + 1735863, + 1000733, + 1995147, + 2876374, + 3070985, + 2997849, + 3040425, + 1003805, + 1953355, + 2054924, + 996734, + 1869561, + 1600741, + 2610243, + 2963736, + 2780629, + 2100269, + 2095628, + 1956106, + 998429, + 1920122, + 2549267, + 2894279, + 2907063, + 3026313, + 992958, + 2090828, + 2003067, + 1001373, + 1975643, + 1698535, + 2616243, + 2687076, + 1100127, + 2843782, + 1001005, + 2108141, + 2305311, + 996942, + 1959418, + 2999961, + 3102346, + 3098938, + 3077370, + 1782520, + 2194797, + 1802232, + 1837513, + 1818264, + 2833094, + 2753829, + 1285778, + 3086457, + 1201040, + 2479169, + 2480354, + 1203808, + 2391457, + 1593238, + 2785270, + 2467041, + 1195568, + 2785221, + 1116607, + 2323984, + 2351376, + 1184480, + 2315087, + 3345021, + 3450958, + 1436915, + 3803763, + 3766435, + 1613494, + 3065578, + 1755383, + 3380574, + 3366285, + 1993562, + 3729890, + 1305394, + 3295676, + 3301821, + 1391139, + 2698900, + 1806152, + 3199227, + 3200235, + 2292655, + 4090839, + 3218748, + 3289932, + 998797, + 2023355, + 2038204, + 1271713, + 2233263, + 2987385, + 2874839, + 1121631, + 2940824, + 2884358, + 1178320, + 2386192, + 1218368, + 2385056, + 2405041, + 1685671, + 2910695, + 989725, + 2684836, + 2659476, + 2025419, + 1104527, + 2314351, + 2232143, + 2236030, + 1695223, + 3799267, + 4114264, + 4086375, + 1178864, + 3482079, + 1309457, + 2290991, + 2315743, + 1791400, + 3101626, + 1403731, + 3193659, + 3193899, + 1196256, + 2581731, + 1948106, + 2107436, + 2525154, + 2611924, + 1285985, + 2987928, + 3130347, + 2487537, + 2094796, + 2117821, + 2120332, + 1498052, + 2479522, + 901565, + 2358576, + 2349712, + 1917657, + 2127404, + 2123996, + 2128461, + 2604308, + 1112671, + 2802406, + 2744261, + 2725732, + 1088094, + 1958267, + 2101788, + 2096749, + 1814488, + 2902455, + 1200864, + 2982473, + 2999736, + 1171712, + 2371376, + 1239201, + 2414624, + 2415489, + 1789400, + 2944056, + 1180752, + 2884039, + 2855766, + 1213408, + 2519874, + 1308706, + 2602451, + 2669796, + 1906266, + 3094570, + 1294801, + 3194891, + 3174523, + 2267966, + 1004414, + 2089356, + 2034060, + 2031467, + 1693815, + 1201728, + 2762501, + 2892071, + 2847847, + 1096031, + 2188797, + 2308719, + 2320576, + 1677095, + 3005096, + 2461297, + 2670628, + 896940, + 1796312, + 1941162, + 897980, + 1790008, + 1599814, + 2483122, + 2484993, + 2610211, + 2114812, + 2017323, + 2091869, + 1196048, + 2320912, + 2791925, + 2999785, + 1205520, + 2912743, + 2886535, + 1210993, + 2413968, + 1308049, + 2603268, + 2532050, + 2786854, + 994749, + 2677749, + 2608963, + 2614883, + 1000990, + 1208976, + 2069676, + 2195341, + 2196973, + 1772280, + 2571939, + 2593363, + 2682772, + 896028, + 1901097, + 2006843, + 2098092, + 2924824, + 2912680, + 2803318, + 2878055, + 990205, + 2082892, + 2020235, + 1107807, + 2018011, + 1593654, + 2707268, + 2708277, + 994541, + 2612196, + 1002110, + 2016187, + 1999994, + 1994202, + 2600371, + 2569795, + 2600099, + 1113247, + 2737669, + 1185344, + 2276543, + 2284335, + 1211344, + 2359504, + 1808008, + 2995129, + 3059849, + 1292578, + 3103018, + 1296321, + 2469425, + 2587122, + 1186816, + 2537474, + 1821001, + 3099130, + 3043881, + 1196192, + 3182907, + 1204784, + 2402672, + 2401233, + 1083855, + 2092732, + 1799976, + 2884039, + 2884791, + 1211425, + 2990441, + 1302401, + 2512578, + 2512194, + 1288401, + 2624691, + 2797462, + 2886407, + 2807846, + 2827862, + 1302514, + 2599475, + 2513137, + 1395651, + 2642500, + 1804328, + 3342429, + 3363790, + 1078479, + 2881879, + 1696519, + 1845593, + 1187392, + 2084796, + 2085724, + 1922874, + 3109802, + 1101294, + 3107578, + 3064425, + 984078, + 2082428, + 1969899, + 2246638, + 2600515, + 2596627, + 899228, + 2481793, + 2281663, + 1111247, + 2010875, + 1875081, + 2040620, + 1496564, + 2391792, + 2508530, + 899628, + 2372288, + 1717656, + 1698695, + 1802505, + 2017595, + 1614757, + 2588402, + 2612243, + 1191264, + 2565650, + 2312608, + 2372464, + 2090637, + 2140845, + 2502226, + 2685060, + 2706084, + 2659284, + 2305327, + 2307215, + 1205024, + 2597171, + 2527362, + 3011785, + 1298497, + 3309164, + 3220684, + 3260524, + 1193904, + 1306354, + 2501282, + 2501857, + 2500626, + 1807848, + 1387923, + 3193627, + 3192811, + 3193771, + 988125, + 1968282, + 2095757, + 2094829, + 2603043, + 1001982, + 2590147, + 2527746, + 2514482, + 997133, + 1097567, + 2301135, + 2349296, + 2325407, + 1952346, + 1056111, + 2762373, + 2747909, + 2774949, + 989293, + 2003611, + 2085260, + 2076796, + 2598947, + 1006414, + 2603747, + 2537666, + 2523874, + 994381, + 1116399, + 2114732, + 2122461, + 2128989, + 1582485, + 1004382, + 2584915, + 2570963, + 2577091, + 1095279, + 1007213, + 2105101, + 2105404, + 2106860, + 1589270, + 1011213, + 2580355, + 2566563, + 2614851, + 994510, + 1003917, + 1998346, + 2011499, + 1964891, + 1590742, + 2578403, + 2694421, + 2683988, + 2000619, + 1004925, + 2013211, + 1931706, + 1948218, + 1704727, + 996894, + 2695780, + 2700229, + 2700565, + 991885, + 1958170, + 1960698, + 2103468, + 1920058, + 3024953, + 1296161, + 3308252, + 3208316, + 2179245, + 1105839, + 1888169, + 2073660, + 2000924, + 1803737, + 2796838, + 2701684, + 2815798, + 987245, + 2072331, + 1993867, + 1978123, + 2496290, + 2524002, + 2312047, + 2399392, + 896732, + 1891913, + 1788969, + 1804792, + 2629892, + 2629540, + 2628915, + 2596227, + 1004366, + 1989274, + 1910314, + 1925978, + 991101, + 1605478, + 2670004, + 2655700, + 2657252, + 1010030, + 991565, + 1931850, + 1943258, + 1942442, + 992093, + 1713143, + 2674868, + 2727077, + 2701972, + 1294162, + 1203648, + 2496338, + 2494626, + 2496114, + 1190400, + 1608534, + 2799381, + 2781557, + 2801014, + 991885, + 1004062, + 2011547, + 2009579, + 2030732, + 992381, + 2668196, + 2773925, + 2826806, + 1285217, + 3192155, + 2171149, + 2250783, + 1815065, + 1988475, + 2397697, + 2397744, + 2550690, + 2568275, + 1053518, + 2225358, + 2145917, + 990286, + 2051179, + 1602901, + 2570019, + 2607171, + 1102063, + 2594899, + 1880361, + 1962538, + 1789512, + 1793896, + 2397632, + 2410993, + 2404993, + 2505186, + 1798297, + 1811928, + 1693383, + 1886329, + 2400496, + 2373520, + 2396752, + 2302159, + 1217585, + 2025964, + 2202510, + 2209454, + 2609235, + 2695060, + 2785349, + 2596051, + 1005357, + 1810441, + 1986427, + 2005259, + 1195616, + 2816918, + 3015801, + 2962728, + 1196944, + 3008472, + 2085948, + 2162829, + 1890474, + 2102156, + 2503874, + 2615124, + 1203648, + 2909591, + 2803494, + 2182429, + 1105455, + 2192493, + 2117996, + 2122621, + 1783560, + 1009262, + 2789238, + 2792406, + 2798854, + 992589, + 1003534, + 1979515, + 1977867, + 1971834, + 1596213, + 1004462, + 2623011, + 2634979, + 2612643, + 1094830, + 1318274, + 2395168, + 2392049, + 2393377, + 1788888, + 1095887, + 2883767, + 2903991, + 2950248, + 998686, + 1004461, + 1893689, + 1872921, + 1939450, + 1586069, + 2590259, + 2595043, + 2597747, + 1895626, + 1794936, + 1891465, + 1826377, + 1629350, + 2618979, + 1201088, + 2816230, + 2840934, + 1396339, + 2598483, + 1305282, + 2702549, + 2701861, + 1796856, + 3131019, + 1185472, + 2981032, + 2983320, + 1195056, + 2564642, + 2061948, + 2212190, + 2519394, + 2944328, + 1205152, + 3105033, + 3021705, + 1290610, + 2455473, + 1305473, + 2584339, + 2647876, + 1786168, + 3009256, + 1196817, + 2984712, + 2963944, + 2079197, + 902796, + 1792600, + 1906713, + 1811289, + 5622044, + 1190416, + 6778556, + 6818396, + 6794987, + 1214176, + 1441539, + 2666356, + 2712340, + 2697765, + 1862521, + 967853, + 2813254, + 2808390, + 2804005, + 1001310, + 999053, + 2001739, + 1998843, + 2000539, + 1621350, + 2715556, + 2778918, + 2771254, + 2185822, + 1325826, + 2413057, + 2351695, + 2359232, + 1774024, + 990157, + 2947176, + 2985912, + 2984392, + 1212992, + 1101887, + 2135084, + 2106093, + 1695575, + 1464676, + 3069594, + 3130826, + 1018494, + 1266705, + 2381008, + 2313087, + 1765735, + 1302322, + 3066393, + 3066330, + 1297105, + 1187296, + 2363615, + 2481810, + 1912330, + 2913351, + 3007337, + 32975901, + 2755541, + 32882507, + 32918284, + 894940, + 1908202, + 901324, + 1790792, + 1796280, + 1637430, + 2507793, + 1063231, + 2697572, + 2697988, + 898524, + 1992603, + 899676, + 1797928, + 1798153, + 1721415, + 2587379, + 1413011, + 3125258, + 3131434, + 1177712, + 2591555, + 2366816, + 2420561, + 1682167, + 3008905, + 3038985, + 981421, + 2763221, + 896828, + 1968186, + 1890266, + 899292, + 1790424, + 1500820, + 2363839, + 2438641, + 900172, + 2401297, + 929821, + 1824505, + 1826408, + 1176480, + 2096844, + 2799430, + 2884631, + 1202976, + 2990280, + 2919991, + 981069, + 2147885, + 902252, + 1880010, + 1939594, + 1498117, + 2429729, + 901452, + 2397728, + 2399841, + 897452, + 1806872, + 901084, + 1708471, + 1747687, + 1604502, + 2511842, + 1215632, + 2905831, + 2835558, + 1194336, + 2365520, + 1300706, + 2484210, + 2520802, + 1796824, + 3099274, + 1117551, + 2826790, + 2888887, + 1181520, + 2295935, + 2285375, + 2301167, + 1777560, + 2966648, + 2918807, + 1381826, + 3135914, + 1218833, + 2604531, + 2604388, + 1120623, + 2347104, + 3025080, + 3151594, + 2992440, + 3011769, + 1766056, + 1953803, + 1685734, + 1792888, + 1498309, + 2515234, + 2439584, + 898444, + 2483986, + 1137823, + 2004283, + 2023516, + 961485, + 2104076, + 1500692, + 2473682, + 2467009, + 898380, + 2308239, + 902125, + 1794568, + 1779832, + 1998731, + 1819657, + 3022856, + 2960104, + 2939832, + 1271361, + 1409795, + 2682740, + 2682532, + 2682036, + 1188592, + 1806744, + 3003225, + 2985784, + 3009160, + 1192353, + 1202176, + 2373696, + 2389952, + 2415265, + 1196128, + 1804104, + 3003113, + 3042201, + 2994728, + 1386099, + 1420915, + 2792725, + 2791798, + 2792070, + 1183824, + 1805976, + 2992489, + 2991256, + 2992440, + 1294818, + 1206400, + 2387984, + 2482497, + 2458593, + 1200336, + 1819273, + 2934792, + 3100586, + 3031689, + 1200832, + 1314338, + 2600147, + 2544546, + 2546691, + 8074669, + 1033742, + 9117691, + 9113659, + 9111610, + 1286529, + 1882329, + 3162698, + 3166075, + 3166459, + 1200880, + 1209137, + 2409489, + 2411424, + 2470194, + 1206224, + 1890954, + 3099962, + 3097946, + 3037448, + 1095198, + 988942, + 2097020, + 2087292, + 2089085, + 1025389, + 1707399, + 2720373, + 2729013, + 2728804, + 1172192, + 992334, + 2167581, + 2167853, + 2171662, + 1129759, + 1789528, + 2915863, + 2916392, + 2914151, + 1190976, + 1512964, + 2561011, + 2621348, + 2593491, + 1183568, + 2969224, + 2969592, + 2972648, + 1002125, + 2888727, + 2029755, + 2117948, + 1088527, + 2103997, + 2240990, + 1796936, + 2884455, + 1201216, + 2915623, + 2961480, + 1235185, + 2439825, + 2185502, + 2447217, + 1495540, + 2443377, + 2563474, + 897852, + 2207454, + 1004269, + 1790472, + 1907482, + 2049084, + 1710807, + 3005833, + 2927831, + 3040169, + 1189744, + 2388016, + 2501906, + 2485746, + 1380291, + 2764981, + 2897463, + 3191051, + 1084815, + 2808838, + 2774901, + 1311457, + 2241422, + 1202720, + 2516514, + 2514114, + 1998250, + 3168891, + 1201857, + 3197723, + 3200716, + 1080894, + 2283822, + 1195520, + 2280687, + 2258590, + 2831447, + 2830406, + 3052137, + 2934615, + 1162767, + 2452289, + 1206209, + 2326048, + 2341056, + 2825734, + 1116287, + 2910839, + 2833350, + 2874327, + 1092975, + 1096494, + 2053211, + 2158349, + 2200286, + 1722327, + 1102767, + 2912200, + 2831238, + 2869735, + 1275138, + 2553506, + 2644612, + 2706980, + 1988747, + 3368909, + 1019118, + 3009512, + 3007929, + 895132, + 2003851, + 900508, + 1766856, + 1780328, + 1704487, + 2615395, + 2805477, + 2945784, + 2292831, + 2394736, + 2297583, + 2527874, + 1801208, + 3116538, + 3129914, + 1212928, + 2971817, + 1478548, + 2680453, + 2721317, + 1188560, + 2669492, + 1822265, + 3012744, + 3011064, + 1179216, + 3000600, + 1317810, + 2497986, + 2497458, + 1181808, + 2499378, + 1586677, + 2658740, + 2778821, + 1010366, + 2602483, + 2002107, + 1920890, + 1005486, + 1916826, + 2086892, + 1803304, + 2922216, + 1206496, + 3089273, + 3023208, + 1193456, + 2359007, + 1102511, + 2198174, + 2216590, + 1579301, + 2694453, + 2481282, + 2477698, + 1911754, + 1909961, + 1896153, + 1896585, + 1501236, + 2485202, + 2404401, + 2400801, + 1799977, + 1798984, + 1800136, + 1796728, + 2399536, + 2400304, + 2397728, + 2398400, + 1798760, + 1705479, + 1786377, + 1801400, + 2618484, + 2704645, + 2628163, + 2601043, + 1891322, + 2001259, + 2001467, + 1996811, + 2504657, + 2600195, + 2524450, + 2503266, + 1777544, + 1765384, + 1795800, + 1799032, + 2399665, + 2292735, + 2304799, + 2397345, + 1814776, + 1812232, + 1812840, + 1905145, + 2486418, + 2490786, + 2578979, + 2399697, + 1797912, + 1795416, + 1802616, + 1806984, + 2411712, + 2409792, + 2408881, + 2393728, + 1802505, + 1803577, + 1711511, + 983885, + 1996363, + 2483329, + 2489233, + 2397840, + 2400993, + 1793464, + 1892506, + 1900282, + 1899417, + 2500098, + 2499921, + 2399328, + 2423217, + 1798648, + 1797273, + 1799336, + 1800088, + 2400721, + 2400688, + 2400241, + 2397504, + 1799048, + 1797944, + 1799224, + 1799977, + 2408736, + 2410529, + 2400417, + 2278559, + 1792808, + 1793592, + 1799992, + 1797752, + 2438785, + 2438465, + 2500641, + 2500801, + 1993098, + 1993579, + 2004219, + 2006971, + 2488162, + 2484481, + 2407905, + 2406513, + 1798440, + 1705511, + 1789592, + 1790568, + 2398449, + 2498450, + 2397408, + 2400496, + 1792888, + 1791304, + 1801001, + 1799785, + 2398896, + 2400496, + 2398992, + 2397280, + 1797480, + 1796681, + 1799000, + 1799160, + 2410369, + 2404240, + 2515698, + 2516210, + 2103164, + 2111245, + 1989259, + 1992715, + 2395120, + 2392880, + 2393776, + 2392528, + 1793385, + 1793480, + 1810697, + 1810057, + 2398192, + 2388896, + 2392240, + 2392048, + 1797928, + 1805353, + 1799688, + 1803496, + 2410977, + 2312191, + 2397793, + 2397489, + 1894233, + 1912666, + 1899257, + 1897529, + 2380928, + 2394817, + 2412481, + 2513522, + 1793304, + 1919625, + 1001181, + 1995435, + 1903946, + 1597718, + 2573555, + 1001229, + 2577571, + 2625027, + 996574, + 1997915, + 1008061, + 2013787, + 2009019, + 1596998, + 2506530, + 999357, + 2592915, + 2575683, + 2082716, + 1999595, + 2001659, + 1999403, + 2619059, + 2598867, + 2597091, + 2598643, + 1973307, + 1997707, + 1892201, + 1994171, + 2604115, + 1216896, + 2993497, + 2917047, + 3020729, + 1181248, + 1205633, + 2389408, + 2388128, + 2394832, + 1902553, + 2884855, + 3021433, + 3045481, + 1235921, + 2437681, + 1181376, + 2292319, + 2307343, + 2788838, + 2677172, + 2680260, + 2689380, + 1971658, + 1895113, + 1892153, + 1892457, + 2594179, + 2598467, + 2599043, + 2598787, + 1997787, + 1997563, + 1997851, + 1997467, + 2594883, + 2599107, + 2600019, + 2599203, + 2008667, + 1998891, + 1998859, + 2000283, + 2424865, + 2401361, + 2402785, + 2400449, + 1788280, + 1811912, + 1810952, + 1816552, + 2494945, + 2487569, + 2489233, + 2484690, + 2894727, + 3000921, + 3000648, + 3005497, + 2691189, + 2596163, + 2598963, + 2696036, + 2001243, + 1998203, + 1896042, + 1995131, + 2607843, + 2699572, + 2700372, + 2826246, + 2094844, + 1998987, + 1998587, + 1970442, + 2524722, + 2499570, + 2499506, + 2496626, + 1869961, + 1900777, + 1900825, + 1806808, + 2595587, + 2604100, + 2705317, + 2722789, + 2001435, + 2313999, + 2307567, + 2308575, + 2898663, + 1021806, + 2775957, + 2684372, + 2718341, + 994125, + 1005422, + 2003355, + 1999739, + 2001483, + 1610918, + 2484193, + 2517538, + 2502738, + 1998218, + 1883897, + 1881225, + 1885433, + 2397665, + 2398657, + 2397233, + 2396657, + 1789896, + 1800184, + 1801544, + 1802184, + 2397696, + 2399216, + 2397872, + 2404208, + 1797736, + 1804152, + 1805176, + 1798824, + 2401345, + 2396593, + 2396593, + 2492882, + 1793784, + 1797288, + 1798632, + 1703223, + 2400400, + 2396928, + 2398544, + 2395824, + 1802712, + 1801401, + 1801785, + 1804377, + 2396177, + 2398080, + 2394992, + 2400400, + 1797208, + 1800104, + 1797576, + 1897513, + 2400160, + 2398544, + 2303631, + 2496674, + 1799032, + 1799049, + 1796809, + 1704375, + 2399921, + 2403904, + 2404976, + 2403664, + 1799816, + 1923658, + 1924026, + 2014811, + 2499042, + 2370176, + 2371664, + 2375040, + 896700, + 1915770, + 900780, + 1702103, + 1887257, + 1499060, + 2393136, + 2406849, + 2423249, + 1798536, + 2005179, + 1893865, + 1879065, + 2392048, + 2431249, + 903212, + 2408273, + 2403009, + 898717, + 1781576, + 1896169, + 1816472, + 2501729, + 2388864, + 2393840, + 2484210, + 1800696, + 1800649, + 1798841, + 1703703, + 2398640, + 2402497, + 2399584, + 2399632, + 1795416, + 1799880, + 1799336, + 1897705, + 2395168, + 2401136, + 2399232, + 2400897, + 1799689, + 1797929, + 1799737, + 1701847, + 2399312, + 2399296, + 2501217, + 2499905, + 1900234, + 1903978, + 1797353, + 1797353, + 2398928, + 2394368, + 2398688, + 2498321, + 1799992, + 1799288, + 1801144, + 1706887, + 2405120, + 2407617, + 2401553, + 2396753, + 1794745, + 1793384, + 1803144, + 1812680, + 2513938, + 2513890, + 2494785, + 2607155, + 1799896, + 1909145, + 1799273, + 1679063, + 2385952, + 2390448, + 2399456, + 2504593, + 1805305, + 2009899, + 1898346, + 1795241, + 2409200, + 2603635, + 2499729, + 2499393, + 1885898, + 1880617, + 1899578, + 2001899, + 1501604, + 2491217, + 2408433, + 897180, + 2392288, + 900716, + 1786760, + 1830697, + 1024430, + 1851353, + 2699188, + 2778261, + 2683492, + 2752117, + 2117549, + 2101885, + 2094940, + 2011147, + 2386448, + 2303327, + 2397457, + 2391841, + 1792104, + 1884729, + 1798776, + 1798184, + 2398512, + 2399456, + 2399056, + 2400112, + 1798728, + 1795161, + 1799496, + 1798888, + 2402705, + 2404144, + 2400449, + 2405377, + 1797512, + 1796504, + 1799528, + 1794984, + 2399856, + 2401409, + 2399216, + 2399856, + 1900026, + 1812120, + 1901274, + 1903354, + 2510962, + 2623731, + 2498706, + 2499010, + 1888410, + 1992171, + 2002603, + 2001995, + 2512578, + 2615555, + 2500929, + 2498065, + 1785928, + 1786568, + 1799081, + 1799449, + 2397152, + 2397072, + 2398624, + 2398848, + 1805016, + 1803641, + 1799384, + 1800152, + 2400945, + 2411088, + 2502226, + 2505250, + 1776056, + 1889449, + 1797624, + 1796504, + 2397488, + 2397264, + 2397680, + 2525682, + 1812233, + 1904106, + 2011387, + 1884089, + 1800089, + 2995416, + 2926135, + 3117274, + 1293202, + 2700196, + 2614483, + 2612996, + 1284337, + 1724135, + 2924471, + 2897415, + 3007241, + 974990, + 1873305, + 1779336, + 1971002, + 1795128, + 2393696, + 2394304, + 2295023, + 2394400, + 1797848, + 1794296, + 1794744, + 1799016, + 2400657, + 2400897, + 2400977, + 2399857, + 1799176, + 1798728, + 1801512, + 1798776, + 2399152, + 2398896, + 2398384, + 2399152, + 1798840, + 1798984, + 1803912, + 1800088, + 2400897, + 2401041, + 2395121, + 2399953, + 1799288, + 1798664, + 1800088, + 1802344, + 2400096, + 2400480, + 2399408, + 2398016, + 1800217, + 1800313, + 1799785, + 1800073, + 2524849, + 2525281, + 2530834, + 2498977, + 1776471, + 1781640, + 1782152, + 1799704, + 2390513, + 2495314, + 41618289, + 41109993, + 2221902, + 41005096, + 889468, + 1979675, + 2404369, + 2403489, + 2517522, + 2422624, + 2002075, + 2003579, + 1986587, + 2081948, + 2490225, + 2602467, + 997918, + 2417761, + 2594403, + 987357, + 1987179, + 1896185, + 1896234, + 2392464, + 2405152, + 2401537, + 2404576, + 1802777, + 1688631, + 1798472, + 1810120, + 2515570, + 2527490, + 2510098, + 2498786, + 1874601, + 1887593, + 1906105, + 1826249, + 2497122, + 2499474, + 2465041, + 2483922, + 1798312, + 1795016, + 1796472, + 1795208, + 2403024, + 2401808, + 2400944, + 2401200, + 1796825, + 1796841, + 1813961, + 1812905, + 2398416, + 2398496, + 2384544, + 2386160, + 1799736, + 1799768, + 1797688, + 1797208, + 2400848, + 2400976, + 2410721, + 2408689, + 1803257, + 1805113, + 1791192, + 1793752, + 2404624, + 2510385, + 2397168, + 2394672, + 1795128, + 1797497, + 1800488, + 1800536, + 2508370, + 2511809, + 2603123, + 2735365, + 914733, + 2002283, + 1913738, + 980829, + 1865577, + 1501412, + 2484929, + 2483938, + 896812, + 2398449, + 902428, + 1777528, + 1813609, + 897196, + 1799736, + 1501493, + 2283727, + 2392480, + 2612819, + 2099564, + 2112364, + 2222670, + 897372, + 1913434, + 1503012, + 2391281, + 2387904, + 896492, + 2367840, + 903756, + 1799272, + 1799432, + 895677, + 1798152, + 1502772, + 2393696, + 2393280, + 2416832, + 1900201, + 1903834, + 1900170, + 1022990, + 1914090, + 1795480, + 2813142, + 2819238, + 2980680, + 2082860, + 2081212, + 2119884, + 906797, + 1912250, + 1718599, + 2584179, + 2623667, + 1187488, + 2885367, + 982893, + 2177373, + 2235646, + 1998763, + 2605267, + 2615348, + 2566979, + 892748, + 2407280, + 1703847, + 1779208, + 1801400, + 1789464, + 2386000, + 2383824, + 2399809, + 2399313, + 1799352, + 1696103, + 1801352, + 1802792, + 2399296, + 2400480, + 2401856, + 2405136, + 1799800, + 1801193, + 1806233, + 1809177, + 2402737, + 2507265, + 2384160, + 2386368, + 1801624, + 1794873, + 1798376, + 1798792, + 2397344, + 2399648, + 2400080, + 2400273, + 1798009, + 1793368, + 1800265, + 1801816, + 2399168, + 2400608, + 2398768, + 2398336, + 1798600, + 1801225, + 1799528, + 1799000, + 2401793, + 2298799, + 2400865, + 2400097, + 1798968, + 1795336, + 1799240, + 1799384, + 2399248, + 2502946, + 2539602, + 2539922, + 1898874, + 1795800, + 1766136, + 1871065, + 2400800, + 2402720, + 2394592, + 2397937, + 1802360, + 1801592, + 1799624, + 1815208, + 2397328, + 2485570, + 2398865, + 2380016, + 1799225, + 1812424, + 1920009, + 1916490, + 2503201, + 2509138, + 898525, + 2482418, + 2409984, + 898940, + 1782024, + 2282287, + 2413072, + 2998216, + 3032713, + 901740, + 2381281, + 2517746, + 901500, + 1773336, + 1717287, + 1786888, + 2401057, + 2304527, + 2391520, + 2388304, + 1797352, + 1792712, + 1793160, + 1800073, + 2399920, + 2399808, + 2402672, + 2401296, + 1798616, + 1798489, + 1797497, + 1798712, + 2399633, + 2399872, + 2402320, + 2400368, + 1799208, + 1798680, + 1799480, + 1796953, + 2399216, + 2399472, + 2401377, + 2400192, + 1805305, + 1805609, + 1804696, + 1701975, + 2396560, + 2395856, + 2496770, + 2500082, + 1899338, + 1899626, + 1796728, + 1791880, + 2399056, + 2399888, + 2396080, + 2397088, + 1799208, + 1798296, + 1799464, + 1900858, + 2401344, + 2401873, + 2399489, + 2421440, + 1797225, + 1897241, + 1798728, + 1777992, + 2516210, + 2514562, + 2500161, + 2510562, + 901949, + 1883321, + 1816568, + 896892, + 1795976, + 1501892, + 2271007, + 2399040, + 899612, + 2291807, + 1812264, + 1824665, + 1808825, + 1905994, + 2383168, + 2604436, + 2605699, + 2605075, + 2071196, + 1963818, + 1895817, + 1990602, + 2433025, + 2450465, + 2394465, + 2395153, + 1777752, + 1786136, + 1815560, + 1925162, + 2396416, + 2396400, + 2395936, + 2397056, + 1796360, + 1798616, + 1901722, + 1903882, + 2498866, + 2498578, + 2391408, + 2287182, + 1826489, + 1825657, + 1802377, + 1800457, + 2384752, + 2387184, + 2401696, + 2409424, + 1809320, + 1812344, + 1790616, + 1786344, + 2378432, + 2384336, + 2398480, + 2400256, + 1798296, + 1795688, + 1798889, + 1797753, + 2709333, + 2710981, + 2699236, + 2700612, + 1795512, + 1917562, + 9517968, + 9625170, + 9499008, + 9472735, + 1786568, + 1677590, + 2396848, + 2407313, + 2395792, + 2395840, + 1801065, + 1822344, + 1797529, + 1897386, + 2397808, + 2374992, + 2398672, + 2409120, + 1799944, + 1700391, + 1890601, + 1901962, + 2498722, + 2603027, + 2414865, + 2387168, + 1908762, + 1907258, + 1893289, + 1800377, + 1605381, + 2395712, + 2615587, + 1193344, + 2918567, + 2069948, + 2291263, + 2011547, + 1982027, + 2498785, + 2405232, + 901052, + 2411568, + 2532386, + 1799481, + 1810409, + 1667591, + 1696503, + 2395808, + 2388912, + 2385472, + 2386176, + 1793288, + 1800552, + 1800568, + 1895050, + 2393408, + 2399313, + 2398721, + 2307247, + 892364, + 1898234, + 1791368, + 1794184, + 2401792, + 2400016, + 2405104, + 2405328, + 1800248, + 1797833, + 1797784, + 1797784, + 2409281, + 2409040, + 2400401, + 2400417, + 1791896, + 1701431, + 1796472, + 1796088, + 2399824, + 2493121, + 2498402, + 2502434, + 1899402, + 1924922, + 1932650, + 2031883, + 2503457, + 2389809, + 2382528, + 2583186, + 1895834, + 1890089, + 1793752, + 1797209, + 2400112, + 2399856, + 2290447, + 2391393, + 1799113, + 1798457, + 1800392, + 1803272, + 2411968, + 2521106, + 2404448, + 2502161, + 1792536, + 1779672, + 1800808, + 1800921, + 2398513, + 2397424, + 2395345, + 2395776, + 1800120, + 1800296, + 1799240, + 1798648, + 2401744, + 2400832, + 2406064, + 2402673, + 1001486, + 1913530, + 1905498, + 989597, + 1989786, + 2492865, + 2494674, + 2401744, + 2423889, + 1803256, + 1898522, + 1899562, + 1885305, + 2396864, + 2400768, + 2299263, + 2405616, + 1911994, + 1901978, + 1894906, + 1887242, + 2495586, + 2499074, + 2498658, + 2499602, + 1790872, + 1794200, + 1801928, + 1801656, + 2393856, + 2393424, + 2518210, + 2522578, + 1897466, + 1901498, + 1776456, + 1788408, + 2402320, + 2398912, + 2395936, + 2390912, + 1799720, + 1799800, + 1816153, + 1822409, + 2498530, + 2502050, + 2478129, + 2482353, + 1797672, + 1793064, + 1913146, + 1911338, + 2502306, + 2503922, + 2392720, + 2489969, + 1802280, + 1807640, + 1790280, + 1790008, + 2392304, + 2395504, + 2399552, + 2401137, + 1798457, + 1799065, + 1799321, + 1800568, + 2514785, + 2600483, + 2500097, + 2520866, + 902173, + 1912042, + 1846857, + 897340, + 1766968, + 2275311, + 2342271, + 2399888, + 2401632, + 1795000, + 1796072, + 1799192, + 1798840, + 2402864, + 2315343, + 2520514, + 2714069, + 2112717, + 2235615, + 1201152, + 2292271, + 2204397, + 1797320, + 2957687, + 1298770, + 3097226, + 3108122, + 985629, + 2294399, + 899276, + 1889417, + 1875658, + 1499140, + 2392225, + 901405, + 2401361, + 2400592, + 899132, + 1827336, + 900540, + 1801144, + 1812264, + 1497460, + 2375216, + 902812, + 2394720, + 2386512, + 1727095, + 1807912, + 1709159, + 1814825, + 2390849, + 2395441, + 2401041, + 2396640, + 1813336, + 1798968, + 1795240, + 1802632, + 2389792, + 2400080, + 2400368, + 2400993, + 1795304, + 1797833, + 1797385, + 1798376, + 2503266, + 2621283, + 2634371, + 2618259, + 1896026, + 1806216, + 1798104, + 1719927, + 2413536, + 2468769, + 2478642, + 2479074, + 1900394, + 1814360, + 1817288, + 1823273, + 2395216, + 2372096, + 2377232, + 2380992, + 1796936, + 1799704, + 1793336, + 1806824, + 2401345, + 2399025, + 2399425, + 2393297, + 1892617, + 1901001, + 1900969, + 1898937, + 2399216, + 2397712, + 2398064, + 2398176, + 1802441, + 1800185, + 1800601, + 1800440, + 2399088, + 2500289, + 2500817, + 2500081, + 1895898, + 1798377, + 1797961, + 1798169, + 2399728, + 2406000, + 2407072, + 2507009, + 1798152, + 1793416, + 1792584, + 1794249, + 2399712, + 2399569, + 2399521, + 2400640, + 1799865, + 1799992, + 1697927, + 1800024, + 2399616, + 2399584, + 2397792, + 2400320, + 1810456, + 1799832, + 1798184, + 1804584, + 2391329, + 2409841, + 2507842, + 2524146, + 1801368, + 1794632, + 1796072, + 1792393, + 2402720, + 2402608, + 2309919, + 2298814, + 1802969, + 1894442, + 1902042, + 1903210, + 2602563, + 2494450, + 2492130, + 2498018, + 1797528, + 3018104, + 3011192, + 3015608, + 3592832, + 2388816, + 2388817, + 2490322, + 1809353, + 1901178, + 1901353, + 1809016, + 2493345, + 2483490, + 2492258, + 2495138, + 1895034, + 1792120, + 1792216, + 1792168, + 2397600, + 2399904, + 2401808, + 2402160, + 1796792, + 1800504, + 1798072, + 1800520, + 2393440, + 2400961, + 2399489, + 2399633, + 1822217, + 1800120, + 1801688, + 1802376, + 2494994, + 2599843, + 2602579, + 2600755, + 1892841, + 1794552, + 1794968, + 1795080, + 2408945, + 2397393, + 2397873, + 2495554, + 894988, + 1878377, + 1809272, + 1813624, + 2401648, + 2418161, + 2621283, + 2616260, + 2011467, + 1899465, + 994621, + 1971931, + 1898105, + 2601235, + 2496866, + 2493938, + 2530914, + 896444, + 1896922, + 1859561, + 1974922, + 2599571, + 2587970, + 2601523, + 2509026, + 2003851, + 1905258, + 1795176, + 1803960, + 2396512, + 2394688, + 2495122, + 2498002, + 1898106, + 1897082, + 1799416, + 1796280, + 2399248, + 2399920, + 2399296, + 2398912, + 1798456, + 1798808, + 1799257, + 1802745, + 2400753, + 2401585, + 2399552, + 2406224, + 1799592, + 1799896, + 1798248, + 1788616, + 2399056, + 2398608, + 2402321, + 2402577, + 1805113, + 1809241, + 1802712, + 1802504, + 2400320, + 2401104, + 2398624, + 2398416, + 1796584, + 1793576, + 1798168, + 1798024, + 2398385, + 2401425, + 2402417, + 2404001, + 1801464, + 1895289, + 1796456, + 1796488, + 2396080, + 2402945, + 2399168, + 2397600, + 1799688, + 1797992, + 1800729, + 1801001, + 2400753, + 2376880, + 2398304, + 2397984, + 2014539, + 2043643, + 2214510, + 2345887, + 1600565, + 2796230, + 2696821, + 989438, + 2555619, + 1002781, + 1992122, + 1990026, + 995598, + 1999371, + 1601845, + 2590307, + 2583858, + 1110271, + 2740309, + 2010859, + 2114349, + 1989083, + 2116493, + 2599075, + 2494785, + 2481489, + 2478849, + 1903130, + 1901738, + 1793544, + 1905242, + 2498210, + 2500882, + 2491314, + 2488369, + 1792984, + 1793448, + 1801064, + 1711351, + 2397360, + 2510786, + 2398816, + 2384112, + 1802344, + 1809208, + 2103933, + 2110285, + 2696613, + 2585171, + 2408336, + 2408000, + 1799736, + 1796504, + 1797960, + 1799400, + 2398224, + 2396448, + 2402849, + 2408897, + 1802217, + 1801961, + 1795192, + 1902137, + 2398784, + 2399616, + 2391904, + 2389136, + 1799656, + 1798360, + 1799672, + 1799096, + 2401408, + 2401216, + 2397521, + 2396496, + 1811481, + 1917434, + 1909817, + 1804280, + 2492913, + 2497506, + 2383168, + 2385872, + 1798121, + 1693143, + 1797433, + 1802153, + 2400752, + 2507217, + 2497953, + 2493265, + 1898634, + 1895162, + 1799657, + 1799449, + 2400496, + 2400832, + 2400480, + 2400896, + 1798312, + 1815129, + 1802200, + 1811288, + 2410193, + 2293343, + 2397504, + 2388529, + 1794712, + 1887849, + 1799177, + 1799000, + 2409200, + 2311855, + 2401920, + 2406752, + 1779560, + 1789464, + 1801816, + 1798376, + 2397713, + 2394561, + 2397553, + 2396305, + 1794184, + 1794600, + 1798168, + 1796120, + 2399392, + 2401488, + 2404240, + 2406016, + 1799784, + 1799448, + 36524604, + 36528716, + 1858217, + 36517948, + 1773064, + 1778760, + 2383616, + 2384544, + 2393008, + 2392592, + 1798584, + 1796281, + 1801689, + 1802057, + 2399585, + 2399776, + 2417520, + 2415392, + 1811896, + 1812072, + 1780936, + 1784840, + 2403953, + 2406257, + 2399264, + 2397377, + 1787016, + 1789768, + 1801097, + 1801240, + 2393952, + 2393936, + 2397920, + 2397904, + 1798984, + 1798360, + 1800792, + 1801064, + 2399345, + 2403281, + 2399921, + 2399585, + 1799576, + 1796520, + 1800808, + 1801224, + 2399952, + 2399936, + 2397616, + 2399296, + 1799080, + 1798792, + 1797928, + 1896186, + 2401313, + 2539187, + 901212, + 2499602, + 2425808, + 913372, + 1677286, + 988061, + 1782600, + 1907482, + 2604051, + 2616180, + 2611507, + 2613859, + 878796, + 1981275, + 1792600, + 1795016, + 2401024, + 2297967, + 2288303, + 2492113, + 1806904, + 1808296, + 1913978, + 1931594, + 2491490, + 2625252, + 901372, + 2485729, + 2375424, + 897612, + 1771335, + 902124, + 1690455, + 1789976, + 2717525, + 2798502, + 2913527, + 2857895, + 899116, + 1878649, + 900140, + 1783592, + 1797832, + 1499044, + 2394481, + 900620, + 2395969, + 2399968, + 898125, + 1791144, + 1913386, + 1949867, + 2739764, + 2757077, + 1280418, + 2990616, + 2938871, + 2346320, + 1205248, + 2353312, + 2399952, + 2516290, + 1887721, + 1404051, + 3201627, + 3274332, + 3275884, + 1007054, + 904092, + 1831545, + 2000283, + 1916746, + 1600661, + 2505170, + 2422065, + 2506753, + 984781, + 1989259, + 2003275, + 1990731, + 2713909, + 2924535, + 1188544, + 3074089, + 3017353, + 1220160, + 2415649, + 1181328, + 2309519, + 2346575, + 1994539, + 3143274, + 2911271, + 2971640, + 996190, + 2011819, + 1966155, + 1099423, + 2037388, + 2794598, + 2866998, + 1399843, + 3289452, + 3253020, + 1390706, + 2761813, + 1315666, + 2611443, + 2645267, + 2022683, + 3340397, + 3000344, + 3012329, + 2063948, + 2093725, + 1194832, + 2368592, + 2330367, + 1797976, + 2961640, + 2559107, + 2735045, + 899436, + 1899898, + 1874169, + 897116, + 1683223, + 1613446, + 2506418, + 2479025, + 2612147, + 1000926, + 2100076, + 2020971, + 2022075, + 1095518, + 2055404, + 3143354, + 3162875, + 3146811, + 1264865, + 2364080, + 2442193, + 2485409, + 1302642, + 2493250, + 2866295, + 3019864, + 2701268, + 2840854, + 991789, + 2077564, + 1970763, + 1884665, + 2007403, + 3126635, + 3044329, + 3090025, + 1362259, + 2202414, + 2359999, + 2354336, + 1989163, + 2497042, + 2506482, + 2511218, + 895804, + 2555106, + 901356, + 1690951, + 1747335, + 1275041, + 2140957, + 2816934, + 2845750, + 2299487, + 2526066, + 1796216, + 1793033, + 998558, + 2005835, + 1937002, + 1714359, + 2692820, + 2564147, + 2743157, + 898300, + 1968570, + 1900953, + 895596, + 1646326, + 2490034, + 2615251, + 2603363, + 2602611, + 1223872, + 2201646, + 2122845, + 2612435, + 2984569, + 2975912, + 3028744, + 888268, + 2578563, + 903692, + 1782584, + 1777016, + 894956, + 1796888, + 1502724, + 2398640, + 2399169, + 1021486, + 2518594, + 1300849, + 2315680, + 2318943, + 974302, + 2279519, + 1501476, + 2480225, + 2477121, + 897660, + 2398544, + 903708, + 1801112, + 1801641, + 897276, + 1801992, + 1641254, + 2527602, + 2534850, + 1425875, + 3148347, + 1178864, + 2606515, + 2606371, + 1172368, + 2263550, + 1581125, + 2761654, + 2757173, + 896589, + 2483394, + 902508, + 1804808, + 1799128, + 897100, + 1798504, + 1725047, + 2612771, + 2650292, + 975517, + 2764597, + 903644, + 1735879, + 1888682, + 1036942, + 1901146, + 2864902, + 3082874, + 1449076, + 3535088, + 3455950, + 1421523, + 2834374, + 1278817, + 2630371, + 2626820, + 1889929, + 3168891, + 1200385, + 3089546, + 3090409, + 1195440, + 2400272, + 1316658, + 2509298, + 2521874, + 2024667, + 3356397, + 2022651, + 4141511, + 4190121, + 1521285, + 3616529, + 1418435, + 2867783, + 2805045, + 2070284, + 3485679, + 1294305, + 3429998, + 3465183, + 1669574, + 2888647, + 2799094, + 1361539, + 2947288, + 2352783, + 3817763, + 2206846, + 4711247, + 4703167, + 1693527, + 3905317, + 1463748, + 3090394, + 3070313, + 1895417, + 3241275, + 1517493, + 3468270, + 3515984, + 1469827, + 2992793, + 1316978, + 2730229, + 2685396, + 1783016, + 3099673, + 988861, + 2779510, + 2777525, + 896556, + 1888410, + 901933, + 1797208, + 1795337, + 1918153, + 2922311, + 1407347, + 3318940, + 3325436, + 1390419, + 2796150, + 1504388, + 2897047, + 2894999, + 1993499, + 3497295, + 1299938, + 3292829, + 3295133, + 979437, + 2176989, + 1115487, + 2095580, + 2095612, + 1688903, + 2801206, + 2989080, + 3140618, + 1412307, + 2875222, + 2834486, + 1195632, + 2478337, + 1880138, + 3141275, + 3133530, + 1392786, + 3378830, + 1425924, + 2754517, + 2741845, + 2144237, + 1504980, + 2412496, + 2390720, + 2432880, + 892140, + 905660, + 1717687, + 1874713, + 1807641, + 897308, + 2398529, + 2424017, + 2453009, + 993197, + 2610003, + 1304337, + 2273966, + 2274702, + 1442372, + 2722629, + 2120252, + 3566192, + 3564512, + 1286434, + 3404270, + 1405603, + 2764854, + 2795670, + 1182543, + 2600099, + 2352896, + 3469678, + 3433630, + 1873065, + 4271497, + 1351571, + 3224284, + 3228124, + 1426563, + 2816022, + 1655542, + 3087177, + 3082409, + 1030766, + 2598035, + 1395491, + 2427441, + 2429761, + 1190272, + 2587571, + 1712999, + 2902455, + 2901895, + 1287697, + 3002280, + 1192512, + 2471857, + 2476609, + 1223345, + 2409377, + 2010971, + 3292877, + 3323469, + 1167983, + 3192651, + 2025467, + 2055052, + 992317, + 2085533, + 2002059, + 1595334, + 2556130, + 1336114, + 2910663, + 2943703, + 1383794, + 2721156, + 1944875, + 3389518, + 3467679, + 2085356, + 4031895, + 1242432, + 3189147, + 3288172, + 1194512, + 2434001, + 1973291, + 2127708, + 1499956, + 2490306, + 2464033, + 900508, + 2370944, + 900092, + 1799704, + 1798856, + 896092, + 1797256, + 1501796, + 2395056, + 2396880, + 898092, + 2399249, + 900861, + 1718968, + 1744232, + 899692, + 1802584, + 2494305, + 2493729, + 2499137, + 2526498, + 900428, + 1886009, + 1859753, + 999918, + 1867737, + 1802232, + 2798246, + 2799398, + 1202816, + 3005704, + 1193424, + 2396832, + 2398704, + 1197168, + 2391584, + 1878234, + 3001609, + 3020601, + 1395762, + 3318221, + 9044458, + 10533230, + 10495533, + 990942, + 10000359, + 1786312, + 1840281, + 1945002, + 1984186, + 1870073, + 3028600, + 2952808, + 988573, + 2837558, + 1003022, + 1970090, + 2017675, + 991773, + 1994586, + 1709111, + 2692052, + 2698773, + 996782, + 2692437, + 1002381, + 1998219, + 1996299, + 994525, + 2031147, + 1603510, + 2569378, + 2638788, + 1101663, + 2666580, + 993805, + 2057003, + 2108189, + 997838, + 1988379, + 2497921, + 2604979, + 2605443, + 2618723, + 1887450, + 1929946, + 1002957, + 1898137, + 1883369, + 1701239, + 2660356, + 2506658, + 2591571, + 896988, + 1903482, + 1842361, + 909244, + 1808088, + 1807001, + 2574467, + 2689364, + 2896807, + 1986298, + 2011243, + 2129308, + 986542, + 1885946, + 1625462, + 2590243, + 2589171, + 2513202, + 1784296, + 1668055, + 1792824, + 1892361, + 2620643, + 2709844, + 2628659, + 2601395, + 1007182, + 2082236, + 1989819, + 2034331, + 989741, + 1621174, + 2612275, + 2610723, + 2610132, + 983709, + 1009182, + 1996331, + 1978058, + 2045692, + 992429, + 2565154, + 2678084, + 2703220, + 2592675, + 1010093, + 1803464, + 1971563, + 1886970, + 983518, + 2596947, + 2498817, + 2621155, + 997086, + 2718052, + 1002381, + 2110189, + 2036459, + 992814, + 1992395, + 1610069, + 2597971, + 2602547, + 996302, + 2603011, + 998701, + 1982827, + 1994859, + 997566, + 1986075, + 1601413, + 2502609, + 2548274, + 2620355, + 1996219, + 2103357, + 2037356, + 996286, + 1990283, + 1613909, + 2613459, + 2621475, + 988909, + 2598787, + 1004894, + 1982346, + 1991835, + 992173, + 1996219, + 1608230, + 2610196, + 2600803, + 995005, + 2601171, + 1008638, + 1894185, + 1946154, + 1887497, + 2495890, + 2414305, + 2595587, + 1118655, + 2719061, + 2095900, + 2102140, + 1002861, + 2084924, + 2023947, + 1593158, + 2601235, + 1113711, + 2681188, + 2729509, + 985725, + 2099805, + 1001741, + 1992763, + 1990954, + 1598854, + 2603891, + 1000061, + 2590723, + 2597347, + 1109727, + 2102252, + 991582, + 2109164, + 2104109, + 1594613, + 2593683, + 1002110, + 2599923, + 2597859, + 1001229, + 2006315, + 1005662, + 1966314, + 2032716, + 1599573, + 2586211, + 1000158, + 2562098, + 2642596, + 989293, + 2003771, + 1003006, + 2008619, + 1992218, + 1595877, + 2605475, + 1002686, + 2596211, + 2597683, + 995581, + 1996842, + 1004829, + 1887257, + 1867961, + 2489409, + 2494898, + 2495842, + 2500050, + 1907386, + 1998411, + 2121933, + 2144621, + 1600742, + 2699380, + 999453, + 2586658, + 2591187, + 995421, + 1997851, + 1004750, + 1984955, + 1976346, + 2695700, + 2705941, + 2801958, + 2806950, + 893740, + 1978475, + 1798840, + 1819097, + 1800856, + 2824454, + 2729013, + 1104031, + 2882726, + 998621, + 2078540, + 2106908, + 991470, + 1987035, + 1884569, + 2761365, + 2875190, + 2782150, + 1910250, + 1999099, + 1950427, + 1797096, + 2399584, + 2372767, + 2425105, + 2400912, + 1943866, + 1833944, + 1945403, + 1292098, + 2428721, + 2862055, + 2873606, + 1005773, + 2582946, + 2580131, + 983198, + 1981515, + 1885706, + 1890841, + 2393344, + 2390368, + 2502145, + 2547058, + 1100943, + 2199149, + 2120893, + 996206, + 2052092, + 1603157, + 2606067, + 2629076, + 996526, + 2602659, + 1875193, + 1981834, + 1905545, + 1907642, + 2393584, + 2390401, + 2396273, + 2390288, + 1101486, + 2010091, + 1096543, + 2199341, + 1703223, + 2794469, + 2904871, + 2294975, + 2312015, + 1000189, + 2095325, + 1598166, + 2590211, + 1001085, + 2600643, + 995726, + 1997163, + 1001053, + 1995307, + 1602694, + 2604259, + 1202688, + 2810789, + 995277, + 2194574, + 1000926, + 2013179, + 1596389, + 2599699, + 1000334, + 2585107, + 1114639, + 2116908, + 986285, + 2003355, + 1915578, + 2903511, + 2794598, + 1108527, + 2073372, + 1990523, + 993741, + 1603990, + 2603811, + 2601875, + 2891319, + 3103545, + 5975904, + 6015665, + 1001646, + 1004413, + 2023612, + 1997979, + 1595878, + 1009597, + 2607395, + 2607411, + 984766, + 1004429, + 1980282, + 1995131, + 1690071, + 1016158, + 2715525, + 2700692, + 1990570, + 4597150, + 6576601, + 6589289, + 3194923, + 1102127, + 4289609, + 4287769, + 1080527, + 1207408, + 2295119, + 2290943, + 1791480, + 2620115, + 4411180, + 4414396, + 1106335, + 2689572, + 3797155, + 1267937, + 2518817, + 1322962, + 1874890, + 1300369, + 1195760, + 1103199, + 1695367, + 985245, + 898796, + 900300, + 1501061, + 914476, + 1101951, + 1307297, + 1891930, + 1299505, + 1196208, + 1091983, + 1811560, + 1192832, + 1301442, + 1201824, + 1798504, + 1201041, + 985021, + 1221104, + 1896634, + 1301921, + 1417747, + 1506469, + 1676390, + 1290178, + 1504516, + 1756487, + 2237679, + 1494500, + 990461, + 1004286, + 1800264, + 1199680, + 1298497, + 1199633, + 1898889, + 1098655, + 1110623, + 1187072, + 1909834, + 1292673, + 1201296, + 1199552, + 1794728, + 1306466, + 1308498, + 1191504, + 1804504, + 1202944, + 1300706, + 1297873, + 1806392, + 1295714, + 1302481, + 1200161, + 1919209, + 1275954 + ], + "checkpoint_ns": [ + 45988940, + 41278012, + 34660531, + 38975468 + ], + "batches": 1841, + "segment_files": 4, + "blob_files": 0, + "energy": { + "sensor": "aien_spbm hwmon, SoC package only (GB10 SPBM firmware counters: energy 1 mJ step, update about 0.1 s, sampled at 10 Hz; no published accuracy; not compared with an external meter)", + "window_s": 2.379936477, + "valid": true, + "refusal": null, + "samples": 25, + "largest_gap_ms": 101.145, + "pkg_j": 56.512, + "cpu_p_j": 16.221, + "cpu_e_j": 1.659, + "rest_j": 38.632, + "pkg_mean_w": 23.745171581737136, + "pkg_edge_sd_j": 1.9387851410030577, + "sys_total_mean_w": 26.72464, + "nvme_temp_k": 312.0, + "loadavg_start": [ + 1.52, + 3.15, + 4.05 + ], + "loadavg_end": [ + 1.52, + 3.15, + 4.05 + ], + "machine_busy_cpu_s": 3.040000000037253 + } + }, + { + "agents": 8, + "rep": 0, + "accepted": 4000, + "elapsed_ns": 1338609073, + "latency_ns": [ + 1614214, + 2619059, + 2614340, + 2720261, + 2740981, + 2772453, + 2692180, + 2713076, + 1893353, + 1795432, + 1794904, + 1699799, + 1769400, + 1771112, + 1774040, + 1786680, + 2400385, + 2396288, + 2396112, + 2276559, + 2490417, + 2424192, + 2394720, + 2379664, + 1800408, + 1799528, + 1799624, + 1705879, + 1798376, + 1772104, + 1773624, + 1775160, + 2398752, + 2402432, + 2402336, + 2400944, + 2281743, + 2395681, + 2517282, + 2403728, + 1800648, + 1801225, + 1801177, + 1802089, + 1673927, + 1804776, + 1805096, + 1947338, + 2398289, + 2521106, + 2526514, + 2508306, + 2611411, + 2530914, + 2524034, + 2523378, + 1898569, + 1892137, + 1774488, + 1802360, + 1899977, + 1909577, + 1841512, + 1926442, + 1576645, + 2613523, + 2592403, + 2595251, + 2600867, + 2593971, + 2598403, + 2597843, + 1893370, + 1892618, + 2081596, + 2077228, + 2083740, + 2175549, + 2106765, + 2110844, + 2705044, + 2803814, + 2597507, + 2510881, + 2609315, + 2467537, + 2693108, + 2595683, + 1993467, + 2028731, + 1993035, + 1979755, + 1981947, + 2078444, + 1993915, + 2036444, + 2598563, + 2599555, + 2517858, + 2516418, + 2426001, + 2517202, + 2493393, + 2486705, + 1904874, + 1767752, + 2010411, + 2009819, + 2015643, + 2016779, + 2007563, + 2014251, + 2595171, + 2698356, + 2567795, + 2573603, + 2565907, + 2574259, + 2573491, + 2558514, + 2000171, + 2014043, + 1928618, + 1928906, + 1934250, + 1932266, + 1834313, + 1930522, + 2500593, + 2521426, + 2664067, + 2668355, + 2668675, + 2667076, + 2771157, + 2697556, + 2096444, + 2095292, + 1817864, + 1822025, + 1822489, + 1824265, + 1787992, + 1825848, + 2406289, + 2381808, + 2614275, + 2611971, + 2619763, + 2618963, + 2510386, + 2615795, + 1995931, + 1984939, + 1882218, + 1882906, + 1889146, + 1888938, + 1885530, + 1889354, + 2499297, + 2555714, + 2406672, + 2409504, + 2412080, + 2503089, + 2433089, + 2538626, + 1799497, + 1798329, + 1794152, + 1701559, + 1795000, + 1884329, + 1797416, + 1795240, + 2400320, + 2394992, + 2598899, + 2599107, + 2606707, + 2566850, + 2604467, + 2590995, + 1998891, + 2005579, + 1895898, + 1799401, + 1890826, + 1895226, + 1877881, + 2020107, + 2503201, + 2501410, + 2397200, + 2397840, + 2486001, + 2429280, + 2424865, + 2421649, + 1796873, + 1843880, + 1792344, + 1657334, + 1794424, + 1789688, + 1792601, + 1772920, + 2400912, + 2331120, + 2617043, + 2623843, + 2626547, + 2500257, + 2585778, + 2626916, + 1997819, + 1998795, + 1883482, + 1800536, + 1885146, + 1975947, + 1927850, + 2013659, + 2499073, + 2546098, + 2491793, + 2496273, + 2481570, + 2497266, + 2537138, + 2649380, + 987822, + 2130589, + 2061388, + 1103742, + 2171853, + 2112476, + 2116716, + 2116589, + 2113404, + 1593702, + 2667876, + 2654227, + 2626883, + 2794790, + 2786326, + 2790806, + 2767189, + 2096620, + 2102060, + 2100989, + 1898074, + 1737944, + 1899642, + 1897689, + 1900794, + 2501250, + 2501554, + 2474161, + 2602755, + 2606851, + 2604563, + 2607507, + 2602403, + 2003131, + 2002571, + 2001723, + 2041435, + 2135868, + 2064540, + 2064924, + 2063883, + 2699908, + 2776677, + 2848470, + 1003198, + 2546018, + 2531394, + 2603187, + 2792694, + 2730133, + 988125, + 1919818, + 1892602, + 1029726, + 1892106, + 2006155, + 2014699, + 1995579, + 1997067, + 1762536, + 2825494, + 2766965, + 2581762, + 2375791, + 2394448, + 2593907, + 2470321, + 1620646, + 1885753, + 1786232, + 1900890, + 1902106, + 1983035, + 1923418, + 1911722, + 2508706, + 2569795, + 2619539, + 2604915, + 2592563, + 2677012, + 2776597, + 2658628, + 985069, + 2086364, + 1951866, + 1940730, + 898557, + 1869801, + 1851897, + 1867578, + 1867449, + 1597893, + 2464289, + 2473954, + 2665331, + 907676, + 2353295, + 2505569, + 2519666, + 2491425, + 1755624, + 1927466, + 1980410, + 2193326, + 2198926, + 2037180, + 2173341, + 2257631, + 1589061, + 2798198, + 2742117, + 2932088, + 2696372, + 2793861, + 2710789, + 2712244, + 1991531, + 1979370, + 1973371, + 1949882, + 799131, + 1778488, + 1665942, + 1733064, + 1699687, + 1615061, + 2292463, + 2438513, + 2419600, + 1198385, + 2816518, + 2815110, + 2810117, + 2800102, + 2086252, + 1882298, + 1967339, + 900556, + 1789192, + 1792312, + 1782169, + 1786264, + 1975402, + 2393008, + 2399088, + 2398112, + 2218862, + 2397632, + 2396785, + 2398560, + 2398960, + 1797352, + 1802840, + 1802104, + 1799272, + 1808393, + 1806088, + 1816408, + 1811945, + 2395168, + 2494210, + 2398849, + 2494866, + 2415120, + 2411232, + 2410753, + 2424320, + 1798537, + 1794872, + 1798232, + 1774472, + 1804440, + 1774296, + 1771016, + 1891289, + 2399728, + 2399552, + 2399792, + 2280239, + 2303167, + 2212782, + 2363263, + 2359856, + 1798712, + 1703399, + 1800792, + 1798744, + 1893738, + 1907530, + 1837545, + 1832472, + 2402944, + 2402609, + 2400705, + 2400337, + 2399472, + 2400208, + 2399136, + 2402129, + 1797097, + 1796392, + 1798680, + 1692871, + 1797128, + 1774056, + 1771352, + 1952266, + 2403584, + 2503105, + 2400256, + 2271214, + 2404656, + 2506866, + 2438561, + 2413312, + 1795208, + 1795369, + 1797464, + 1797848, + 1782840, + 1824681, + 1789048, + 1790105, + 2401920, + 2303150, + 2402593, + 2504274, + 2397472, + 2436336, + 2420609, + 2426352, + 1797641, + 1802281, + 1802568, + 1679783, + 1692983, + 1742087, + 1822921, + 1770920, + 2519218, + 2520338, + 2715429, + 2806950, + 2807862, + 2821270, + 2802565, + 2802438, + 2075820, + 2187597, + 1775896, + 1782456, + 1792072, + 1887721, + 1814217, + 1800936, + 2400400, + 2468465, + 2395776, + 2397408, + 2382032, + 2505586, + 2393760, + 2406496, + 1799016, + 1718199, + 1803064, + 1801944, + 1690774, + 1755256, + 1829881, + 1773832, + 2399488, + 2400609, + 2397553, + 2398225, + 2399217, + 2398448, + 2394144, + 2393536, + 1819512, + 2011979, + 2033387, + 2037499, + 2126524, + 2039612, + 2068188, + 2123965, + 1560005, + 2679524, + 2637636, + 2485857, + 2394832, + 2363423, + 2380400, + 2514737, + 1087887, + 2102796, + 2056588, + 2025131, + 2668852, + 2661572, + 2812006, + 2811238, + 2814678, + 4267977, + 4386475, + 4493565, + 4429036, + 985662, + 3814100, + 3856836, + 3799267, + 793274, + 2104060, + 2139069, + 2227374, + 2166045, + 1324962, + 2094876, + 2098108, + 2164877, + 1970507, + 2943656, + 2972472, + 3006553, + 2914503, + 2683300, + 2968920, + 2935432, + 1835401, + 2018539, + 1994315, + 1931562, + 1926474, + 1891898, + 1868537, + 1894314, + 2398192, + 2219902, + 2404960, + 2383296, + 2486353, + 1184560, + 2665348, + 2634547, + 2830150, + 1206208, + 2483249, + 2416865, + 2441520, + 2334736, + 1216257, + 2371936, + 2674356, + 2669268, + 1873577, + 3334621, + 3288989, + 3388622, + 3335421, + 2305311, + 3048265, + 2781109, + 999997, + 1978506, + 1893081, + 1903977, + 1905258, + 1902681, + 1032718, + 2032043, + 2034124, + 1980475, + 3010809, + 3009849, + 2997992, + 3035817, + 3011401, + 1393010, + 3093498, + 3356541, + 2510738, + 2521442, + 2527506, + 2534754, + 2547170, + 2406033, + 2687764, + 2421857, + 1585205, + 2877782, + 2607187, + 2609923, + 2552658, + 2623252, + 2078812, + 2210366, + 1801257, + 1790616, + 1793016, + 1772216, + 1807897, + 1898666, + 1798888, + 1832088, + 1997803, + 2910567, + 3010664, + 2919271, + 2926263, + 2919991, + 2954264, + 1541988, + 3504319, + 1270369, + 2583507, + 2807606, + 2794486, + 2791669, + 2794550, + 2892599, + 1063326, + 2643524, + 2396944, + 2846534, + 2838230, + 2838631, + 2992521, + 2861014, + 892876, + 2174701, + 2661172, + 1500820, + 1550709, + 1475268, + 1615494, + 1616037, + 1999371, + 1964795, + 1922249, + 2584851, + 2673364, + 2681028, + 2627907, + 2612356, + 2501138, + 2378976, + 2496946, + 2079004, + 2004859, + 2082940, + 2062412, + 2069148, + 2194205, + 2316735, + 2233582, + 1609526, + 2699156, + 2881047, + 2893863, + 2886358, + 3045209, + 892844, + 2751045, + 2759509, + 904556, + 1799672, + 1797304, + 1795560, + 1797064, + 1823496, + 1638230, + 1871385, + 2420625, + 2728837, + 2822502, + 2566195, + 2572259, + 2519042, + 1181488, + 2891543, + 2791990, + 2089292, + 2092508, + 2078028, + 2082396, + 2082316, + 1002702, + 2170157, + 2290879, + 2394992, + 1801416, + 3145707, + 3081305, + 3073641, + 3075290, + 2199726, + 2672324, + 2677300, + 903388, + 1789192, + 1768728, + 1787656, + 1855529, + 1812808, + 2106748, + 2020875, + 3098730, + 3106266, + 3468671, + 3090122, + 3089625, + 3088682, + 2415633, + 2513778, + 1797240, + 1800312, + 1800344, + 1797464, + 1795800, + 1796968, + 1793240, + 1790984, + 2399120, + 2401056, + 2402256, + 2403936, + 2402833, + 2427104, + 2399920, + 2399136, + 1799416, + 1488020, + 1555733, + 1556293, + 1600566, + 1525845, + 1798568, + 1798553, + 2401489, + 2637892, + 2616611, + 2653412, + 2721924, + 2655060, + 2401041, + 2399360, + 1796904, + 1472724, + 1558933, + 1544245, + 1581381, + 1541892, + 1929114, + 1841433, + 2615923, + 2438593, + 2439057, + 2564418, + 2610403, + 2680308, + 2475185, + 2561442, + 1791528, + 1790712, + 1786152, + 1698807, + 1641270, + 1769864, + 930797, + 1837065, + 1761464, + 2397313, + 2301151, + 2399473, + 2395473, + 2402129, + 2364592, + 2351728, + 2367792, + 1696870, + 1695654, + 1696262, + 1695654, + 1691126, + 1694150, + 1694198, + 1694822, + 2403553, + 2404305, + 2403089, + 2403425, + 2404561, + 2403873, + 2403857, + 2406945, + 1696855, + 1696375, + 1697335, + 1695463, + 1697527, + 1690311, + 1693239, + 1692967, + 2299470, + 2299374, + 2298814, + 2299647, + 2300783, + 2300207, + 2300303, + 2301167, + 1698167, + 1698183, + 1698135, + 1697878, + 1696646, + 1699478, + 1699910, + 1702070, + 2407137, + 2407249, + 2407489, + 2408385, + 2407905, + 2401633, + 2402113, + 2399409, + 1696183, + 1695303, + 1696775, + 1694567, + 1695223, + 1697687, + 1697927, + 1698199, + 2298878, + 2298350, + 2299887, + 2301903, + 2302655, + 2299935, + 2300335, + 2298367, + 1696263, + 1696391, + 1695734, + 1693414, + 1693414, + 1700070, + 1699974, + 1700822, + 2400305, + 2400433, + 2400577, + 2402113, + 2401297, + 2398497, + 2398593, + 2398641, + 1700694, + 1698582, + 1699670, + 1700039, + 1805752, + 1703079, + 1823848, + 1855705, + 2409457, + 2414304, + 2499602, + 2516690, + 2467857, + 2395152, + 2380416, + 2421216, + 2013659, + 2012987, + 1994859, + 2071852, + 2034828, + 2001195, + 2041404, + 2059116, + 2580003, + 2680004, + 2615075, + 2613043, + 2606483, + 2598243, + 2549202, + 2541714, + 1909434, + 1738312, + 1878938, + 1956442, + 1905241, + 1899865, + 1951146, + 1950202, + 2278702, + 2197405, + 2142669, + 2375216, + 2261359, + 2299711, + 2308959, + 2298143, + 1896426, + 1988763, + 1910025, + 2026540, + 1911865, + 2007483, + 2017020, + 2008587, + 2517794, + 2419041, + 2527250, + 2529282, + 2648228, + 2499298, + 2505985, + 2485170, + 1562741, + 1690775, + 1881209, + 1793816, + 1791960, + 1694519, + 1519413, + 1636630, + 2296063, + 2295919, + 2245310, + 2294863, + 2345184, + 2300175, + 2300255, + 2235230, + 1697798, + 1703111, + 1670007, + 1720839, + 1698870, + 1700519, + 1796152, + 1770872, + 2773077, + 2917271, + 2881255, + 2935095, + 3091194, + 1486196, + 3498079, + 3732738, + 3572960, + 2503585, + 2338271, + 2507746, + 2563234, + 875835, + 1814792, + 1982378, + 1848089, + 1881129, + 2388689, + 2367520, + 2363792, + 2516498, + 2521570, + 2567651, + 2506529, + 2502018, + 1782632, + 1902938, + 32795818, + 32794954, + 32631448, + 32744809, + 32784137, + 2247038, + 32914890, + 33040221, + 1886633, + 1976842, + 2045019, + 1988170, + 1946138, + 2395072, + 2384561, + 2378000, + 2394416, + 2329263, + 2379776, + 2509714, + 2395760, + 1796696, + 1796152, + 1794824, + 1698935, + 1608358, + 1616822, + 1671414, + 1666407, + 2296319, + 2297791, + 2301807, + 2709301, + 2536499, + 2797398, + 2783270, + 2699092, + 2096669, + 2090988, + 2095916, + 2076636, + 1993163, + 2165533, + 2091340, + 2099116, + 2701684, + 2583683, + 2728789, + 2767685, + 2922871, + 2938823, + 2867335, + 2930535, + 2203022, + 2187469, + 2338079, + 1507717, + 1534709, + 1936746, + 1850281, + 1775256, + 2694676, + 2695428, + 2689093, + 2594899, + 2497426, + 2622531, + 2827158, + 2749429, + 925020, + 1808168, + 1720967, + 1723335, + 1191072, + 2022859, + 2186525, + 2064540, + 2111180, + 3120010, + 3233484, + 3205019, + 1477668, + 3596096, + 3579632, + 3538496, + 3521439, + 3560591, + 1173584, + 2641859, + 2640851, + 1887258, + 1810377, + 1967242, + 1945515, + 1993915, + 1597349, + 2485330, + 2417889, + 2424929, + 2596819, + 2494946, + 2572770, + 2561171, + 2020380, + 1998971, + 2043947, + 2024795, + 2005819, + 2103788, + 2003563, + 2039948, + 2061355, + 3132058, + 3057433, + 3048793, + 3045641, + 2877926, + 3364397, + 3388957, + 1107647, + 2147757, + 2064859, + 2131869, + 2142157, + 2147229, + 1286994, + 2395409, + 2357504, + 2686101, + 2958855, + 2949480, + 2945976, + 3109594, + 894364, + 2385296, + 2304767, + 2307711, + 803530, + 1342322, + 1427539, + 1433123, + 1430724, + 897228, + 1701031, + 1428899, + 1432755, + 2599235, + 2614803, + 2586563, + 2583378, + 2815926, + 2835126, + 2978424, + 2859271, + 884860, + 2086669, + 1990795, + 2018571, + 2024716, + 896092, + 1531716, + 1783976, + 1794120, + 1402003, + 2314239, + 2317919, + 2311871, + 2310383, + 898428, + 2388033, + 2571347, + 2531170, + 901932, + 1696854, + 1777240, + 1781624, + 1781672, + 1338898, + 1812856, + 1500948, + 2524402, + 2529394, + 2520802, + 2513666, + 2516193, + 2598035, + 2598563, + 2762581, + 1970651, + 2062892, + 1975738, + 1980091, + 1978347, + 2253614, + 2222702, + 2293919, + 2610243, + 3073897, + 2989401, + 2990360, + 2990360, + 895660, + 2332479, + 2287791, + 2333023, + 1748824, + 1937594, + 1934570, + 1936394, + 2198462, + 2388561, + 2234606, + 2242047, + 1404579, + 2404352, + 2307071, + 2305935, + 2308591, + 894236, + 2298670, + 2302207, + 2288894, + 804091, + 1538501, + 1686983, + 1697431, + 1695094, + 1127343, + 1740104, + 1906250, + 1904554, + 1817640, + 3205339, + 3205435, + 3359469, + 3309692, + 950733, + 3119402, + 3044456, + 3045113, + 900412, + 1841193, + 1866202, + 1864393, + 1858569, + 899148, + 1299905, + 1918442, + 1823913, + 1402163, + 2284447, + 2275838, + 2268974, + 2268911, + 8407489, + 9906438, + 9545408, + 9555841, + 1492004, + 9642433, + 9642626, + 9647778, + 9647233, + 2292734, + 2351664, + 2338175, + 1698663, + 1608854, + 1622966, + 1695863, + 1700199, + 1695607, + 1699686, + 1705335, + 2452145, + 2836182, + 2796806, + 2786533, + 2788117, + 1459412, + 3016537, + 2813414, + 3042073, + 1205616, + 2381888, + 2331360, + 2333216, + 2406368, + 2189469, + 2418816, + 2234670, + 1600598, + 2681284, + 2593795, + 2587570, + 2582403, + 2577923, + 892428, + 2462369, + 2503394, + 1028941, + 1809641, + 1910698, + 1915626, + 1899097, + 1898298, + 1194848, + 2192126, + 2190925, + 3146634, + 3075913, + 3126682, + 3129546, + 3287500, + 3195707, + 3241916, + 3240908, + 985501, + 2128477, + 2099900, + 2306751, + 2311455, + 2136477, + 893308, + 1837065, + 1870649, + 2699156, + 2709204, + 2675124, + 2723093, + 2706212, + 2490513, + 2705652, + 2722772, + 1022110, + 1939578, + 1928442, + 2048236, + 2127693, + 2011179, + 1192464, + 2297375, + 2220654, + 1807976, + 2986985, + 2996200, + 3000824, + 2956535, + 2964568, + 1192464, + 3270540, + 3422846, + 982445, + 2429024, + 2432064, + 2430241, + 2429889, + 2429633, + 1375907, + 1379907, + 2399057, + 2402161, + 2401905, + 2400512, + 2401504, + 2400432, + 2396160, + 2393824, + 1899497, + 1655990, + 1691399, + 1698103, + 1698711, + 1697495, + 1902553, + 2001083, + 2402625, + 2381696, + 2353215, + 2352944, + 2357952, + 2385600, + 2398529, + 2480129, + 1910297, + 2102044, + 2116413, + 2115916, + 2111260, + 2116668, + 2009835, + 2285663, + 2461729, + 2902727, + 2973064, + 2951847, + 2948024, + 2946344, + 2887111, + 2895095, + 1889098, + 1985643, + 1894650, + 1896938, + 1896329, + 1896217, + 1801112, + 1811224, + 1763255, + 2734725, + 2400816, + 2385584, + 2390272, + 2395840, + 2784933, + 1052943, + 2481409, + 2138653, + 2160429, + 2245566, + 2247535, + 2218366, + 2395008, + 2083180, + 2119565, + 2614179, + 2421681, + 2624499, + 2597698, + 2653236, + 2584850, + 1085166, + 2817269, + 3090298, + 1406531, + 2853654, + 2747445, + 2743045, + 2825110, + 2780598, + 2385937, + 2427072, + 1700982, + 2764246, + 2679124, + 2682324, + 2705237, + 2679332, + 2705012, + 1214145, + 2648548, + 989885, + 2210413, + 1959674, + 1924250, + 1947146, + 1954986, + 1925722, + 889004, + 1852505, + 1508708, + 2396993, + 2392465, + 2398816, + 2398976, + 2395553, + 2403984, + 890876, + 2374736, + 1699415, + 1816408, + 1818248, + 1796392, + 1790392, + 1784504, + 1802312, + 1804824, + 2402736, + 2400080, + 2396993, + 2403152, + 2517618, + 2430545, + 1472724, + 3168123, + 3070233, + 3035961, + 3135082, + 3134586, + 3140330, + 3141130, + 2435089, + 2973048, + 2810710, + 1599269, + 2399328, + 2624116, + 2568066, + 2533426, + 2534658, + 1108559, + 2423696, + 2419328, + 2020204, + 1794537, + 2038155, + 2023499, + 1997083, + 1925658, + 2182686, + 2127421, + 2703972, + 2792869, + 2702980, + 2701781, + 2707300, + 2494418, + 2458065, + 2564786, + 1905049, + 1766552, + 1739640, + 1885722, + 1980411, + 1742984, + 1911898, + 1984155, + 2566850, + 2577234, + 2609779, + 2744389, + 2616643, + 2497089, + 2455617, + 2665651, + 1487812, + 2046140, + 1948314, + 1961307, + 2191038, + 1809256, + 2040859, + 2080220, + 2397296, + 2376992, + 2436481, + 2385824, + 2378464, + 1322818, + 2357856, + 2802694, + 2465922, + 1174848, + 2257294, + 2241102, + 2238334, + 2210333, + 2342991, + 2655844, + 2673220, + 1833145, + 3278348, + 3190443, + 3195099, + 3207483, + 3219372, + 3000360, + 3299388, + 1345555, + 2726149, + 2737428, + 2727861, + 2926551, + 2911015, + 2780149, + 964877, + 2207166, + 2360944, + 2490961, + 2452289, + 2453041, + 2411584, + 2441713, + 2527153, + 2529266, + 2182126, + 2039740, + 2198206, + 2207149, + 2187694, + 2192349, + 1106430, + 2302799, + 2334351, + 1580646, + 2703716, + 2717029, + 2883142, + 2738293, + 2740693, + 891196, + 2560835, + 2474433, + 1016557, + 1714279, + 1885786, + 1907386, + 1882233, + 1876505, + 981358, + 2046011, + 2029692, + 1504228, + 2572787, + 2506769, + 2509681, + 2517618, + 2526418, + 894012, + 2349552, + 2366431, + 1355474, + 2225342, + 2291103, + 2429649, + 2348463, + 2360688, + 1044046, + 2405472, + 2407041, + 2277646, + 2545122, + 2480514, + 2415313, + 2396560, + 2400944, + 2401825, + 2400640, + 1796888, + 1795257, + 1794472, + 1797976, + 1795640, + 1799721, + 1800232, + 1800648, + 2396833, + 2420304, + 2404832, + 2402240, + 2410833, + 1807800, + 3305452, + 3300524, + 3304653, + 2711493, + 2911143, + 2924263, + 2904471, + 1387490, + 2575411, + 2519442, + 2494433, + 2711236, + 1810697, + 3091818, + 2976680, + 3186155, + 1112559, + 2911111, + 2922712, + 2912312, + 3052793, + 2387504, + 2387168, + 2370704, + 1873193, + 2171645, + 2356896, + 2344335, + 2332927, + 2298575, + 2658916, + 2580643, + 2296735, + 1930234, + 2292447, + 2295919, + 2661572, + 1030190, + 1575269, + 1564677, + 2046059, + 1309441, + 2386896, + 2333935, + 2337807, + 2337247, + 1657894, + 3223211, + 3228875, + 3239020, + 800251, + 2322671, + 2443921, + 2478338, + 2482306, + 1212928, + 1457492, + 1450468, + 1700215, + 1227904, + 1288241, + 1788152, + 1452787, + 2297615, + 2274110, + 2287886, + 2300735, + 2211870, + 2291535, + 2436145, + 2490306, + 1804808, + 1806377, + 1806025, + 1800648, + 1800888, + 1827177, + 1807944, + 1816872, + 1495796, + 2311423, + 2300687, + 2539891, + 801739, + 2390544, + 2546002, + 2545906, + 2541506, + 897820, + 1458227, + 1946634, + 1947626, + 803035, + 1706551, + 1704983, + 1703767, + 2090700, + 1497108, + 2299055, + 2032587, + 2022411, + 2476578, + 2583155, + 2579699, + 2595203, + 2299983, + 2302831, + 2581875, + 2570163, + 800347, + 1725479, + 1730007, + 1705335, + 1683703, + 2406128, + 2340319, + 2399952, + 993550, + 2599811, + 2732725, + 2683828, + 2855334, + 2717893, + 894044, + 1614534, + 1625046, + 905260, + 1548325, + 1668758, + 1712871, + 1529764, + 1667270, + 2343487, + 2322959, + 2505378, + 2506370, + 2502274, + 2509362, + 2601347, + 2529634, + 1892474, + 1891242, + 1812024, + 1724295, + 1816888, + 1821880, + 1819240, + 1796584, + 2400416, + 2405440, + 2493346, + 2499890, + 2509090, + 2595123, + 2618051, + 2533650, + 2002715, + 2018763, + 1980346, + 1977338, + 1982058, + 1862410, + 1982987, + 1979499, + 2489026, + 2500098, + 2619284, + 2621540, + 2526786, + 2625428, + 2709188, + 2619107, + 1991371, + 1995179, + 1796056, + 1675159, + 1795688, + 1796600, + 1795416, + 1801864, + 2397840, + 2404672, + 2494161, + 2498497, + 2504753, + 2597683, + 2614147, + 2529986, + 1899689, + 1899177, + 1793833, + 1800089, + 1804313, + 1800632, + 1796072, + 1798296, + 2496306, + 2508098, + 2498305, + 2498977, + 2502881, + 2500034, + 2500050, + 2500034, + 1792600, + 1791096, + 1778360, + 1780984, + 1875866, + 1787512, + 1807304, + 1868633, + 2516850, + 2520626, + 2530610, + 2722885, + 2658804, + 2740469, + 2886343, + 2810085, + 2084604, + 2093740, + 1909498, + 2103804, + 2193421, + 2067627, + 2134701, + 2080460, + 2588915, + 2590403, + 2371824, + 2468241, + 2373088, + 2373296, + 2375104, + 2453281, + 1802872, + 1811608, + 1799960, + 1689799, + 1794120, + 1810457, + 1826840, + 1795368, + 2393664, + 2391984, + 2530834, + 2591906, + 2559427, + 2555666, + 2542738, + 2550403, + 1898826, + 1892746, + 1014078, + 1982683, + 1875097, + 1865769, + 1865513, + 1954059, + 1890025, + 2501969, + 2256223, + 2402688, + 2388176, + 2425265, + 2501697, + 2437888, + 2500578, + 1797513, + 1909225, + 1717399, + 2018363, + 1934490, + 1905257, + 1868954, + 1900698, + 2506305, + 2597923, + 2552290, + 2597395, + 2577187, + 2574611, + 2576626, + 2574579, + 1993051, + 1925578, + 1974234, + 1980843, + 2127917, + 2012827, + 2080124, + 2036763, + 2596547, + 1016446, + 2592211, + 2524882, + 2527170, + 2524162, + 2524146, + 2523266, + 2523810, + 982013, + 1014894, + 1993675, + 1995227, + 1996938, + 1998843, + 1995291, + 1996762, + 1998459, + 1692902, + 1010030, + 2703524, + 2702628, + 2701269, + 2702180, + 2702948, + 2701413, + 2700580, + 989293, + 1013006, + 2003051, + 2001051, + 2001739, + 2002731, + 2001787, + 2003003, + 2001531, + 1585109, + 1011358, + 2506978, + 2462785, + 2573027, + 2545522, + 2555075, + 2549826, + 2549986, + 981965, + 37884173, + 37884461, + 37995983, + 37926318, + 38207617, + 38209170, + 38205234, + 2417360, + 1018638, + 1819448, + 2009675, + 1955211, + 1913754, + 1940587, + 1922858, + 1958874, + 1571653, + 1018542, + 2672884, + 2587442, + 2643108, + 2614099, + 2541362, + 2541458, + 2496482, + 983693, + 1895178, + 2005371, + 1980826, + 1979579, + 2036619, + 2044955, + 2063036, + 2500434, + 1013245, + 2578530, + 2512594, + 2514898, + 2516338, + 2223918, + 2224110, + 2237390, + 979950, + 1018125, + 1793192, + 1800488, + 1749191, + 2001451, + 2001435, + 1999099, + 1999642, + 1988635, + 3112522, + 2975960, + 3089897, + 3162571, + 3305453, + 3369710, + 3221468, + 1273153, + 2607379, + 2288863, + 2165229, + 2307695, + 2235262, + 2194477, + 2232942, + 1590757, + 2693076, + 2580307, + 2593779, + 2443697, + 2610179, + 2612979, + 2599939, + 977853, + 2095260, + 2055724, + 1993179, + 1669862, + 1880857, + 1861177, + 1866137, + 2416705, + 2468945, + 2684500, + 2522785, + 2507282, + 2592227, + 2506097, + 2504402, + 1895481, + 1879418, + 1887834, + 1891482, + 1896985, + 1879306, + 1897209, + 2054828, + 2395041, + 2446672, + 2416128, + 2415232, + 899164, + 2159149, + 2489890, + 2425408, + 2419489, + 990733, + 1848569, + 1892890, + 1895498, + 1898105, + 1872809, + 1947434, + 1897273, + 2392784, + 2392704, + 2393504, + 2407600, + 2405889, + 2427713, + 2430417, + 2429681, + 900780, + 1900314, + 1831881, + 1840760, + 1822265, + 995613, + 1878617, + 1886425, + 1903113, + 1707511, + 2702116, + 2709188, + 2728133, + 2729252, + 986253, + 2696869, + 2668596, + 2667220, + 1781784, + 1902426, + 1829097, + 1831785, + 1907226, + 1903641, + 1906602, + 1904618, + 2604195, + 2622963, + 2628355, + 2627267, + 2699972, + 2724949, + 2728629, + 2731157, + 893164, + 2079948, + 1948778, + 2060620, + 1958091, + 1737319, + 1755687, + 1888713, + 2499730, + 2506482, + 2473681, + 2529234, + 2521922, + 1097791, + 2649780, + 2609267, + 2739269, + 1099918, + 1998091, + 2116589, + 2200206, + 2247535, + 992317, + 2121293, + 2188429, + 2121292, + 1492180, + 2587171, + 2590066, + 2525617, + 2478529, + 896844, + 2350095, + 2386880, + 2404545, + 800139, + 1696807, + 1695207, + 1700247, + 1701063, + 897900, + 1506596, + 1694743, + 1699703, + 2293774, + 2533058, + 2535938, + 2533698, + 2502689, + 2502225, + 2549218, + 2507586, + 1674855, + 1874265, + 1872714, + 2070924, + 2023564, + 2114413, + 2020716, + 2019819, + 2497905, + 2483122, + 2491793, + 2537938, + 799611, + 2217149, + 2299359, + 2475697, + 2431105, + 1113759, + 1903369, + 1906506, + 1907786, + 1202112, + 2114140, + 2311744, + 2284271, + 2272622, + 1796953, + 3008841, + 3003928, + 2939912, + 2813254, + 2615011, + 2739300, + 2796373, + 871724, + 1891449, + 1894570, + 2056331, + 1909833, + 1988731, + 2003515, + 1930698, + 2495650, + 2519666, + 2521873, + 2499938, + 2537522, + 2465649, + 2564739, + 2558467, + 1899433, + 1791304, + 1846761, + 1888714, + 1938090, + 2011723, + 2057771, + 2011051, + 2597763, + 2947320, + 2878423, + 2852198, + 2863335, + 900572, + 2241214, + 2295918, + 2463090, + 1355714, + 1845241, + 1847801, + 1839080, + 1797016, + 2061276, + 2047340, + 2049707, + 2394832, + 2352447, + 2352415, + 2325280, + 2400849, + 2045420, + 1974331, + 2061932, + 1918570, + 1676839, + 1688807, + 1644166, + 2020283, + 2023899, + 2169997, + 2118348, + 1478228, + 2572979, + 2467249, + 2464097, + 2510177, + 2779029, + 2775797, + 2775462, + 2102268, + 2121740, + 2118381, + 2223118, + 2117133, + 1045518, + 1928314, + 1864889, + 1864633, + 2673236, + 1838185, + 2753365, + 2842534, + 2910855, + 1013133, + 2808262, + 2807589, + 2932552, + 1925466, + 2028443, + 1961370, + 1862937, + 1797385, + 1649863, + 1773416, + 1749383, + 2660692, + 3005288, + 3124170, + 3133162, + 3214651, + 3513263, + 3634144, + 3735666, + 1305761, + 2838886, + 2660884, + 2655075, + 2657700, + 1294706, + 2550018, + 2558531, + 2344464, + 2802022, + 2625540, + 2632340, + 2591555, + 880156, + 2671476, + 2361968, + 2360944, + 2367232, + 1901369, + 1984010, + 1922394, + 1798424, + 1640534, + 1768808, + 1788424, + 1891465, + 2661428, + 2691893, + 2663651, + 2820918, + 2679700, + 2899383, + 3013720, + 2841446, + 977133, + 1845096, + 2018715, + 1972379, + 1726551, + 1697383, + 1983498, + 1813529, + 2553811, + 2683524, + 2587219, + 2510018, + 2595331, + 2511762, + 2566706, + 2773301, + 1996555, + 1988075, + 1966522, + 2065036, + 2090044, + 2095916, + 2092108, + 2053068, + 2388576, + 2862614, + 2793829, + 2866470, + 794379, + 2385904, + 2373712, + 2323471, + 2483570, + 899244, + 1187024, + 1431827, + 1438660, + 899948, + 1854281, + 1803880, + 1809977, + 1802648, + 2289407, + 3099690, + 3259372, + 3154442, + 1112767, + 3338621, + 3362957, + 3465247, + 3497823, + 1184608, + 2306399, + 2394704, + 2548290, + 1206704, + 2399920, + 2397984, + 2374640, + 2378112, + 2545650, + 2633827, + 2716565, + 1211345, + 2799366, + 2735685, + 2714757, + 2664916, + 2640291, + 2392097, + 2379008, + 2504641, + 2310191, + 2345007, + 2528546, + 2529810, + 2530514, + 1779560, + 3498031, + 3380253, + 1318258, + 3341997, + 3352301, + 3352413, + 3610689, + 3662082, + 1284689, + 2573538, + 2620051, + 1001614, + 2289711, + 2287871, + 2287278, + 2268366, + 2274158, + 1489412, + 2467121, + 2418193, + 2270703, + 2472609, + 2552274, + 2556323, + 2491682, + 2034091, + 2232382, + 2659252, + 2273838, + 2246031, + 2239614, + 2258286, + 2443041, + 2804966, + 2721237, + 2786885, + 2381232, + 2589923, + 2525057, + 2505378, + 2507329, + 1900490, + 1991147, + 1921914, + 1895145, + 2176461, + 2175598, + 2217998, + 2267839, + 1497588, + 2389648, + 2282814, + 2447553, + 2020731, + 2132205, + 2110300, + 2086956, + 1797992, + 1823896, + 1808153, + 1724231, + 1796200, + 1806520, + 1747495, + 1826153, + 2398512, + 2421873, + 2403712, + 2415136, + 2420593, + 2470305, + 2602419, + 2749301, + 12115955, + 11945153, + 12099491, + 12136435, + 885052, + 11875440, + 11877920, + 11987249, + 12117139, + 2496369, + 2468801, + 2496882, + 2401296, + 2399600, + 2398848, + 2402112, + 2376832, + 1818088, + 2001163, + 2172702, + 2001899, + 2004843, + 1978027, + 1983595, + 1979994, + 2478866, + 2397456, + 2401120, + 2597091, + 2620692, + 2619427, + 2614035, + 2626852, + 1996923, + 2095308, + 2085388, + 2212078, + 2179069, + 2185149, + 2446257, + 2425088, + 3084409, + 3064425, + 3166651, + 3097993, + 3365421, + 3362621, + 3315309, + 3334013, + 1301554, + 2510514, + 2444945, + 2751013, + 1304385, + 2338927, + 2366528, + 2178045, + 2173085, + 1696215, + 3001912, + 3002056, + 2692116, + 1200256, + 2899480, + 2896743, + 3181195, + 3209356, + 1296626, + 2497650, + 2497074, + 2597091, + 1203872, + 2495777, + 2501058, + 2188093, + 2189533, + 3639041, + 3933861, + 3930085, + 3994518, + 3771155, + 4284282, + 4275945, + 4270042, + 1203840, + 2812053, + 2767589, + 2748757, + 2300047, + 1855769, + 1883162, + 2023691, + 1916633, + 2631091, + 3182347, + 2790757, + 2900647, + 1478980, + 3412494, + 3533839, + 3562688, + 2442321, + 2781126, + 2675380, + 2656052, + 1337106, + 2501713, + 2517810, + 2680356, + 2547794, + 3373821, + 3510831, + 3496159, + 1126703, + 3279709, + 3265532, + 3234395, + 3444319, + 3340589, + 1812744, + 1934650, + 1797864, + 1655559, + 1800584, + 1799800, + 1768167, + 1751720, + 2398576, + 2430497, + 2411969, + 2274559, + 2411648, + 2409873, + 2549474, + 2411744, + 1800953, + 1801304, + 2065692, + 2072300, + 2186125, + 2096460, + 2081660, + 2097404, + 1793704, + 3072793, + 2965704, + 3237100, + 3316573, + 3344941, + 3359325, + 3344237, + 2547474, + 2479201, + 2709828, + 1889529, + 2086476, + 1955450, + 1938010, + 1973083, + 2490690, + 2582595, + 2568355, + 2398433, + 2272431, + 2399280, + 2400000, + 2355664, + 1819208, + 2146525, + 2094556, + 2082156, + 2173021, + 2097788, + 2100476, + 2102092, + 2598611, + 2621891, + 2624499, + 1222497, + 2768022, + 2979880, + 2904983, + 2950648, + 2904359, + 1258641, + 2459873, + 2470226, + 1413267, + 2757525, + 2671908, + 2671987, + 2756005, + 2699844, + 2393536, + 3719426, + 3759090, + 1763384, + 4132920, + 4131768, + 4209816, + 4161400, + 4155688, + 2849302, + 2950728, + 1871961, + 1903705, + 2074188, + 2071116, + 2069852, + 2229470, + 1586406, + 2567459, + 2467233, + 2509378, + 2347535, + 2517745, + 2513010, + 2506306, + 990749, + 1995530, + 1914010, + 2048587, + 1782520, + 2753045, + 2755445, + 2760565, + 3004440, + 2491202, + 4180744, + 4235113, + 4388603, + 1338914, + 3835396, + 3839091, + 3838868, + 3760067, + 1178864, + 2440561, + 2487074, + 2494546, + 2090508, + 2196382, + 2176877, + 2196942, + 2502721, + 2513490, + 2509249, + 2488865, + 2493346, + 2333439, + 2491281, + 2489137, + 2001386, + 2149677, + 2001995, + 2037836, + 2117901, + 2203966, + 2286927, + 2201550, + 2691269, + 2744533, + 2772630, + 2744469, + 903788, + 2398032, + 2473425, + 2418848, + 2419553, + 995805, + 1670470, + 1845368, + 1876665, + 2202077, + 2097916, + 2184381, + 2263358, + 1601686, + 2918855, + 2811974, + 3031273, + 2925640, + 989661, + 2593539, + 2566674, + 2631428, + 1211633, + 2033644, + 2177806, + 2123932, + 2141277, + 2306559, + 2130524, + 2360240, + 2436657, + 2577938, + 2675668, + 2641379, + 2539682, + 2686340, + 2693989, + 2554755, + 2073500, + 2220350, + 2222190, + 2216877, + 2143485, + 2104924, + 2112124, + 2193470, + 2783542, + 2675028, + 2832742, + 2950280, + 2993944, + 1493924, + 3178475, + 3323420, + 3282108, + 1621989, + 3202219, + 3080394, + 3113194, + 3119690, + 2919351, + 2936536, + 2997240, + 1876505, + 3179450, ``` The diff is longer than this page shows; the raw diff has all of it.