From 0a76c2bdfc090c37fb43c0ec9562c11b88f03cf6 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Mon, 23 Mar 2015 18:27:14 -0700 Subject: [PATCH 1/2] Clear server maps on close These maps are reloaded from the metastore on open. --- server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server.go b/server.go index 1d5b719177..63ba72203a 100644 --- a/server.go +++ b/server.go @@ -264,6 +264,12 @@ func (s *Server) close() error { _ = sh.close() } + // Server is closing, empty maps which should be reloaded on open. + s.shards = nil + s.dataNodes = nil + s.databases = nil + s.users = nil + return nil } From a8f0dbcf1d7034316ffa7cc901a6d2818d0ea955 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Mon, 23 Mar 2015 18:29:43 -0700 Subject: [PATCH 2/2] Load shards on restart Fix for #2012 --- CHANGELOG.md | 1 + server.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2ff63bf60..0c0dff20cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - [#2034](https://github.com/influxdb/influxdb/pull/2034): Group by should require an aggregate. - [#2040](https://github.com/influxdb/influxdb/pull/2040): Add missing top-level help for config command - [#2057](https://github.com/influxdb/influxdb/pull/2057): Move racy "in order" test to integration test suite. +- [#2060](https://github.com/influxdb/influxdb/pull/2060): Reload server shard map on restart. ## v0.9.0-rc15 [2015-03-19] diff --git a/server.go b/server.go index 63ba72203a..1e07543953 100644 --- a/server.go +++ b/server.go @@ -302,11 +302,16 @@ func (s *Server) load() error { } } - // Open all shards owned by server. + // Load shards. + s.shards = make(map[uint64]*Shard) for _, db := range s.databases { for _, rp := range db.policies { for _, g := range rp.shardGroups { for _, sh := range g.Shards { + // Add to lookups. + s.shards[sh.ID] = sh + + // Only open shards owned by the server. if !sh.HasDataNodeID(s.id) { continue }