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/blob/main/evidence/a2-segment-store/red-green/red-main-behaviour.txt # 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 branch `main` Branches Tags History `synapse / evidence / a2-segment-store / red-green / red-main-behaviour.txt` 46 lines ยท 2371 bytes Raw Blame History 1 # Red 2: behaviour of main `e863c87`. A probe with the same name and core assertion as 2 # a2_checkpoint_keeps_blobs_in_segments_across_reopen, written against main's API (20 changesets of 3 # 6000 bytes, GROUP_COMMIT_DEFAULT, one checkpoint), run in a main checkout (not committed): 4 # main's checkpoint turns every retained inline blob back into a blob file and empties wal.v2.log. 5 # cargo test -p synapse-store --lib segment_tests 6 test segment_tests::a2_checkpoint_keeps_blobs_in_segments_across_reopen ... FAILED 7 thread 'segment_tests::a2_checkpoint_keeps_blobs_in_segments_across_reopen' panicked at crates/synapse-store/src/segment_tests.rs:34:5: 8 assertion `left == right` failed: no file per blob (main wrote 20 blob files; log kept whole: false) 9 test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 42 filtered out; finished in 0.34s 10 11 # Probe source (main API): 12 //! Probe of main-branch behaviour for the A2 red/green record (not committed). 13 use super::tests::{make_signed_changeset, temp_store_dir}; 14 use super::*; 15 use `ed25519`_dalek::SigningKey; 16 17 fn blob_files(dir: &Path) -> usize { 18 fn walk(p: &Path) -> usize { 19 let Ok(rd) = fs::read_dir(p) else { return 0 }; 20 rd.map(|e| { 21 let e = e.unwrap(); 22 if e.file_type().unwrap().is_dir() { walk(&e.path()) } else { 1 } 23 }) 24 .sum() 25 } 26 walk(&dir.join("blobs")) 27 } 28 29 #[test] 30 fn a2_checkpoint_keeps_blobs_in_segments_across_reopen() { 31 let dir = temp_store_dir("a2-main-probe"); 32 let key = SigningKey::from_bytes(&[90; 32]); 33 let mut s = SynapseStore::open(&dir, FsyncPolicy::GROUP_COMMIT_DEFAULT, 34 RecoveryPolicy::StrictFailClosed, StoreLimits::default()).unwrap(); 35 for i in 0..20 { 36 let label = format!("ck-{i}"); 37 let (env, blobs) = make_signed_changeset(&key, &label, &format!("src/{label}.rs"), 38 &vec![b'a' + (i as u8 % 26); 6000], vec![], 1000); 39 s.ingest_changeset(env, &blobs).unwrap(); 40 } 41 let v2_before = fs::read(dir.join(wal2::WAL_V2_FILE)).unwrap(); 42 s.checkpoint_and_compact(1000).unwrap(); 43 let v2_after = fs::read(dir.join(wal2::WAL_V2_FILE)).unwrap(); 44 let kept = v2_after.len() >= v2_before.len() && v2_after[..v2_before.len()] == v2_before[..]; 45 assert_eq!(blob_files(&dir), 0, "no file per blob (main wrote {} blob files; log kept whole: {kept})", blob_files(&dir)); 46 }