-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change: InstallSnapshotResponse: replies the last applied log id; Do …
…not install a smaller snapshot A snapshot may not be installed by a follower if it already has a higher `last_applied` log id locally. In such a case, it just ignores the snapshot and respond with its local `last_applied` log id. This way the applied state(i.e., `last_applied`) will never revert back.
- Loading branch information
1 parent
6057abb
commit 25e94c3
Showing
4 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
use serde::Deserialize; | ||
use serde::Serialize; | ||
|
||
use crate::MessageSummary; | ||
|
||
/// The identity of a raft log. | ||
/// A term and an index identifies an log globally. | ||
#[derive(Debug, Default, Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Serialize, Deserialize)] | ||
pub struct LogId { | ||
pub term: u64, | ||
pub index: u64, | ||
} | ||
|
||
impl MessageSummary for Option<LogId> { | ||
fn summary(&self) -> String { | ||
match self { | ||
None => "None".to_string(), | ||
Some(log_id) => { | ||
format!("{}", log_id) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters