Skip to content

Commit 8210b36

Browse files
committed
Switch fallback strategy for older backups
... and warn user in logs
1 parent 41e275c commit 8210b36

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pbm/restore/physical.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,8 +2633,11 @@ func (r *PhysRestore) checkMongod(needVersion string) (version string, err error
26332633
// It also includes min disk space requirement of 10GiB.
26342634
func (r *PhysRestore) checkDiskSpace(bcpSize int64) error {
26352635
if bcpSize == 0 {
2636-
return errors.New("unable to apply fallback strategy for unknown backup size, " +
2637-
"consider using --fallback-enabled=false")
2636+
r.log.Warning("this backup is incompatible with the fallback strategy, " +
2637+
"fallback will be disabled")
2638+
2639+
r.disableFallbackForOldBackup()
2640+
return nil
26382641
}
26392642

26402643
var stat syscall.Statfs_t
@@ -2657,6 +2660,13 @@ func (r *PhysRestore) checkDiskSpace(bcpSize int64) error {
26572660
return nil
26582661
}
26592662

2663+
// disableFallbackForOldBackup set fallback option to false due to backup incompatibility
2664+
func (r *PhysRestore) disableFallbackForOldBackup() {
2665+
r.fallback = false
2666+
r.log.Debug("restore opts: --fallback-enabled: %t; --allow-partly-done: %t",
2667+
r.fallback, r.allowPartlyDone)
2668+
}
2669+
26602670
// MarkFailed sets the restore and rs state as failed with the given message
26612671
func (r *PhysRestore) MarkFailed(e error) {
26622672
r.log.Error("mark error during restore: %v", e)

0 commit comments

Comments
 (0)