Merge pull request #6051 from mvadu/Fix_Windows_CreateDB

Fix Issue#6042, #6030 CreateDatabase failure on Windows
pull/6059/head
Jonathan A. Sternberg 2016-03-18 13:13:47 -04:00
commit d61d75f55d
4 changed files with 28 additions and 1 deletions

View File

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

View File

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

View File

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

View File

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