@@ -242,7 +242,7 @@ func (r *PhysRestore) close(noerr, cleanup bool) {
242
242
}
243
243
244
244
if cStatus == defs .StatusError {
245
- err := r .migrateFromFallbackDirToDbDir ()
245
+ err := r .migrateFromFallbackDirToDBDir ()
246
246
if err != nil {
247
247
r .log .Error ("migrate from fallback dir: %v" , err )
248
248
}
@@ -349,17 +349,17 @@ func (r *PhysRestore) flush(ctx context.Context) error {
349
349
}
350
350
}
351
351
352
- err = r .migrateDbDirToFallbackDir ()
352
+ err = r .migrateDBDirToFallbackDir ()
353
353
if err != nil {
354
354
return errors .Wrapf (err , "move files to fallback path" )
355
355
}
356
356
357
357
return nil
358
358
}
359
359
360
- // migrateDbDirToFallbackDir moves content of dbPath dir into fallback dir.
360
+ // migrateDBDirToFallbackDir moves content of dbPath dir into fallback dir.
361
361
// It also removes old fallback dir, and creates new with the same perms.
362
- func (r * PhysRestore ) migrateDbDirToFallbackDir () error {
362
+ func (r * PhysRestore ) migrateDBDirToFallbackDir () error {
363
363
dbpath := filepath .Clean (r .dbpath )
364
364
fallbackPath := filepath .Join (dbpath , fallbackDir )
365
365
r .log .Debug ("dbpath: %s, fallbackPath: %s" , dbpath , fallbackPath )
@@ -388,19 +388,21 @@ func (r *PhysRestore) migrateDbDirToFallbackDir() error {
388
388
return nil
389
389
}
390
390
391
- // migrateFromFallbackDirToDbDir wipe up dbpath dir and
391
+ // migrateFromFallbackDirToDBDir wipe up dbpath dir and
392
392
// moves all content from fallback path.
393
- func (r * PhysRestore ) migrateFromFallbackDirToDbDir () error {
393
+ func (r * PhysRestore ) migrateFromFallbackDirToDBDir () error {
394
394
r .log .Debug ("clean-up dbpath" )
395
395
err := removeAll (r .dbpath , []string {fallbackDir }, r .log )
396
396
if err != nil {
397
397
r .log .Error ("flush dbpath %s: %v" , r .dbpath , err )
398
+ return errors .Wrap (err , "remove all from dbpath" )
398
399
}
399
400
400
401
r .log .Info ("move data files from %s to %s" , fallbackDir , r .dbpath )
401
402
err = r .moveFromFallback ()
402
403
if err != nil {
403
404
r .log .Error ("moving from %s: %v" , fallbackDir , err )
405
+ return errors .Wrapf (err , "move from %s" , fallbackDir )
404
406
}
405
407
406
408
return nil
@@ -2483,13 +2485,15 @@ func (r *PhysRestore) MarkFailed(meta *RestoreMeta, e error) {
2483
2485
// (in `toState` method).
2484
2486
// Here we are not aware of partlyDone etc so leave it to the `toState`.
2485
2487
if r .checkForRSLevelErr () {
2488
+ r .log .Debug ("set error on rs level" )
2486
2489
serr := util .RetryableWrite (r .stg ,
2487
2490
r .syncPathRS + "." + string (defs .StatusError ), errStatus (e ))
2488
2491
if serr != nil {
2489
2492
r .log .Error ("MarkFailed: write replset error state `%v`: %v" , e , serr )
2490
2493
}
2491
2494
}
2492
2495
if r .nodeInfo .IsLeader () && r .checkForClusterLevelErr () {
2496
+ r .log .Debug ("set error on cluster level" )
2493
2497
serr := util .RetryableWrite (r .stg ,
2494
2498
r .syncPathCluster + "." + string (defs .StatusError ), errStatus (e ))
2495
2499
if serr != nil {
0 commit comments