Skip to content

Commit

Permalink
fix naming and doc for maybe_snapshot_abort (#478)
Browse files Browse the repository at this point in the history
Signed-off-by: Arnaud Gourlay <[email protected]>
  • Loading branch information
agourlay authored Jun 16, 2022
1 parent 2357cb2 commit 52d84aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1766,10 +1766,10 @@ impl<T: Storage> Raft<T> {
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,
);
Expand Down
5 changes: 2 additions & 3 deletions src/tracker/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 52d84aa

Please sign in to comment.