diff --git a/consul/state_store.go b/consul/state_store.go index 480bc7ec4a..d9a9130167 100644 --- a/consul/state_store.go +++ b/consul/state_store.go @@ -10,9 +10,10 @@ import ( ) const ( - dbNodes = "nodes" // Maps node -> addr - dbServices = "services" // Maps node||serv -> structs.NodeService - dbServiceIndex = "serviceIndex" // Maps serv||tag||node -> structs.ServiceNode + dbNodes = "nodes" // Maps node -> addr + dbServices = "services" // Maps node||serv -> structs.NodeService + dbServiceIndex = "serviceIndex" // Maps serv||tag||node -> structs.ServiceNode + dbMaxMapSize = 1024 * 1024 * 1024 // 1GB maximum size ) var ( @@ -86,6 +87,11 @@ func (s *StateStore) initialize() error { return err } + // Increase the maximum map size + if err := s.env.SetMapSize(dbMaxMapSize); err != nil { + return err + } + // Optimize our flags for speed over safety, since the Raft log + snapshots // are durable. We treat this as an ephemeral in-memory DB, since we nuke // the data anyways.