Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
modify onenote skip, clues add collection scope (#4472)
Browse files Browse the repository at this point in the history
some additional logging context for collection scope.

---

#### Does this PR need a docs update or release note?

- [x] ⛔ No

#### Type of change

- [x] 🤖 Supportability/Tests


#### Test Plan

- [x] ⚡ Unit test
- [x] 💚 E2E
  • Loading branch information
ryanfkeepers authored Oct 11, 2023
1 parent 3656e04 commit 107b688
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
18 changes: 13 additions & 5 deletions src/internal/m365/collection/drive/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,28 @@ func (oc *Collection) getDriveItemContent(

// Skip big OneNote files as they can't be downloaded
if clues.HasLabel(err, graph.LabelStatus(http.StatusServiceUnavailable)) &&
// oc.scope == CollectionScopePackage && *item.GetSize() >= MaxOneNoteFileSize {
// TODO: We've removed the file size check because it looks like we've seen persistent
// 503's with smaller OneNote files also.
// oc.scope == CollectionScopePackage && *item.GetSize() >= MaxOneNoteFileSize {
oc.scope == CollectionScopePackage {
// FIXME: It is possible that in case of a OneNote file we
// will end up just backing up the `onetoc2` file without
// the one file which is the important part of the OneNote
// "item". This will have to be handled during the
// restore, or we have to handle it separately by somehow
// deleting the entire collection.
logger.CtxErr(ctx, err).With("skipped_reason", fault.SkipBigOneNote).Info("max OneNote file size exceeded")
errs.AddSkip(ctx, fault.FileSkip(fault.SkipBigOneNote, driveID, itemID, itemName, graph.ItemInfo(item)))

return nil, clues.Wrap(err, "max oneNote item").Label(graph.LabelsSkippable)
logger.
CtxErr(ctx, err).
With("skipped_reason", fault.SkipOneNote).
Info("inaccessible one note file")
errs.AddSkip(ctx, fault.FileSkip(
fault.SkipOneNote,
driveID,
itemID,
itemName,
graph.ItemInfo(item)))

return nil, clues.Wrap(err, "inaccesible oneNote item").Label(graph.LabelsSkippable)
}

errs.AddRecoverable(
Expand Down
2 changes: 2 additions & 0 deletions src/internal/m365/collection/drive/collections.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,8 @@ func (c *Collections) UpdateCollections(
colScope = CollectionScopePackage
}

ictx = clues.Add(ictx, "collection_scope", colScope)

col, err := NewCollection(
c.handler,
c.protectedResource,
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func New(
switch true {
case s.HasCause(fault.SkipMalware):
malware++
case s.HasCause(fault.SkipBigOneNote):
case s.HasCause(fault.SkipOneNote):
invalidONFile++
default:
otherSkips++
Expand Down
8 changes: 4 additions & 4 deletions src/pkg/fault/skipped.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const (
// permanently fail any attempts to backup or restore.
SkipMalware skipCause = "malware_detected"

// SkipBigOneNote identifies that a file was skipped because it
// was big OneNote file and we can only download OneNote files which
// are less that 2GB in size.
// SkipOneNote identifies that a file was skipped because it
// was a OneNote file that remains inaccessible (503 server response)
// regardless of the number of retries.
//nolint:lll
// https://support.microsoft.com/en-us/office/restrictions-and-limitations-in-onedrive-and-sharepoint-64883a5d-228e-48f5-b3d2-eb39e07630fa#onenotenotebooks
SkipBigOneNote skipCause = "big_one_note_file"
SkipOneNote skipCause = "inaccessible_one_note_file"
)

var _ print.Printable = &Skipped{}
Expand Down

0 comments on commit 107b688

Please sign in to comment.