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:
parent
3888c21a27
commit
8da5a6649b
2 changed files with 17 additions and 1 deletions
|
@ -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…
Reference in a new issue