From 732bac17a459d1adf08a6b62610362e5621bddd6 Mon Sep 17 00:00:00 2001 From: Keepers Date: Mon, 25 Sep 2023 12:35:47 -0600 Subject: [PATCH] add missing recoverable errs (#4363) groups collection item streaming is missing recoverable errors, and is only logging at this time. This may be causing backups to succeed even when errors should cause a failure. --- #### Does this PR need a docs update or release note? - [x] :no_entry: No #### Type of change - [x] :bug: Bugfix #### Issue(s) * #3988 #### Test Plan - [x] :zap: Unit test - [x] :green_heart: E2E --- src/internal/m365/collection/drive/collection.go | 7 +++++-- src/internal/m365/collection/exchange/collection.go | 9 ++++++--- src/internal/m365/collection/groups/collection.go | 6 +++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/internal/m365/collection/drive/collection.go b/src/internal/m365/collection/drive/collection.go index a69e771a6..95af07e21 100644 --- a/src/internal/m365/collection/drive/collection.go +++ b/src/internal/m365/collection/drive/collection.go @@ -301,8 +301,11 @@ func (oc *Collection) getDriveItemContent( return nil, clues.Wrap(err, "max oneNote item").Label(graph.LabelsSkippable) } - logger.CtxErr(ctx, err).Error("downloading item content") - errs.AddRecoverable(ctx, clues.Stack(err).WithClues(ctx).Label(fault.LabelForceNoBackupCreation)) + errs.AddRecoverable( + ctx, + clues.Wrap(err, "downloading item content"). + WithClues(ctx). + Label(fault.LabelForceNoBackupCreation)) // return err, not el.Err(), because the lazy reader needs to communicate to // the data consumer that this item is unreadable, regardless of the fault state. diff --git a/src/internal/m365/collection/exchange/collection.go b/src/internal/m365/collection/exchange/collection.go index e55882bf6..486d2d487 100644 --- a/src/internal/m365/collection/exchange/collection.go +++ b/src/internal/m365/collection/exchange/collection.go @@ -244,11 +244,14 @@ func (col *prefetchCollection) streamItems( }(id) } - parentPath := col.LocationPath().String() + var ( + parentPath = col.LocationPath().String() + el = errs.Local() + ) // add any new items for id := range col.added { - if errs.Failure() != nil { + if el.Failure() != nil { break } @@ -276,7 +279,7 @@ func (col *prefetchCollection) streamItems( atomic.AddInt64(&success, 1) log.With("err", err).Infow("item not found", clues.InErr(err).Slice()...) } else { - errs.AddRecoverable(ctx, clues.Wrap(err, "fetching item").Label(fault.LabelForceNoBackupCreation)) + el.AddRecoverable(ctx, clues.Wrap(err, "fetching item").Label(fault.LabelForceNoBackupCreation)) } return diff --git a/src/internal/m365/collection/groups/collection.go b/src/internal/m365/collection/groups/collection.go index 2bf5f1668..a1e364b93 100644 --- a/src/internal/m365/collection/groups/collection.go +++ b/src/internal/m365/collection/groups/collection.go @@ -212,18 +212,18 @@ func (col *Collection) streamItems(ctx context.Context, errs *fault.Bus) { parentFolderID, id) if err != nil { - logger.CtxErr(ctx, err).Info("writing channel message to serializer") + el.AddRecoverable(ctx, clues.Wrap(err, "writing channel message to serializer")) return } if err := writer.WriteObjectValue("", item); err != nil { - logger.CtxErr(ctx, err).Info("writing channel message to serializer") + el.AddRecoverable(ctx, clues.Wrap(err, "writing channel message to serializer")) return } data, err := writer.GetSerializedContent() if err != nil { - logger.CtxErr(ctx, err).Info("serializing channel message") + el.AddRecoverable(ctx, clues.Wrap(err, "serializing channel message")) return }