remove node.json as well, change where we check for raft.db in startup

pull/6158/head
Cory LaNou 2016-03-30 15:43:25 -05:00
parent 7bda8102ac
commit 9bd60c3e07
3 changed files with 16 additions and 8 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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