From 98af033b75f2b2747a9ead595e87f8c047d31c3d Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Fri, 8 Dec 2023 12:05:39 -0500 Subject: [PATCH] backup: report when batches fail on restore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- internal/cmd/backup.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/cmd/backup.go b/internal/cmd/backup.go index c35adfa9..e790c980 100644 --- a/internal/cmd/backup.go +++ b/internal/cmd/backup.go @@ -337,7 +337,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