Merge pull request #8764 from influxdata/dn-8638-influx_inspect

fix #8638: inspect shouldn't err on missing file
pull/8752/head
David Norton 2017-08-30 10:21:22 -04:00 committed by GitHub
commit 0da711675f
3 changed files with 21 additions and 0 deletions

View File

@ -43,6 +43,7 @@
- [#8699](https://github.com/influxdata/influxdb/issues/8699): Force subqueries to match the parent queries ordering. - [#8699](https://github.com/influxdata/influxdb/issues/8699): Force subqueries to match the parent queries ordering.
- [#8755](https://github.com/influxdata/influxdb/pull/8755): Fix race condition accessing `seriesByID` map. - [#8755](https://github.com/influxdata/influxdb/pull/8755): Fix race condition accessing `seriesByID` map.
- [#8766](https://github.com/influxdata/influxdb/pull/8766): Fix deadlock when calling `SeriesIDsAllOrByExpr` - [#8766](https://github.com/influxdata/influxdb/pull/8766): Fix deadlock when calling `SeriesIDsAllOrByExpr`
- [#8638](https://github.com/influxdata/influxdb/issues/8638): Fix `influx_inspect export` so it skips missing files.
## v1.3.4 [unreleased] ## v1.3.4 [unreleased]

View File

@ -261,6 +261,10 @@ func (cmd *Command) writeTsmFiles(w io.Writer, files []string) error {
func (cmd *Command) exportTSMFile(tsmFilePath string, w io.Writer) error { func (cmd *Command) exportTSMFile(tsmFilePath string, w io.Writer) error {
f, err := os.Open(tsmFilePath) f, err := os.Open(tsmFilePath)
if err != nil { if err != nil {
if os.IsNotExist(err) {
fmt.Fprintf(w, "skipped missing file: %s", tsmFilePath)
return nil
}
return err return err
} }
defer f.Close() defer f.Close()
@ -325,6 +329,10 @@ or manually editing the exported file.
func (cmd *Command) exportWALFile(walFilePath string, w io.Writer, warnDelete func()) error { func (cmd *Command) exportWALFile(walFilePath string, w io.Writer, warnDelete func()) error {
f, err := os.Open(walFilePath) f, err := os.Open(walFilePath)
if err != nil { if err != nil {
if os.IsNotExist(err) {
fmt.Fprintf(w, "skipped missing file: %s", walFilePath)
return nil
}
return err return err
} }
defer f.Close() defer f.Close()

View File

@ -95,6 +95,12 @@ func Test_exportWALFile(t *testing.T) {
} }
} }
} }
// Missing .wal file should not cause a failure.
var out bytes.Buffer
if err := newCommand().exportWALFile("file-that-does-not-exist.wal", &out, func() {}); err != nil {
t.Fatal(err)
}
} }
func Test_exportTSMFile(t *testing.T) { func Test_exportTSMFile(t *testing.T) {
@ -128,6 +134,12 @@ func Test_exportTSMFile(t *testing.T) {
} }
} }
} }
// Missing .tsm file should not cause a failure.
var out bytes.Buffer
if err := newCommand().exportTSMFile("file-that-does-not-exist.tsm", &out); err != nil {
t.Fatal(err)
}
} }
var sink interface{} var sink interface{}