Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Restore fixes #6158

Merged
merged 4 commits into from
Mar 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [#6148](https://github.com/influxdata/influxdb/pull/6148): Build script is now compatible with Python 3. Added ability to create detached signatures for packages. Build script now uses Python logging facility for messages.
- [#6115](https://github.com/influxdata/influxdb/issues/6115): Support chunking query results mid-series. Limit non-chunked output.
- [#6166](https://github.com/influxdata/influxdb/pull/6166): Teach influxdb client how to use chunked queries and use in the CLI.
- [#6158](https://github.com/influxdata/influxdb/pull/6158): Update influxd to detect an upgrade from `0.11` to `0.12`. Minor restore bug fixes.

### Bugfixes

Expand Down
21 changes: 20 additions & 1 deletion cmd/influxd/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (cmd *Command) unpackMeta() error {

// Copy meta config and remove peers so it starts in single mode.
c := cmd.MetaConfig
c.LoggingEnabled = false
c.Dir = cmd.metadir

// Create the meta dir
if os.MkdirAll(c.Dir, 0700); err != nil {
Expand All @@ -193,6 +193,25 @@ func (cmd *Command) unpackMeta() error {
if err := client.SetData(&data); err != nil {
return fmt.Errorf("set data: %s", err)
}

// remove the raft.db file if it exists
err = os.Remove(filepath.Join(cmd.metadir, "raft.db"))
if err != nil {
if os.IsNotExist(err) {
return nil
}
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
}

Expand Down
7 changes: 7 additions & 0 deletions cmd/influxd/run/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion services/meta/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func NewClient(config *Config) *Client {
func (c *Client) Open() error {
c.mu.Lock()
defer c.mu.Unlock()

// Try to load from disk
if err := c.Load(); err != nil {
return err
Expand Down Expand Up @@ -975,7 +976,7 @@ func snapshot(path string, data *Data) error {
return err
}

if err = f.Close(); nil != err {
if err = f.Sync(); err != nil {
return err
}

Expand Down