Skip to content

Commit 3165775

Browse files
Merge pull request #416 from Rustock-dev/segbuild/seed-verdict-from-sweep-log
Say whether the segment seed survived, instead of that nothing can promise
2 parents a8c9561 + b020fdc commit 3165775

1 file changed

Lines changed: 49 additions & 15 deletions

File tree

‎crates/cli/src/main.rs‎

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3150,21 +3150,55 @@ async fn run(local_offset: Option<time::UtcOffset>) -> Result<()> {
31503150
set_end + 1
31513151
);
31523152
}
3153-
warn!(
3154-
"segbuild: the set ends at #{set_end} and this node has executed to \
3155-
#{exec_head}, a gap of {gap} blocks. The collector has not been \
3156-
beneath it ({}), so it is still buildable, and all but the last {} \
3157-
blocks of it are cut as a range of their own now. Its seed state at \
3158-
#{set_end} is the one \
3159-
part nothing can promise -- it was written below the watermark and \
3160-
was not pinned while the node ran -- so the build may fail on a \
3161-
missing node, loudly, leaving no segment.",
3162-
match watermark {
3163-
Some(w) => format!("watermark #{w}"),
3164-
None => "no sweep has completed".into(),
3165-
},
3166-
args.segbuild_lag
3167-
);
3153+
// Whether the seed survived is checkable, not unknowable, and
3154+
// saying "nothing can promise" when the record settles it sends
3155+
// an operator looking for damage that is not there.
3156+
//
3157+
// A sweep preserves everything reachable from the root it
3158+
// collected against. So a state at or after that root's height
3159+
// is complete by construction: each of its nodes was either
3160+
// reachable then -- and preserved -- or written since, in an
3161+
// epoch the sweep never touched.
3162+
let last_sweep = epoch_store
3163+
.as_ref()
3164+
.and_then(|es| es.sweep_log().last().cloned());
3165+
let seed_verdict = match (&last_sweep, watermark) {
3166+
(None, None) => Some(
3167+
"no sweep has ever completed, so nothing has been collected and the \
3168+
seed state is intact"
3169+
.to_string(),
3170+
),
3171+
(Some(r), _) if r.swept_at <= set_end => Some(format!(
3172+
"the most recent sweep collected against #{} and preserved everything \
3173+
reachable from it, so the seed at #{set_end} -- which is that state \
3174+
carried forward -- is intact",
3175+
r.swept_at
3176+
)),
3177+
_ => None,
3178+
};
3179+
match seed_verdict {
3180+
Some(why) => info!(
3181+
"segbuild: the set ends at #{set_end} and this node has executed to \
3182+
#{exec_head}, a gap of {gap} blocks. All but the last {} blocks of \
3183+
it are cut as a range of their own now, and {why}.",
3184+
args.segbuild_lag
3185+
),
3186+
None => warn!(
3187+
"segbuild: the set ends at #{set_end} and this node has executed to \
3188+
#{exec_head}, a gap of {gap} blocks. The collector has not been \
3189+
beneath it ({}), so it is still buildable, and all but the last {} \
3190+
blocks of it are cut as a range of their own now. But the most \
3191+
recent sweep collected against #{}, which is ABOVE #{set_end}, so \
3192+
the seed state there cannot be shown intact -- the build may fail \
3193+
on a missing node, loudly, leaving no segment.",
3194+
match watermark {
3195+
Some(w) => format!("watermark #{w}"),
3196+
None => "no sweep has completed".into(),
3197+
},
3198+
args.segbuild_lag,
3199+
last_sweep.as_ref().map(|r| r.swept_at).unwrap_or(0)
3200+
),
3201+
}
31683202
}
31693203
if exec_head < set_end {
31703204
info!(

0 commit comments

Comments
 (0)