Skip to content

Commit

Permalink
fix: pr comments
Browse files Browse the repository at this point in the history
Signed-off-by: GuyLewin <[email protected]>
  • Loading branch information
GuyLewin committed Jul 3, 2023
1 parent 19adcb3 commit b0a3740
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ impl<T: Storage> Raft<T> {
if raft_state.hard_state != HardState::default() {
r.load_state(&raft_state.hard_state);
}
if r.term == 0 {
if !r.prs.is_empty() && r.term == 0 {
fatal!(r.logger, "Invalid term value: 0");
}
if c.applied > 0 {
Expand Down
4 changes: 4 additions & 0 deletions src/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ impl ProgressTracker {
self.votes.clear();
}

pub(crate) fn is_empty(&self) -> bool {
self.progress.is_empty() && self.votes.is_empty()
}

/// Returns true if (and only if) there is only one voting member
/// (i.e. the leader) in the current configuration.
pub fn is_singleton(&self) -> bool {
Expand Down

0 comments on commit b0a3740

Please sign in to comment.