From a429f374b4fc069a59dee55ef4098eac85f2e070 Mon Sep 17 00:00:00 2001 From: Sam Arnold Date: Mon, 4 Oct 2021 15:40:33 -0400 Subject: [PATCH] fix: better error for no data from snapshots (#22452) (#22616) Closes: #22450 (cherry picked from commit 84b785b78c920c6b941ed72f2973d73496afc6b7) --- cmd/influxd/backup/backup.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/influxd/backup/backup.go b/cmd/influxd/backup/backup.go index d0cc1ab9630..01562c72c37 100644 --- a/cmd/influxd/backup/backup.go +++ b/cmd/influxd/backup/backup.go @@ -541,9 +541,15 @@ func (cmd *Command) download(req *snapshotter.Request, path string) error { } // Read snapshot from the connection - if n, err := io.Copy(f, conn); err != nil || n == 0 { + n, err := io.Copy(f, conn) + if err != nil { return fmt.Errorf("copy backup to file: err=%v, n=%d", err, n) } + if n == 0 { + // Unfortunately there is no out-of-band channel to actually return errors from the snapshot service, just + // 'data' or 'no data'. + return fmt.Errorf("copy backup to file: no data returned, check server logs for snapshot errors") + } return nil }(); err == nil { break