File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1207,6 +1207,7 @@ func (s *EtcdServer) triggerSnapshot(ep *etcdProgress) {
12071207 s .forceSnapshot = false
12081208
12091209 s .snapshot (ep .appliedi , ep .confState )
1210+ s .compactRaftLog (ep .appliedi )
12101211 ep .snapi = ep .appliedi
12111212}
12121213
@@ -2171,6 +2172,11 @@ func (s *EtcdServer) snapshot(snapi uint64, confState raftpb.ConfState) {
21712172 zap .Uint64 ("snapshot-index" , snap .Metadata .Index ),
21722173 )
21732174
2175+ }
2176+
2177+ func (s * EtcdServer ) compactRaftLog (snapi uint64 ) {
2178+ lg := s .Logger ()
2179+
21742180 // When sending a snapshot, etcd will pause compaction.
21752181 // After receives a snapshot, the slow follower needs to get all the entries right after
21762182 // the snapshot sent to catch up. If we do not pause compaction, the log entries right after
@@ -2187,7 +2193,7 @@ func (s *EtcdServer) snapshot(snapi uint64, confState raftpb.ConfState) {
21872193 compacti = snapi - s .Cfg .SnapshotCatchUpEntries
21882194 }
21892195
2190- err = s .r .raftStorage .Compact (compacti )
2196+ err : = s .r .raftStorage .Compact (compacti )
21912197 if err != nil {
21922198 // the compaction was done asynchronously with the progress of raft.
21932199 // raft log might already been compact.
You can’t perform that action at this time.
0 commit comments