mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: commit v3 storage before releasing WAL
This ensures that v3 storage could always find the following log entries when restart.
This commit is contained in:
@@ -1029,6 +1029,13 @@ func (s *EtcdServer) snapshot(snapi uint64, confState raftpb.ConfState) {
|
||||
}
|
||||
plog.Panicf("unexpected create snapshot error %v", err)
|
||||
}
|
||||
if s.cfg.V3demo {
|
||||
// commit v3 storage because WAL file before snapshot index
|
||||
// could be removed after SaveSnap.
|
||||
s.kv.Commit()
|
||||
}
|
||||
// SaveSnap saves the snapshot and releases the locked wal files
|
||||
// to the snapshot index.
|
||||
if err := s.r.storage.SaveSnap(snap); err != nil {
|
||||
plog.Fatalf("save snapshot error: %v", err)
|
||||
}
|
||||
|
||||
@@ -186,6 +186,7 @@ func (kv *nopKV) TxnDeleteRange(txnID int64, key, end []byte) (n, rev int64, err
|
||||
func (kv *nopKV) Compact(rev int64) error { return nil }
|
||||
func (kv *nopKV) Hash() (uint32, error) { return 0, nil }
|
||||
func (kv *nopKV) Snapshot() dstorage.Snapshot { return &fakeSnapshot{} }
|
||||
func (kv *nopKV) Commit() {}
|
||||
func (kv *nopKV) Restore() error { return nil }
|
||||
func (kv *nopKV) Close() error { return nil }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user