Skip to content

Commit

Permalink
storage: drop raftentry.Cache data in applySnapshot
Browse files Browse the repository at this point in the history
Add logic to clear cached raft log entries when applying a snapshot.

Release note: None
  • Loading branch information
ajwerner committed Apr 24, 2019
1 parent ca112d6 commit 0071acd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/storage/replica_raftstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,9 @@ func (r *Replica) applySnapshot(
if err := clearRangeData(ctx, s.Desc, r.store.Engine(), batch, true /* destroyData */); err != nil {
return err
}
// Clear the cached raft log entries to ensure that old or uncommitted
// entries don't impact the in-memory state.
r.store.raftEntryCache.Drop(r.RangeID)
stats.clear = timeutil.Now()

// Write the snapshot into the range.
Expand Down

0 comments on commit 0071acd

Please sign in to comment.