From 9bd60c3e0762b3ca112bac13a1c784bce5296333 Mon Sep 17 00:00:00 2001 From: Cory LaNou Date: Wed, 30 Mar 2016 15:43:25 -0500 Subject: [PATCH] remove node.json as well, change where we check for raft.db in startup --- cmd/influxd/restore/restore.go | 9 +++++++++ cmd/influxd/run/server.go | 7 +++++++ services/meta/client.go | 8 -------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cmd/influxd/restore/restore.go b/cmd/influxd/restore/restore.go index ef6f307c74..3fcbf476cf 100644 --- a/cmd/influxd/restore/restore.go +++ b/cmd/influxd/restore/restore.go @@ -203,6 +203,15 @@ func (cmd *Command) unpackMeta() error { return err } + // remove the node.json file if it exists + err = os.Remove(filepath.Join(cmd.metadir, "node.json")) + if err != nil { + if os.IsNotExist(err) { + return nil + } + return err + } + return nil } diff --git a/cmd/influxd/run/server.go b/cmd/influxd/run/server.go index b602020422..1710abf893 100644 --- a/cmd/influxd/run/server.go +++ b/cmd/influxd/run/server.go @@ -115,6 +115,13 @@ func NewServer(c *Config, buildInfo *BuildInfo) (*Server, error) { } } + // Check to see if there is a raft db, if so, error out with a message + // to downgrade, export, and then import the meta data + raftFile := filepath.Join(c.Meta.Dir, "raft.db") + if _, err := os.Stat(raftFile); err == nil { + return nil, fmt.Errorf("detected %s. either downgrade and export your meta data to import before continuing, or delete the file to start fresh", raftFile) + } + // In 0.10.0 bind-address got moved to the top level. Check // The old location to keep things backwards compatible bind := c.BindAddress diff --git a/services/meta/client.go b/services/meta/client.go index d086bf9188..13946a733f 100644 --- a/services/meta/client.go +++ b/services/meta/client.go @@ -91,14 +91,6 @@ func (c *Client) Open() error { c.mu.Lock() defer c.mu.Unlock() - // Check to see if there is a raft db, if so, error out with a message - // to downgrade, export, and then import the meta data - - raftFile := filepath.Join(c.path, "raft.db") - if _, err := os.Stat(raftFile); err == nil { - return fmt.Errorf("detected %s. either downgrade and export your meta data to import before continuing, or delete the file to start fresh", raftFile) - } - // Try to load from disk if err := c.Load(); err != nil { return err