Skip to content

Commit

Permalink
backup: report when batches fail on restore
Browse files Browse the repository at this point in the history
if one of the batches sent fails, zed will hide
the underlying error and just report EOF.

The gRPC backend will report EOF as part of an error,
which will have to eb retrieved via CloseAndRecv().

A common error that surfaced as EOF was duplicate
relationships after reimporting the same backup file.

Closes #310.

Co-authored-by: Víctor Roldán Betancort <[email protected]>
  • Loading branch information
jzelinskie and vroldanbet committed Dec 8, 2023
1 parent 274701f commit 4869932
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/cmd/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ func restoreCmdFunc(cmd *cobra.Command, args []string) error {
if err := relationshipWriter.Send(&v1.BulkImportRelationshipsRequest{
Relationships: batch,
}); err != nil {
return fmt.Errorf("error sending batch to server: %w", err)
_, closeErr := relationshipWriter.CloseAndRecv()
return fmt.Errorf("error sending batch to server: %w", errors.Join(err, closeErr))
}

// Reset the relationships in the batch
Expand Down

0 comments on commit 4869932

Please sign in to comment.