diff --git a/CHANGELOG.md b/CHANGELOG.md index e1eb815309..f0bcf7a874 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,7 @@ There were some important breaking changes in this release. Here's a list of the - [#6006](https://github.com/influxdata/influxdb/pull/6006): Fix deadlock while running backups - [#5965](https://github.com/influxdata/influxdb/issues/5965): InfluxDB panic crashes while parsing "-" as Float - [#5835](https://github.com/influxdata/influxdb/issues/5835): Make CREATE USER default to IF NOT EXISTS +- [#6042](https://github.com/influxdata/influxdb/issues/6042): CreateDatabase failure on Windows, regression from v0.11.0 RC @mvadu ## v0.10.3 [2016-03-09] diff --git a/services/meta/client.go b/services/meta/client.go index 50dc852286..09f8cdf859 100644 --- a/services/meta/client.go +++ b/services/meta/client.go @@ -983,7 +983,7 @@ func snapshot(path string, data *Data) error { return err } - return os.Rename(tmpFile, file) + return renameFile(tmpFile, file) } // Load will save the current meta data from disk diff --git a/services/meta/file_unix.go b/services/meta/file_unix.go new file mode 100644 index 0000000000..6000f2ce15 --- /dev/null +++ b/services/meta/file_unix.go @@ -0,0 +1,10 @@ +// +build !windows + +package meta + +import "os" + +// renameFile will rename the source to target using os function. +func renameFile(oldpath, newpath string) error { + return os.Rename(oldpath, newpath) +} diff --git a/services/meta/file_windows.go b/services/meta/file_windows.go new file mode 100644 index 0000000000..48381af9c9 --- /dev/null +++ b/services/meta/file_windows.go @@ -0,0 +1,16 @@ +// +build windows + +package meta + +import "os" + +// renameFile will rename the source to target using os function. If target exists it will be removed before renaming. +func renameFile(oldpath, newpath string) error { + if _, err := os.Stat(newpath); err == nil { + if err = os.Remove(newpath); nil != err { + return err + } + } + + return os.Rename(oldpath, newpath) +}