Compare commits

...

1 Commits

Author SHA1 Message Date
ryanfkeepers
7f606eddce don't look up details if id is missing in backup
In case of a failure that causes the detailsID to not be
recorded in the backup, do not attempt to look up
the details from the model store.
2023-01-08 13:49:54 -07:00
2 changed files with 12 additions and 0 deletions

View File

@ -556,6 +556,12 @@ func mergeDetails(
detailsStore,
)
if err != nil {
// if the backup has no prior details recorded, then there's nothing to merge.
if errors.Is(err, errNoDetailsID) {
logger.Ctx(ctx).Infof("backup %s contains no details ID, skipping merger", bID)
continue
}
return errors.Wrapf(err, "backup fetching base details for backup %s", bID)
}

View File

@ -15,6 +15,8 @@ type detailsReader interface {
ReadBackupDetails(ctx context.Context, detailsID string) (*details.Details, error)
}
var errNoDetailsID = errors.New("no details id in backup")
func getBackupAndDetailsFromID(
ctx context.Context,
backupID model.StableID,
@ -26,6 +28,10 @@ func getBackupAndDetailsFromID(
return nil, nil, errors.Wrap(err, "getting backup details ID")
}
if len(dID) == 0 {
return nil, nil, errNoDetailsID
}
deets, err := detailsStore.ReadBackupDetails(ctx, dID)
if err != nil {
return nil, nil, errors.Wrap(err, "getting backup details data")