Skip to content
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

backup series, fixes #7930 #8379

Merged
merged 9 commits into from
Sep 18, 2024

Conversation

ThomasWaldmann
Copy link
Member

@ThomasWaldmann ThomasWaldmann commented Sep 13, 2024

the archives list entries have (since ever):

  • name
  • timestamp
  • archive_id (hex hash)

borg1:

  • name is unique archive identifier on the cli (often achieved by putting a datetime at the end of the name)
  • timestamp is shown in archive list (and is often redundant there due to the name)
  • archive_id is also displayed in archive list, just for fun

borg2 (this PR):

  • name does not need to be unique. to the contrary, users may always use the same name to identify archives belonging to the same "series" (archives resulting from backing up the same stuff at different points in time). there is no strict requirement to do it like that though, having unique archive names as in borg1 works also (they just don't belong to same series then).
  • timestamp is now not redundant any more, because the name/series-identifier does not contain a datetime usually.
  • archive_id is now crucial to select a specific archive, using aid:unique_archive_id_prefix because the name does not necessarily work for that anymore when using the always-same-series-name method.

aid: can be used as a pattern for the -a / --match-archives cli option to match on the archive id (prefix) instead of the archive name.

NAME positional cli argument now also supports patterns (including aid:), but requires that there is exactly ONE result from the match against the list of archives. that way, it can be used e.g. for borg extract NAME.

Some stuff got simpler by this change:

  • no need to check names for uniqueness
  • if series are used, the typical name-prefix match for prune we had in borg1 now becomes a precise match on the name/series-identifier.

@ThomasWaldmann ThomasWaldmann changed the title NAME is the series, archive id is the hash, fixes #7930 backup series, fixes #7930 Sep 13, 2024
@codecov-commenter
Copy link

codecov-commenter commented Sep 13, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 78.46154% with 42 lines in your changes missing coverage. Please review.

Project coverage is 81.68%. Comparing base (ae4abdf) to head (1bc5902).
Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
src/borg/manifest.py 77.55% 12 Missing and 10 partials ⚠️
src/borg/archiver/transfer_cmd.py 64.70% 3 Missing and 3 partials ⚠️
src/borg/archive.py 85.29% 4 Missing and 1 partial ⚠️
src/borg/archiver/delete_cmd.py 64.28% 2 Missing and 3 partials ⚠️
src/borg/archiver/info_cmd.py 62.50% 1 Missing and 2 partials ⚠️
src/borg/archiver/recreate_cmd.py 91.66% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8379      +/-   ##
==========================================
- Coverage   81.73%   81.68%   -0.06%     
==========================================
  Files          70       70              
  Lines       12650    12699      +49     
  Branches     2288     2300      +12     
==========================================
+ Hits        10340    10373      +33     
- Misses       1665     1671       +6     
- Partials      645      655      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

aid:<archive-id-prefix> can be used for -a / --match-archives
to match on the archive id (prefix) instead of the name.

NAME positional argument now also supports matching (and aid:),
but requires that there is exactly ONE result.
so if one works with backup series, one can just do:

borg prune --keep-daily 30 seriesname

seriesname will then do a precise match on the archive names
and select that series.
- we should always output name and id when talking about an archive
- no problem anymore if names in archives directory are "duplicate"
- use "by-id" archives directory entry delete function
- rewrite/simplify test for borg check --undelete-archives
for the archives directory, we only need to know the archive IDs,
everything else can be fetched from the ArchiveItem in the repo.

so we store empty files into archives/* with the archiv ID as name.

this makes some "by-id" operations much easier and we don't have to
deal with a useless "store_key" anymore.

removed .delete method - we can't delete by name anymore as we
allow duplicate names for the series feature. everything uses
delete_by_id() now.

also: simplify, clean up, refactor
LegacyRepository of borg2 knows this method.
in borg 1.x, we used to put a timestamp into the archive name to make
it unique, because borg1 required that.

borg2 does not require unique archive names, but it encourages you
to even use an identical archive name within the same SERIES of archives.
that makes matching (e.g. for prune, but also at other places) much
simpler and borg KNOWS which archives belong to the same series.
@ThomasWaldmann ThomasWaldmann merged commit 29c7ce4 into borgbackup:master Sep 18, 2024
14 checks passed
@ThomasWaldmann ThomasWaldmann deleted the backup-series branch September 18, 2024 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants