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.
This commit is contained in:
parent
186569087c
commit
7f606eddce
@ -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)
|
||||
}
|
||||
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user