Skip to content

Commit

Permalink
fix: better error for no data from snapshots (#22452) (#22616)
Browse files Browse the repository at this point in the history
Closes: #22450
(cherry picked from commit 84b785b)
  • Loading branch information
lesam authored Oct 4, 2021
1 parent 9705488 commit a429f37
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/influxd/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a429f37

Please sign in to comment.