From e54d8f6c0710077fda14b71015de238cdaf05d4e Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Sat, 22 Feb 2014 10:57:22 -0800 Subject: [PATCH] consul: Reduce the number of raft snapshots we keep --- consul/server.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/consul/server.go b/consul/server.go index a01145c2a5..970025db6a 100644 --- a/consul/server.go +++ b/consul/server.go @@ -14,9 +14,10 @@ import ( ) const ( - serfLANSnapshot = "serf/local.snapshot" - serfWANSnapshot = "serf/remote.snapshot" - raftState = "raft/" + serfLANSnapshot = "serf/local.snapshot" + serfWANSnapshot = "serf/remote.snapshot" + raftState = "raft/" + snapshotsRetained = 2 ) // Server is Consul server which manages the service discovery, @@ -207,7 +208,7 @@ func (s *Server) setupRaft() error { s.raftStore = store // Create the snapshot store - snapshots, err := raft.NewFileSnapshotStore(path, 3, s.config.LogOutput) + snapshots, err := raft.NewFileSnapshotStore(path, snapshotsRetained, s.config.LogOutput) if err != nil { store.Close() return err