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( e, err := snapshotfs.GetNestedEntry(
ctx, ctx,
snapshotRoot, snapshotRoot,
encodeElements(itemPath.PopFront().Elements()...), encodeElements(itemPath.PopFront().Elements()...))
)
if err != nil { if err != nil {
if isErrEntryNotFound(err) { 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) return nil, clues.Wrap(err, "getting nested object handle").WithClues(ctx)
@ -413,7 +412,9 @@ func (w Wrapper) RestoreMultipleItems(
return nil, el.Failure() 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 { if err != nil {
el.AddRecoverable(clues.Stack(err).Label(fault.LabelForceNoBackupCreation)) el.AddRecoverable(clues.Stack(err).Label(fault.LabelForceNoBackupCreation))
continue continue
@ -422,7 +423,7 @@ func (w Wrapper) RestoreMultipleItems(
parentPath, err := itemPath.Dir() parentPath, err := itemPath.Dir()
if err != nil { if err != nil {
el.AddRecoverable(clues.Wrap(err, "making directory collection"). el.AddRecoverable(clues.Wrap(err, "making directory collection").
WithClues(ctx). WithClues(ictx).
Label(fault.LabelForceNoBackupCreation)) Label(fault.LabelForceNoBackupCreation))
continue continue

View File

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

View File

@ -97,7 +97,7 @@ func produceManifestsAndMetadata(
// if no backup exists for any of the complete manifests, we want // if no backup exists for any of the complete manifests, we want
// to fall back to a complete backup. // to fall back to a complete backup.
if errors.Is(err, data.ErrNotFound) { 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 return ms, nil, false, nil
} }

View File

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

View File

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