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 a9bf1d54c1)

closes https://github.com/influxdata/influxdb/issues/23866

Co-authored-by: Ben Tasker <88340935+btasker@users.noreply.github.com>
pull/23888/head
davidby-influx 2022-11-09 09:58:45 -08:00 committed by GitHub
parent b0e44a4659
commit a2fca83af0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

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