Skip to content

Commit

Permalink
Fix the snapshot criteria calculation (#3598)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Wang authored Jun 21, 2019
1 parent 132b06f commit a339a25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion worker/draft.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ func (n *node) checkpointAndClose(done chan struct{}) {
if first, err := n.Store.FirstIndex(); err == nil {
// Save some cycles by only calculating snapshot if the checkpoint has gone
// quite a bit further than the first index.
calculate = chk-first >= uint64(x.WorkerConfig.SnapshotAfter)
calculate = chk >= first+uint64(x.WorkerConfig.SnapshotAfter)
}
}
// We keep track of the applied index in the p directory. Even if we don't take
Expand Down

0 comments on commit a339a25

Please sign in to comment.