Check frequency can cause an invalid set of options #565

Closed
opened 2022-07-23 13:17:39 +00:00 by g-a-c · 3 comments
Contributor

What I'm trying to do and why

Configure checks to be more appropriate (run the lengthy ones less often than the quick ones)

Steps to reproduce (if a bug)

consistency:
    checks:
        - name: repository
          frequency: always
        - name: archives
          frequency: 1 week
        - name: data
          frequency: 1 week
        - name: extract
          frequency: 2 weeks

Actual behavior (if a bug)

For me archives was run recently, thus it is filtered out (filter_checks_on_frequency) from the set of repository/archives/extract/data, leaving repository/extract/data.

make_check_flags receives this list, and because repository is present and archives is not, it transforms the CLI flags passed to borg to contain --repository-only making the full command:

borg check --repository-only --verify-data --debug --show-rc

--repository-only and --verify-data are mutually exclusive, so this command fails.

Expected behavior (if a bug)

Either

  • If the data check is requested and due but the archives check is not requested or due, then silently add the archives check as required for data to succeed
  • If the data check is requested and due but the archives check is not requested or due, then silently remove the data check so that the overall command can succeed but with a reduced set of checks until the next time the two checks are naturally scheduled together

Other notes / implementation ideas

Environment

borgmatic version: 1.6.6

borgmatic installation method: pipenv

Borg version: 1.2.1

Python version: 3.9.2

Database version (if applicable): n/a

operating system and version: Debian 11

#### What I'm trying to do and why Configure checks to be more appropriate (run the lengthy ones less often than the quick ones) #### Steps to reproduce (if a bug) ```yaml consistency: checks: - name: repository frequency: always - name: archives frequency: 1 week - name: data frequency: 1 week - name: extract frequency: 2 weeks ``` #### Actual behavior (if a bug) For me `archives` was run recently, thus it is filtered out ([`filter_checks_on_frequency`](https://projects.torsion.org/borgmatic-collective/borgmatic/src/branch/master/borgmatic/borg/check.py#L96)) from the set of `repository/archives/extract/data`, leaving `repository/extract/data`. [`make_check_flags`](https://projects.torsion.org/borgmatic-collective/borgmatic/src/branch/master/borgmatic/borg/check.py#L154) receives this list, and because `repository` is present and `archives` is not, it transforms the CLI flags passed to `borg` to contain `--repository-only` making the full command: `borg check --repository-only --verify-data --debug --show-rc` `--repository-only` and `--verify-data` are mutually exclusive, so this command fails. #### Expected behavior (if a bug) Either - If the `data` check is requested and due but the `archives` check is not requested or due, then silently add the `archives` check as required for `data` to succeed - If the `data` check is requested and due but the `archives` check is not requested or due, then silently remove the `data` check so that the overall command can succeed but with a reduced set of checks until the next time the two checks are naturally scheduled together #### Other notes / implementation ideas #### Environment **borgmatic version:** `1.6.6` **borgmatic installation method:** pipenv **Borg version:** `1.2.1` **Python version:** `3.9.2` **Database version (if applicable):** n/a **operating system and version:** Debian 11
Owner

Wow, good catch! And thank you so much for diving into the source to see what's getting passed around. I think this probably makes sense to do, if documented well:

If the data check is requested and due but the archives check is not requested or due, then silently add the archives check as required for data to succeed

My thinking is that the pre-existing behavior was that if you requested a data check, that implicitly ran archives as well.

Wow, good catch! And thank you so much for diving into the source to see what's getting passed around. I think this probably makes sense to do, if documented well: > If the data check is requested and due but the archives check is not requested or due, then silently add the archives check as required for data to succeed My thinking is that the pre-existing behavior was that if you requested a `data` check, that implicitly ran `archives` as well.
witten added the
bug
label 2022-07-23 16:20:40 +00:00
Owner

Okay, this should be fixed now with the first approach you suggested. It'll be part of the next release. Thanks again!

Okay, this should be fixed now with the first approach you suggested. It'll be part of the next release. Thanks again!
Owner

Just released in borgmatic 1.7.0!

Just released in borgmatic 1.7.0!
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#565
No description provided.