From 52d84aac8734369d81c2d77413ea3ab8e58e0af9 Mon Sep 17 00:00:00 2001 From: Arnaud Gourlay Date: Thu, 16 Jun 2022 19:37:20 +0200 Subject: [PATCH] fix naming and doc for maybe_snapshot_abort (#478) Signed-off-by: Arnaud Gourlay --- src/raft.rs | 4 ++-- src/tracker/progress.rs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/raft.rs b/src/raft.rs index 581a917b..fe397ed1 100644 --- a/src/raft.rs +++ b/src/raft.rs @@ -1766,10 +1766,10 @@ impl Raft { match pr.state { ProgressState::Probe => pr.become_replicate(), ProgressState::Snapshot => { - if pr.maybe_snapshot_abort() { + if pr.is_snapshot_caught_up() { debug!( self.r.logger, - "snapshot aborted, resumed sending replication messages to {from}", + "snapshot caught up, resumed sending replication messages to {from}", from = m.from; "progress" => ?pr, ); diff --git a/src/tracker/progress.rs b/src/tracker/progress.rs index 252aec6d..2f86f5a7 100644 --- a/src/tracker/progress.rs +++ b/src/tracker/progress.rs @@ -125,10 +125,9 @@ impl Progress { self.pending_snapshot = 0; } - /// Unsets pendingSnapshot if Match is equal or higher than - /// the pendingSnapshot + /// Returns true if Match is equal or higher than the pendingSnapshot. #[inline] - pub fn maybe_snapshot_abort(&self) -> bool { + pub fn is_snapshot_caught_up(&self) -> bool { self.state == ProgressState::Snapshot && self.matched >= self.pending_snapshot }