Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: better error for no data from snapshots #22452

Merged
merged 1 commit into from
Sep 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 2.x and 1.x Enterprise this API has a much improved wire format and will properly transmit errors. Not worth fixing in 1.x OSS, but we can at least point at the server side logs which will have the real error.

// '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