log item path on restore (#2901)

adds the item path to the restore logger, plus some errant ctx usage fixes

---

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

- [x]  No

#### Type of change

- [x] 🤖 Supportability/Tests
This commit is contained in:
Keepers 2023-03-21 13:00:16 -06:00 committed by GitHub
parent 285f8f01ef
commit cb50386b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 8 deletions

View File

@ -333,11 +333,10 @@ func getItemStream(
e, err := snapshotfs.GetNestedEntry(
ctx,
snapshotRoot,
encodeElements(itemPath.PopFront().Elements()...),
)
encodeElements(itemPath.PopFront().Elements()...))
if err != nil {
if isErrEntryNotFound(err) {
err = clues.Stack(data.ErrNotFound, err).WithClues(ctx)
err = clues.Stack(data.ErrNotFound, err)
}
return nil, clues.Wrap(err, "getting nested object handle").WithClues(ctx)
@ -413,7 +412,9 @@ func (w Wrapper) RestoreMultipleItems(
return nil, el.Failure()
}
ds, err := getItemStream(ctx, itemPath, snapshotRoot, bcounter)
ictx := clues.Add(ctx, "item_path", itemPath.String)
ds, err := getItemStream(ictx, itemPath, snapshotRoot, bcounter)
if err != nil {
el.AddRecoverable(clues.Stack(err).Label(fault.LabelForceNoBackupCreation))
continue
@ -422,7 +423,7 @@ func (w Wrapper) RestoreMultipleItems(
parentPath, err := itemPath.Dir()
if err != nil {
el.AddRecoverable(clues.Wrap(err, "making directory collection").
WithClues(ctx).
WithClues(ictx).
Label(fault.LabelForceNoBackupCreation))
continue

View File

@ -525,7 +525,7 @@ func mergeDetails(
mctx = clues.Add(mctx, "manifest_backup_id", bID)
_, baseDeets, err := getBackupAndDetailsFromID(
ctx,
mctx,
model.StableID(bID),
ms,
detailsStore,

View File

@ -97,7 +97,7 @@ func produceManifestsAndMetadata(
// if no backup exists for any of the complete manifests, we want
// to fall back to a complete backup.
if errors.Is(err, data.ErrNotFound) {
logger.Ctx(ctx).Infow("backup missing, falling back to full backup", clues.In(mctx).Slice()...)
logger.Ctx(mctx).Infow("backup missing, falling back to full backup", clues.In(mctx).Slice()...)
return ms, nil, false, nil
}

View File

@ -196,7 +196,8 @@ func (op *RestoreOperation) do(
ctx = clues.Add(
ctx,
"resource_owner", bup.Selector.DiscreteOwner,
"details_paths", len(paths))
"details_paths", len(paths),
"backup_snapshot_id", bup.SnapshotID)
op.bus.Event(
ctx,

View File

@ -284,6 +284,8 @@ func read(
return clues.Stack(err).WithClues(ctx)
}
ctx = clues.Add(ctx, "snapshot_id", snapshotID)
cs, err := rer.RestoreMultipleItems(
ctx,
snapshotID,