raft: compact takes index and nodes parameters
Before this commit, compact always compact log at current appliedindex of raft. This prevents us from doing non-blocking snapshot since we have to make snapshot and compact atomically. To prepare for non-blocking snapshot, this commit make compact supports index and nodes parameters. After completing snapshot, the applier should call compact with the snapshot index and the nodes at snapshot index to do a compaction at snapsohot index.
This commit is contained in:
@ -897,7 +897,7 @@ func TestSlowNodeRestore(t *testing.T) {
|
||||
}
|
||||
lead := nt.peers[1].(*raft)
|
||||
nextEnts(lead)
|
||||
lead.compact(nil)
|
||||
lead.compact(lead.raftLog.applied, lead.nodes(), nil)
|
||||
|
||||
nt.recover()
|
||||
// trigger a snapshot
|
||||
|
Reference in New Issue
Block a user