1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-23 16:26:11 +00:00

Preserve oldest snapshot when keep-within* does not collect enough

This commit is contained in:
Gautam Menghani 2023-06-17 18:04:35 +05:30 committed by Michael Eischer
parent 3888c21a27
commit 8da5a6649b
2 changed files with 17 additions and 1 deletions

View file

@ -278,7 +278,7 @@ func ApplyPolicy(list Snapshots, p ExpirePolicy) (keep, remove Snapshots, reason
if cur.Time.After(t) {
val := b.bucker(cur.Time, nr)
if val != b.Last {
if val != b.Last || nr == len(list)-1 {
debug.Log("keep %v, time %v, ID %v, bucker %v, val %v %v\n", b.reason, cur.Time, cur.id.Str(), i, val, b.Last)
keepSnap = true
bucketsWithin[i].Last = val

View file

@ -44,6 +44,11 @@
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2014-08-08T10:20:30Z",
"tree": null,
"paths": null
}
],
"reasons": [
@ -152,6 +157,17 @@
"yearly within 9999y"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-08-08T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"yearly within 9999y"
],
"counters": {}
}
]
}