From a2fca83af00737063ae997e4542b82705ad0e8b7 Mon Sep 17 00:00:00 2001 From: davidby-influx <72418212+davidby-influx@users.noreply.github.com> Date: Wed, 9 Nov 2022 09:58:45 -0800 Subject: [PATCH] fix: don't write skipped shard messages to the line protocol output destination (#23727) (#23885) This switches so that the message skipped missing file: /path/to/tsm.tsm is written to stdErr instead of stdout (or the output file if `-out` has been provided) (cherry picked from commit a9bf1d54c1eb77c9b5eafef9d1d3db7511ded9c8) closes https://github.com/influxdata/influxdb/issues/23866 Co-authored-by: Ben Tasker <88340935+btasker@users.noreply.github.com> --- cmd/influx_inspect/export/export.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/influx_inspect/export/export.go b/cmd/influx_inspect/export/export.go index 61c5525eb9f..0906f02af9b 100644 --- a/cmd/influx_inspect/export/export.go +++ b/cmd/influx_inspect/export/export.go @@ -340,7 +340,7 @@ func (cmd *Command) exportTSMFile(tsmFilePath string, w io.Writer) error { f, err := os.Open(tsmFilePath) if err != nil { if os.IsNotExist(err) { - fmt.Fprintf(w, "skipped missing file: %s", tsmFilePath) + fmt.Fprintf(cmd.Stderr, "skipped missing file: %s", tsmFilePath) return nil } return err @@ -408,7 +408,7 @@ func (cmd *Command) exportWALFile(walFilePath string, w io.Writer, warnDelete fu f, err := os.Open(walFilePath) if err != nil { if os.IsNotExist(err) { - fmt.Fprintf(w, "skipped missing file: %s", walFilePath) + fmt.Fprintf(cmd.Stderr, "skipped missing file: %s", walFilePath) return nil } return err