@@ -741,10 +741,11 @@ func (s *EtcdServer) ReportSnapshot(id uint64, status raft.SnapshotStatus) {
741
741
}
742
742
743
743
type etcdProgress struct {
744
- confState raftpb.ConfState
745
- diskSnapshotIndex uint64
746
- appliedt uint64
747
- appliedi uint64
744
+ confState raftpb.ConfState
745
+ diskSnapshotIndex uint64
746
+ memorySnapshotIndex uint64
747
+ appliedt uint64
748
+ appliedi uint64
748
749
}
749
750
750
751
// raftReadyHandler contains a set of EtcdServer operations to be called by raftNode,
@@ -809,10 +810,11 @@ func (s *EtcdServer) run() {
809
810
s .r .start (rh )
810
811
811
812
ep := etcdProgress {
812
- confState : sn .Metadata .ConfState ,
813
- diskSnapshotIndex : sn .Metadata .Index ,
814
- appliedt : sn .Metadata .Term ,
815
- appliedi : sn .Metadata .Index ,
813
+ confState : sn .Metadata .ConfState ,
814
+ diskSnapshotIndex : sn .Metadata .Index ,
815
+ memorySnapshotIndex : sn .Metadata .Index ,
816
+ appliedt : sn .Metadata .Term ,
817
+ appliedi : sn .Metadata .Index ,
816
818
}
817
819
818
820
defer func () {
@@ -1133,6 +1135,7 @@ func (s *EtcdServer) applySnapshot(ep *etcdProgress, toApply *toApply) {
1133
1135
ep .appliedt = toApply .snapshot .Metadata .Term
1134
1136
ep .appliedi = toApply .snapshot .Metadata .Index
1135
1137
ep .diskSnapshotIndex = ep .appliedi
1138
+ ep .memorySnapshotIndex = ep .appliedi
1136
1139
ep .confState = toApply .snapshot .Metadata .ConfState
1137
1140
1138
1141
// As backends and implementations like alarmsStore changed, we need
@@ -2160,6 +2163,7 @@ func (s *EtcdServer) snapshot(ep *etcdProgress) {
2160
2163
lg .Panic ("failed to save snapshot" , zap .Error (err ))
2161
2164
}
2162
2165
ep .diskSnapshotIndex = ep .appliedi
2166
+ ep .memorySnapshotIndex = ep .appliedi
2163
2167
if err = s .r .storage .Release (snap ); err != nil {
2164
2168
lg .Panic ("failed to release wal" , zap .Error (err ))
2165
2169
}
0 commit comments