pub fn metadata_log_nonempty(dir: &Path) -> boolExpand description
True when the metadata partition directory dir already holds durable
raft state, which a node that ran before leaves. A quorum-state file or a
log segment that holds bytes is such state.
dir is the metadata partition directory,
<metadata.log.dir>/__cluster_metadata-0. The broker binary’s
detect_bootstrap_mode calls this so its Bootstrap/Rejoin choice can never
disagree with Controller::start_with_listener’s mode validation.
KraftController::open creates an empty active segment before the first
election, so an empty segment is not state: a node killed mid-election,
with that segment but no quorum-state yet, reads as un-formatted and
re-Bootstraps rather than dying with “Rejoin requires non-empty raft log”.