Change heuristic for "--successful" to really recognize checkpoint archives. #433

Closed
opened 2021-07-20 05:46:43 +00:00 by ams_tschoening · 2 comments

What I'm trying to do and why

I would like to get a summary by mail about the last successful backup and in theory BorgMatic supports that use case with the following command already:

borgmatic list --successful --last 1 --json

The problem is that my archive name is the following:

archive_name_format: 'org.example.host-{utcnow:%Y%m%dT%H%M%S.%fZ}'

Recognize the Z at the end of the name to better describe the timestamp. I don't think that format is that uncommon, though it's not documented to be recognized. Instead of trying to detect something like a timestamp or alike at the end of archives, I suggest to simply stick to what Borg documents for checkpoints already:

During a backup a special checkpoint archive named .checkpoint is saved every checkpoint interval (the default value for this is 30 minutes) containing all the data backed-up until that point.

Searching for something like .checkpoint seems safer to me: It's the documented phrase Borg uses for checkpoints and is less likely to be used in archive names than timestamps like in my UTC-format.

Thanks for considering!

Environment

borgmatic version: 1.5.15
borgmatic installation method: PIP, system wide
Borg version: 1.1.16
Python version: 3.8.10
operating system and version: Ubuntu 20.04

#### What I'm trying to do and why I would like to get a summary by mail about the last successful backup and in theory BorgMatic supports that use case with the [following command already](https://torsion.org/borgmatic/docs/how-to/monitor-your-backups/#successful-backups): borgmatic list --successful --last 1 --json The problem is that my archive name is the following: archive_name_format: 'org.example.host-{utcnow:%Y%m%dT%H%M%S.%fZ}' Recognize the `Z` at the end of the name to better describe the timestamp. I don't think that format is that uncommon, though it's not documented to be recognized. Instead of trying to detect something like a timestamp or alike at the end of archives, I suggest to simply stick to what [Borg documents for checkpoints](https://borgbackup.readthedocs.io/en/stable/faq.html#checkpoints-parts) already: > During a backup a special checkpoint archive named <archive-name>.checkpoint is saved every checkpoint interval (the default value for this is 30 minutes) containing all the data backed-up until that point. Searching for something like `.checkpoint` seems safer to me: It's the documented phrase Borg uses for checkpoints and is less likely to be used in archive names than timestamps like in my UTC-format. **Thanks for considering!** #### Environment **borgmatic version:** 1.5.15 **borgmatic installation method:** PIP, system wide **Borg version:** 1.1.16 **Python version:** 3.8.10 **operating system and version:** Ubuntu 20.04
Author

By coincidence I got a checkpoint archive in the logs:

Starting archive consistency check...
TAM-verified manifest
Analyzing archive arch-20210722T163533.367211Z.checkpoint (1/2)
Analyzing archive arch-20210723T060528.747171Z (2/2)

Though, checking for the suffix .checkpoint only is not sufficient, it might contain some index as well:

The archive name needs to be unique. It must not end in ‘.checkpoint’ or ‘.checkpoint.N’ (with N being a number), because these names are used for checkpoints and treated in special ways.

https://borgbackup.readthedocs.io/en/stable/usage/create.html#description

By coincidence I got a checkpoint archive in the logs: ```bash Starting archive consistency check... TAM-verified manifest Analyzing archive arch-20210722T163533.367211Z.checkpoint (1/2) Analyzing archive arch-20210723T060528.747171Z (2/2) ``` Though, checking for the suffix `.checkpoint` only is not sufficient, it might contain some index as well: > The archive name needs to be unique. It must not end in ‘.checkpoint’ or ‘.checkpoint.N’ (with N being a number), because these names are used for checkpoints and treated in special ways. https://borgbackup.readthedocs.io/en/stable/usage/create.html#description
Owner

I apologize for the lengthy delay in responding to this. The good news: --successful is deprecated and newer versions of Borg only show non-checkpoint archives by default!

I apologize for the lengthy delay in responding to this. The good news: `--successful` is deprecated and newer versions of Borg only show non-checkpoint archives by default!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#433
No description provided.