Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Fullstop000 <fullstop1005@gmail.com>
  • Loading branch information
Fullstop000 committed Jun 18, 2020
1 parent e7b4d25 commit 8fbd9a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions harness/tests/integration_cases/test_raw_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ fn test_commit_pagination_after_restart() {
let ents_count = 10;
let mut ents = Vec::with_capacity(ents_count);
let mut size = 0u64;
for i in 0..ents_count {
let e = new_entry(1, i as u64 + 1, Some("a"));
for i in 0..ents_count as u64 {
let e = new_entry(1, i + 1, Some("a"));
size += u64::from(e.compute_size());
ents.push(e);
}
Expand Down Expand Up @@ -653,9 +653,7 @@ fn test_commit_pagination_after_restart() {
.unwrap()
.get_index();
raw_node.advance(rd);
let mut m = new_message(1, 1, MessageType::MsgHeartbeat, 0);
m.set_term(1);
m.set_commit(11); // leader learns commit index is 11
raw_node.step(m).unwrap();
// node learns commit index is 11
raw_node.raft.r.raft_log.commit_to(11);
}
}
2 changes: 1 addition & 1 deletion src/raw_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,10 @@ impl<T: Storage> RawNode<T> {
// new Commit index, this does not mean that we're also applying
// all of the new entries due to commit pagination by size.
let index = rd.applied_cursor();
self.advance_append(rd);
if index > 0 {
self.advance_apply(index)
}
self.advance_append(rd);
}

/// Appends and commits the ready value.
Expand Down

0 comments on commit 8fbd9a2

Please sign in to comment.