@@ -288,31 +288,16 @@ func (r *ReconcilePerconaServerMongoDBRestore) reconcilePhysicalRestore(
288
288
289
289
finished , err := r .finishPhysicalRestore (ctx , cluster )
290
290
if err != nil {
291
- return status , err // TODO: shouldn't return error
291
+ log .Error (err , "Failed to recover the cluster after the restore" )
292
+ status .State = psmdbv1 .RestoreStateReady
293
+ return status , nil
292
294
}
293
295
if ! finished {
294
296
return status , nil
295
297
}
296
298
297
299
status .State = psmdbv1 .RestoreStateReady
298
300
299
- err = retry .RetryOnConflict (retry .DefaultBackoff , func () error {
300
- c := new (psmdbv1.PerconaServerMongoDB )
301
- if err := r .client .Get (ctx , client .ObjectKeyFromObject (cluster ), c ); err != nil {
302
- return err
303
- }
304
-
305
- if c .Annotations == nil {
306
- c .Annotations = make (map [string ]string )
307
- }
308
- c .Annotations [psmdbv1 .AnnotationResyncPBM ] = "true"
309
-
310
- return r .client .Update (ctx , c )
311
- })
312
- if err != nil {
313
- return status , errors .Wrapf (err , "annotate psmdb/%s for PBM resync" , cluster .Name )
314
- }
315
-
316
301
return status , nil
317
302
}
318
303
@@ -415,6 +400,22 @@ func (r *ReconcilePerconaServerMongoDBRestore) finishPhysicalRestore(ctx context
415
400
return false , nil
416
401
}
417
402
403
+ if err = retry .RetryOnConflict (retry .DefaultBackoff , func () error {
404
+ c := new (psmdbv1.PerconaServerMongoDB )
405
+ if err := r .client .Get (ctx , client .ObjectKeyFromObject (cluster ), c ); err != nil {
406
+ return err
407
+ }
408
+
409
+ if c .Annotations == nil {
410
+ c .Annotations = make (map [string ]string )
411
+ }
412
+ c .Annotations [psmdbv1 .AnnotationResyncPBM ] = "true"
413
+
414
+ return r .client .Update (ctx , c )
415
+ }); err != nil {
416
+ return false , errors .Wrapf (err , "annotate psmdb/%s for PBM resync" , cluster .Name )
417
+ }
418
+
418
419
if err := r .updateMongodSts (ctx , cluster , func (sts * appsv1.StatefulSet ) error {
419
420
if sts .Annotations [psmdbv1 .AnnotationRestoreInProgress ] == "true" {
420
421
delete (sts .Annotations , psmdbv1 .AnnotationRestoreInProgress )
0 commit comments