Skip to content

Commit

Permalink
fix: restore when tape is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelncui committed Sep 27, 2023
1 parent 80f2cb2 commit e14166f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions executor/job_restore_param.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ func (e *Executor) createRestore(ctx context.Context, job *Job, param *entity.Jo
}
}

tapeMap, err := e.lib.MGetTape(ctx, lo.Keys(tapeMapping)...)
tapes, err := e.lib.MGetTape(ctx, lo.Keys(tapeMapping)...)
if err != nil {
return err
}
for tapeID := range tapeMapping {
if tape, has := tapeMap[tapeID]; has && tape != nil {
if tape, has := tapes[tapeID]; has && tape != nil {
continue
}

logrus.WithContext(ctx).Infof("tape not found, tape_id= %d", tapeID)
delete(tapeMap, tapeID)
delete(tapeMapping, tapeID)
}

restoreTapes := make([]*entity.RestoreTape, 0, len(tapeMapping))
Expand Down Expand Up @@ -135,7 +135,7 @@ func (e *Executor) createRestore(ctx context.Context, job *Job, param *entity.Jo

restoreTapes = append(restoreTapes, &entity.RestoreTape{
TapeId: maxTapeID,
Barcode: tapeMap[maxTapeID].Barcode,
Barcode: tapes[maxTapeID].Barcode,
Status: entity.CopyStatus_PENDING,
Files: targets,
})
Expand Down

0 comments on commit e14166f

Please sign in to comment.