Skip to content

Commit b009df6

Browse files
egeguneshors
andauthored
K8SPSMDB-1371: Prevent panic if no oplogs are in PBM metadata (#1913)
Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
1 parent 7cf59a6 commit b009df6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/controller/perconaservermongodbrestore/physical.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,10 @@ func (r *ReconcilePerconaServerMongoDBRestore) getLatestChunkTS(ctx context.Cont
918918
return "", errors.Wrap(err, "unmarshal PBM status output")
919919
}
920920

921+
if len(pbmStatus.Backups.Chunks.Timelines) < 1 {
922+
return "", errors.New("no oplog chunks")
923+
}
924+
921925
latest := pbmStatus.Backups.Chunks.Timelines[len(pbmStatus.Backups.Chunks.Timelines)-1].Range.End
922926
ts := time.Unix(int64(latest), 0).UTC()
923927

0 commit comments

Comments
 (0)