mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix snapshot
This commit is contained in:
@@ -60,7 +60,7 @@ func NewPeerServer(name string, path string, url string, listenHost string, tlsC
|
||||
tlsInfo: tlsInfo,
|
||||
registry: registry,
|
||||
store: store,
|
||||
snapConf: &snapshotConf{time.Second * 3, 0, 20 * 1000},
|
||||
snapConf: &snapshotConf{time.Second * 3, 0, 2},
|
||||
followersStats: &raftFollowersStats{
|
||||
Leader: name,
|
||||
Followers: make(map[string]*raftFollowerStats),
|
||||
@@ -391,10 +391,10 @@ func (s *PeerServer) PeerStats() []byte {
|
||||
func (s *PeerServer) monitorSnapshot() {
|
||||
for {
|
||||
time.Sleep(s.snapConf.checkingInterval)
|
||||
currentWrites := 0
|
||||
currentWrites := s.store.TotalTransactions() - s.snapConf.lastWrites
|
||||
if uint64(currentWrites) > s.snapConf.writesThr {
|
||||
s.raftServer.TakeSnapshot()
|
||||
s.snapConf.lastWrites = 0
|
||||
s.snapConf.lastWrites = s.store.TotalTransactions()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user