diff options
| author | tv <tv@krebsco.de> | 2026-11-03 05:21:25 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-03 05:21:25 +0100 |
| commit | 8366f7c5de474753dbfbf88431917e79c15e5389 (patch) | |
| tree | 8c3ed8cca74760ff98b58264843765a3d8e65d3b /src/simtest | |
| parent | 96d7744dd29a3c783b43a7a6697af7d5d5719a10 (diff) | |
replace eager links by trees
Diffstat (limited to 'src/simtest')
| -rw-r--r-- | src/simtest/bench.rs | 10 | ||||
| -rw-r--r-- | src/simtest/identity.rs | 1 | ||||
| -rw-r--r-- | src/simtest/relay.rs | 63 | ||||
| -rw-r--r-- | src/simtest/timing.rs | 1 |
4 files changed, 4 insertions, 71 deletions
diff --git a/src/simtest/bench.rs b/src/simtest/bench.rs index 8c24d5c..d80190d 100644 --- a/src/simtest/bench.rs +++ b/src/simtest/bench.rs @@ -173,9 +173,7 @@ impl Totals { relay.announce_rounds += stats.relay.announce_rounds; relay.pulls += stats.relay.pulls; relay.pulls_queued += stats.relay.pulls_queued; - relay.grafts += stats.relay.grafts; - relay.prunes += stats.relay.prunes; - relay.eager_forwards += stats.relay.eager_forwards; + relay.tree_forwards += stats.relay.tree_forwards; let propagation = &mut totals.propagation; for (sum, count) in propagation .buckets @@ -360,13 +358,11 @@ fn report(workload: &str, quiet: (Totals, Totals), during: (Totals, Totals), con ); let (r0, r1) = (during.0.relay, during.1.relay); println!( - " relay per write: {:.1} announcement rounds, {:.1} pulls ({:.1} queued), {:.2} grafts, {:.2} prunes, {:.1} eager forwards", + " relay per write: {:.1} announcement rounds, {:.1} pulls ({:.1} queued), {:.1} along writers' trees", (r1.announce_rounds - r0.announce_rounds) as f64 / writes, (r1.pulls - r0.pulls) as f64 / writes, (r1.pulls_queued - r0.pulls_queued) as f64 / writes, - (r1.grafts - r0.grafts) as f64 / writes, - (r1.prunes - r0.prunes) as f64 / writes, - (r1.eager_forwards - r0.eager_forwards) as f64 / writes, + (r1.tree_forwards - r0.tree_forwards) as f64 / writes, ); let mut propagation = Propagation::default(); let (p0, p1) = (during.0.propagation, during.1.propagation); diff --git a/src/simtest/identity.rs b/src/simtest/identity.rs index 154c72e..9f77836 100644 --- a/src/simtest/identity.rs +++ b/src/simtest/identity.rs @@ -111,7 +111,6 @@ fn status(node: &AppState) -> ParsedMessage { syncs_with_you: false, leaving: false, announcing: false, - eager: false, reaches: None, }) } diff --git a/src/simtest/relay.rs b/src/simtest/relay.rs index 88ece74..da1ce0a 100644 --- a/src/simtest/relay.rs +++ b/src/simtest/relay.rs @@ -1,6 +1,5 @@ //! Changes passed on in a full mesh (`swarm::relay`) to the members the writer can't -//! reach: those on none of its transports, or behind a link that fails; and the links -//! a pull makes eager. +//! reach: those on none of its transports, or behind a link that fails. use std::time::Duration; @@ -118,63 +117,3 @@ async fn changes_reach_members_the_writer_fails_to_reach_at_once() { .await; } } - -/// Whether `node` asked `peer` for its changes eagerly, and whether `peer` heard so. -async fn eager(node: &crate::state::AppState, peer: &crate::state::AppState) -> bool { - let asked = match node.get_peer_state(peer.local_id()).await { - Some(state) => state.lock().await.eager_from, - None => false, - }; - let heard = match peer.get_peer_state(node.local_id()).await { - Some(state) => state.lock().await.eager_to, - None => false, - }; - asked && heard -} - -/// As above, x reaching b alone: c pulls x's first write from b, which makes the link -/// from b to c eager; x's next write b forwards to c as it applies it, without -/// announcing it. The link from x's side stays lazy: nothing was pulled over it. -#[tokio::test(flavor = "multi_thread", worker_threads = 4)] -async fn pulls_make_links_eager() { - let keepalive = Duration::from_secs(5); - let slow = move |config: &mut crate::node::NodeConfig| { - config.timing = Timing::new(keepalive, SYNC_REPLY_TIMEOUT, DELIVERY_LIMIT); - }; - let sim = Sim::with_identity(65); - let cut = crate::transport::sim::LinkParams { - loss: 1.0, - ..Default::default() - }; - sim.net.set_link("x", "c", cut.clone()); - sim.net.set_link("c", "x", cut); - let b = sim.start_on_with("b", &["sim"], &[], Start::Genesis, slow); - let c = sim.start_on_with("c", &["sim"], &["b"], Start::Join, slow); - let x = sim.start_on_with("x", &["sim"], &["b"], Start::Join, slow); - sim.wait_ready(&[&b, &c, &x], SOON).await; - // c may have pulled already: what x writes when it registers comes that way too. - sim.wait_converged(&[&b, &c, &x], SOON).await; - - write(&x, "y", json!(1)).await; - { - let (b, c) = (&b, &c); - sim.wait_until( - "c pulled x's write from b, and the link from b is eager", - SOON, - move || async move { read(c, "y").await == Some(json!(1)) && eager(c, b).await }, - ) - .await; - } - assert!(!eager(&b, &x).await, "nothing was pulled from x"); - - write(&x, "y", json!(2)).await; - { - let c = &c; - sim.wait_until( - "c has x's next write within a second", - Duration::from_secs(1), - move || async move { read(c, "y").await == Some(json!(2)) }, - ) - .await; - } -} diff --git a/src/simtest/timing.rs b/src/simtest/timing.rs index d06e992..602a7bf 100644 --- a/src/simtest/timing.rs +++ b/src/simtest/timing.rs @@ -336,7 +336,6 @@ async fn late_epoch_does_not_flip_a_peers_epoch() { syncs_with_you: false, leaving: false, announcing: false, - eager: false, reaches: None, }) }; |
