Repository navigation
fix: put the Borg subcommand at cmd[1] for compact, mount and change-passphrase - #2631
Merged
Merged
Conversation
…passphrase BorgJob logs cmd[1] as the subcommand. Compact, change-passphrase and mount put global options first, so they were logged as '--info' or '--log-json'. The scheduler found recent compactions by matching '--info', which a passphrase change also matched, so changing the passphrase postponed scheduled compaction. Move the options after the subcommand and match 'compact' in the scheduler. Keep matching the legacy '--info' rows so the first post-backup run after upgrading does not trigger an extra compact; the legacy value can be removed once those rows have been pruned. Fixes #2607
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
BorgJobtreatscmd[1]as the Borg subcommand: it is stored asEventLogModel.subcommand, used in the sleep-inhibitor reason and passed to the scheduler's post-backup handling. Three jobs put global options first, so they logged an option instead:borg --info --log-json compact --progress …borg compact --info --log-json --progress …borg --info --log-json key change-passphrase …borg key change-passphrase --info --log-json …borg --log-json mount …borg mount --log-json …The scheduler looked for a recent compaction with
subcommand == '--info'. A passphrase change logged the same value, so changing the passphrase postponed scheduled compaction bycompaction_weeks.Changes:
scheduler/execution.pymatchescompact, and still matches--infoso that compactions logged before this change count. Without that, the first post-backup run after upgrading would compact again. The legacy value can go once those rows have been pruned (event log rows are kept for about six months).Side effects:
compact,keyandmount. Existing rows are not migrated: old compaction and passphrase-change rows cannot be told apart.cmd[1], so for these jobs they move from before the subcommand to after it. For change passphrase they sit betweenkeyandchange-passphrase.Related Issue
Fixes #2607
Motivation and Context
See above. The unused
cmdlog-context key and a per-job subcommand attribute, both mentioned in the issue, are left alone.How Has This Been Tested?
On macOS with Borg 1.4.3 (nox default).
tests/unit/test_borg_argv.py: the full-argv expectations for compact, change passphrase and mount are updated for Borg 1 and Borg 2, plus one new-order case for the Borg 1 mount-point parser.tests/unit/test_scheduler.py: compaction cases forcompact(recent, failed, too old), a legacy--inforow, and akeyrow that must not count.tests/unit/test_archives.py::test_repo_compactnow asserts the event log row written by the job hassubcommand == 'compact'. It also sets the Borg version withmonkeypatchinstead of assigning the global and resetting it to1.1.0.test_keyring_darwin.py::test_keyring_non_ascii_repo, which writes to the real login keychain).--lock-wait 5inserted where the extra arguments go. Mount got past argument parsing and stopped at "no FUSE support".Not tested:
compact,mountandkey change-passphraseparsers, and onkey) and on every other Vorta job already passing these options after the subcommand.Known limitation, Borg 2 only: extra Borg arguments now come after
mount, so the Borg 2 mount-point parser (extract_mount_points_v2) sees them. The common value options are already in its skip list. A value option that is not, such as--socket, would be mistaken for the mount point.Types of changes
Checklist:
I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.