mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: remove redundant storage restore operation
This commit is contained in:
parent
59f5fb25a5
commit
3c85b67f7b
@ -21,8 +21,6 @@ import (
|
||||
|
||||
"go.etcd.io/etcd/etcdserver/api/snap"
|
||||
"go.etcd.io/etcd/etcdserver/cindex"
|
||||
"go.etcd.io/etcd/lease"
|
||||
"go.etcd.io/etcd/mvcc"
|
||||
"go.etcd.io/etcd/mvcc/backend"
|
||||
"go.etcd.io/etcd/raft/raftpb"
|
||||
|
||||
@ -96,9 +94,7 @@ func openBackend(cfg ServerConfig) backend.Backend {
|
||||
// case, replace the db with the snapshot db sent by the leader.
|
||||
func recoverSnapshotBackend(cfg ServerConfig, oldbe backend.Backend, snapshot raftpb.Snapshot) (backend.Backend, error) {
|
||||
ci := cindex.NewConsistentIndex(oldbe.BatchTx())
|
||||
kv := mvcc.New(cfg.Logger, oldbe, &lease.FakeLessor{}, ci, mvcc.StoreConfig{CompactionBatchLimit: cfg.CompactionBatchLimit})
|
||||
defer kv.Close()
|
||||
if snapshot.Metadata.Index <= kv.ConsistentIndex() {
|
||||
if snapshot.Metadata.Index <= ci.ConsistentIndex() {
|
||||
return oldbe, nil
|
||||
}
|
||||
oldbe.Close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user