Repository navigation
prune: Use calendar-aware retention intervals #10541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,7 +23,15 @@ The ``borg prune`` ``--keep-*`` retention options accept either a plain count | |||||||||||||||||||||||||
| When using interval-based retention, ``--from`` may be specified to set the | ||||||||||||||||||||||||||
| reference timestamp for the interval (defaults to the current time). | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Please note that Borg treats months (e.g. ``12m``) as fixed 31-day periods | ||||||||||||||||||||||||||
| rather than calendar months. As a result, ``12m`` corresponds to | ||||||||||||||||||||||||||
| 12 × 31 = 372 days. Similarly, years (e.g. ``2y``) are treated as fixed | ||||||||||||||||||||||||||
| 365-day periods and do not take leap years into account. | ||||||||||||||||||||||||||
| Months and years are calendar-aware. For example, ``12m`` before | ||||||||||||||||||||||||||
| 2026-07-22 is 2025-07-22, and ``3y`` before 2026-07-22 is 2023-07-22. | ||||||||||||||||||||||||||
| The time of day is preserved. If the target month has fewer days, the date | ||||||||||||||||||||||||||
| is clamped to its last day: one month before March 31 is February 28 | ||||||||||||||||||||||||||
| (or February 29 in a leap year). | ||||||||||||||||||||||||||
|
Comment on lines
+29
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Use the |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Weeks, days, hours, minutes, and seconds keep their fixed-length meanings. | ||||||||||||||||||||||||||
| For example, ``1w`` is seven days. Plain counts and ``all`` are unchanged. | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Plain counts and |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| When combining interval-based pruning rules, their lengths are compared at | ||||||||||||||||||||||||||
| the same reference timestamp. Thus, ``1m`` can be shorter than, equal to, | ||||||||||||||||||||||||||
| or longer than ``30d`` depending on the month. | ||||||||||||||||||||||||||
|
Comment on lines
+32
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
As Dan noted earlier, the first paragraph reads more like a changelog entry. I think we can merge these two paragraphs and mention years here as well. Furthermore, timespans aren't only used by |
||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YYYY-MM-DDdate format for consistency.However, more importantly, the original point of this paragraph has been lost. It was meant to illustrate that
--keep-yearly 2doesn't count 2025-12-31, because that archive was already kept by the previous--keep-monthlyrule. With calendar-aware retention intervals,--keep-monthly 5mno longer matches 2025-12-31.We could change the example to
--keep-monthly 6minstead. That way, 2025-12-31 is matched by--keep-monthlyagain, leaving no "true" candidates for--keep-yearly.Alternatively, this paragraph might simply be removed and/or merged with the
--keep-weeklyparagraphs. It's somewhat redundant, because we mix count-based and interval-based rules there already anyway. Just a short sentence about--keep-yearlykeeping 2025-11-15 as the oldest archive to preserve rolling backup semantics should remain.