Skip to content

Commit

Permalink
restore: report error if one of the batches fail
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.
  • Loading branch information
vroldanbet committed Nov 23, 2023
1 parent 7942023 commit c2d9d78
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/cmd/restore.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -127,7 +128,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 c2d9d78

Please sign in to comment.