aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/simtest/soak.rs8
-rw-r--r--src/swarm/working_links.rs24
2 files changed, 28 insertions, 4 deletions
diff --git a/src/simtest/soak.rs b/src/simtest/soak.rs
index 5a1234b..c9c9c19 100644
--- a/src/simtest/soak.rs
+++ b/src/simtest/soak.rs
@@ -281,6 +281,10 @@ async fn soak_with_churn() {
};
let recorded = records(nodes[0].clone()).await.len();
let written_during = written(&nodes);
+ let (unreached_written, reached_written) = nodes
+ .iter()
+ .map(crate::swarm::working_links::written_by_set)
+ .fold((0, 0), |(u, r), (nu, nr)| (u + nu, r + nr));
let end_tasks = tokio::runtime::Handle::current()
.metrics()
.num_alive_tasks();
@@ -297,8 +301,8 @@ async fn soak_with_churn() {
println!(
" per node at most: {peers} peers, round trips of {rtts}, throughput of \
{throughputs}, traffic of {traffic}; {heals} heals; {recorded} members with links \
- recorded, {written_during} records written (by the nodes running at the end); \
- tasks alive {warm_tasks} after the warm-up, {end_tasks} at the end"
+ recorded, {written_during} records written (by the nodes running at the end; \
+ {unreached_written} changing unreached, {reached_written} reached); tasks alive {warm_tasks} after the warm-up, {end_tasks} at the end"
);
// The quiet phase: what the swarm sends with nothing to pass on, once the links
diff --git a/src/swarm/working_links.rs b/src/swarm/working_links.rs
index 873baf6..13337b9 100644
--- a/src/swarm/working_links.rs
+++ b/src/swarm/working_links.rs
@@ -107,9 +107,21 @@ pub(crate) struct Pending {
/// Checks done (`check`), for the benchmark to wait for one (`settled`).
#[cfg(test)]
checks: u64,
- /// Records written, for the soak (`written`).
+ /// Records written, for the soak (`written`); and of those, how many changed
+ /// `unreached`, how many `reached`.
#[cfg(test)]
written: u64,
+ #[cfg(test)]
+ written_unreached: u64,
+ #[cfg(test)]
+ written_reached: u64,
+}
+
+/// How many records we wrote that changed `unreached`, and `reached`.
+#[cfg(test)]
+pub(crate) fn written_by_set(state: &AppState) -> (u64, u64) {
+ let pending = state.working_links.lock_or_recover();
+ (pending.written_unreached, pending.written_reached)
}
/// How many times we wrote our record.
@@ -248,6 +260,11 @@ pub(crate) async fn check(state: &AppState) {
return;
}
let (unreached, reached) = (next.unreached.len(), next.reached.len());
+ #[cfg(test)]
+ let changed = (
+ next.unreached != recorded.unreached,
+ next.reached != recorded.reached,
+ );
match state
.mutate_doc(move |doc| members::set_links(doc, &me, &next))
.await
@@ -255,7 +272,10 @@ pub(crate) async fn check(state: &AppState) {
Ok(()) => {
#[cfg(test)]
{
- state.working_links.lock_or_recover().written += 1;
+ let mut pending = state.working_links.lock_or_recover();
+ pending.written += 1;
+ pending.written_unreached += u64::from(changed.0);
+ pending.written_reached += u64::from(changed.1);
}
info!(
unreached,