فهرست منبع

Keep oldest archive when retention target is not met

Alf Mikula 4 سال پیش
والد
کامیت
943088df2c
1فایلهای تغییر یافته به همراه4 افزوده شده و 0 حذف شده
  1. 4 0
      src/borg/helpers/misc.py

+ 4 - 0
src/borg/helpers/misc.py

@@ -58,6 +58,10 @@ def prune_split(archives, rule, n, kept_because=None):
                 kept_because[a.id] = (rule, len(keep))
                 kept_because[a.id] = (rule, len(keep))
                 if len(keep) == n:
                 if len(keep) == n:
                     break
                     break
+    # Keep oldest archive if we didn't reach the target retention count
+    if len(keep) < n and a.id not in kept_because:
+        keep.append(a)
+        kept_because[a.id] = (rule+"[oldest]", len(keep))
     return keep
     return keep