mirror of
https://github.com/octoleo/restic.git
synced 2025-01-30 18:38:49 +00:00
Preserve oldest snapshot when keep-within* does not collect enough
This commit is contained in:
parent
3888c21a27
commit
8da5a6649b
@ -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
|
||||
|
@ -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": {}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user