]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
2 months agotrivial clippy fixes
Fabian Grünbichler [Mon, 24 Jun 2024 07:59:27 +0000 (09:59 +0200)]
trivial clippy fixes

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 months agobump proxmox-rrd to 0.2 and proxmox-time to 2.0
Wolfgang Bumiller [Thu, 20 Jun 2024 12:08:08 +0000 (14:08 +0200)]
bump proxmox-rrd to 0.2 and proxmox-time to 2.0

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump bitflags to 2.4
Wolfgang Bumiller [Thu, 20 Jun 2024 11:36:59 +0000 (13:36 +0200)]
bump bitflags to 2.4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agoupdate README.rst to refer to .cargo/config.toml
Wolfgang Bumiller [Thu, 20 Jun 2024 10:31:18 +0000 (12:31 +0200)]
update README.rst to refer to .cargo/config.toml

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agofs: update comment to reflect usage of C-string literals
Maximiliano Sandoval [Thu, 20 Jun 2024 09:00:08 +0000 (11:00 +0200)]
fs: update comment to reflect usage of C-string literals

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 months agorename .cargo/config to .cargo/config.toml
Wolfgang Bumiller [Thu, 20 Jun 2024 10:24:27 +0000 (12:24 +0200)]
rename .cargo/config to .cargo/config.toml

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agocargo: use default-features
Maximiliano Sandoval [Thu, 20 Jun 2024 09:00:05 +0000 (11:00 +0200)]
cargo: use default-features

Fixes the compile-time warning:

warning: Cargo.toml: `default_features` is deprecated in favor of `default-features` and will not work in the 2024 edition
(in the `proxmox-router` dependency)

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 months agouse XATTR_* constants instead of calling functions
Wolfgang Bumiller [Thu, 20 Jun 2024 09:07:33 +0000 (11:07 +0200)]
use XATTR_* constants instead of calling functions

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agobump sys dependency to 0.5.7
Wolfgang Bumiller [Thu, 20 Jun 2024 09:08:10 +0000 (11:08 +0200)]
bump sys dependency to 0.5.7

for the new xattr constants

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agoreplace c_str! macro with c"literals"
Wolfgang Bumiller [Thu, 20 Jun 2024 09:07:10 +0000 (11:07 +0200)]
replace c_str! macro with c"literals"

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agobuild: use cargo wrapper when building package
Fabian Grünbichler [Wed, 19 Jun 2024 14:38:05 +0000 (16:38 +0200)]
build: use cargo wrapper when building package

else we don't pick up the options set by the wrapper, which include generation
of debug symbols. until rustc 1.77, this was not needed because compiled
binaries always included a non-stripped libstd. now, without this change, the
binaries built with `cargo build --release` have no debug symbols at all
trigger a warning. fix this and include debug symbols when building a package,
like was originally intended for release package builds.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agobuild: fix SUBCRATES for arbitrary working dirs
Fabian Grünbichler [Wed, 19 Jun 2024 15:47:37 +0000 (17:47 +0200)]
build: fix SUBCRATES for arbitrary working dirs

else this only works if the git working tree is in a dir called
'proxmox-backup'

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agobuild: adapt workspace member command
Fabian Grünbichler [Wed, 19 Jun 2024 14:00:39 +0000 (16:00 +0200)]
build: adapt workspace member command

to work with cargo 1.77, which changed from

 pbs-api-types 0.1.0 (path+file:///home/fgruenbichler/Sources/proxmox-backup/pbs-api-types)

to

 path+file:///home/fgruenbichler/Sources/proxmox-backup/pbs-api-types#0.1.0

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agoclose #4763: client: add command to forget backup group
Gabriel Goller [Mon, 3 Jun 2024 08:43:11 +0000 (10:43 +0200)]
close #4763: client: add command to forget backup group

Add the command `proxmox-backup-client group forget <group>` so
that we can forget (delete) whole groups with all the containing
snapshots.
To avoid printing full datastore paths (which are in the error messages)
we filter out the most common one (group not found) and rephrase it.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
[WB: rebased & sorted import statements in client's main.rs]
[WB: replace extract_repository_from_value with
     remove_repository_from_value since the parameter is rejected on
     the remote side]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agoclient: add 'remove_repository_from_value' helper
Wolfgang Bumiller [Wed, 19 Jun 2024 09:30:09 +0000 (11:30 +0200)]
client: add 'remove_repository_from_value' helper

'extract_repository_from_value' takes an immutable reference and
doesn't remove the parsed parameter (whereas in contrast in our PVE
codebase, the 'extract_param' method does remove it).

This adds a variant that explicitly removes it called
'remove_repository_from_value'.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agopxar: use anyhow::Error in PxarBackupStream
Gabriel Goller [Tue, 18 Jun 2024 14:22:03 +0000 (16:22 +0200)]
pxar: use anyhow::Error in PxarBackupStream

Instead of storing the error as a string in the PxarBackupStream, we
store it as an anyhow::Error. As we can't clone an anyhow::Error, we take
it out from the mutex and return it. This won't change anything as
the consumation of the stream will stop if it gets a Some(Err(..)).

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
3 months agopxar: add UniqueContext helper
Gabriel Goller [Tue, 18 Jun 2024 14:22:02 +0000 (16:22 +0200)]
pxar: add UniqueContext helper

To create a pxar archive, we recursively traverse the target folder.
If there is an error further down and we add a context using anyhow,
the context will be duplicated and we get an output like:

> Error: error at "xattr/xattr.txt": error at "xattr/xattr.txt": E2BIG [skip]

This is obviously not optimal, so in recursive contexts we can use the
UniqueContext, which quickly checks the context from the last item in
the error chain and only adds it if it is unique.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
3 months agopxar: remove ArchiveError
Gabriel Goller [Tue, 18 Jun 2024 14:22:01 +0000 (16:22 +0200)]
pxar: remove ArchiveError

The sole purpose of the ArchiveError was to add the file-path to the
error. Using anyhow::Error we can add this information using the context
and don't need this struct anymore.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
3 months agoui: gc job edit: fix i18n gettext usage
Thomas Lamprecht [Tue, 18 Jun 2024 14:12:14 +0000 (16:12 +0200)]
ui: gc job edit: fix i18n gettext usage

String concatenating a variable with some static text as gettext
parameter cannot really work, and it also does not make sense to do
most of the time, as even if we'd use some overly generic format
string like '{0} (disabled)', it would be not easy to translate
correctly in all languages in such a generic way.

So just use the actual full string, which is already contained in our
translation catalogue anyway…

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agodocs: drop blanket statement recommending against remote storage
Thomas Lamprecht [Mon, 17 Jun 2024 15:06:55 +0000 (17:06 +0200)]
docs: drop blanket statement recommending against remote storage

This is basically semantic revert of e5c0d80c ("docs: add note for not
using remote storages") that, while well intended, has a few problems,
e.g.:
- This is the minimal/recommended requirements section, which should
  list the rough basic specs a setup must/should have. Listing
  everything that is not best to do would bloat this list
  significantly and it's just the wrong place for it, i.e., it isn't a
  recommended against list.
- while it's true that a remote storage will basically always have
  _some_ overhead over using the same HW with a (modern) local storage
  (file) system, that does **not** mean that the remote storage has
  insufficient performance characteristics. We know of lots of fast
  Ceph setups, even release benchmarks for them, or storages like
  BlockBridge, that provide high performance while being remote.

So avoid this X-Y-problem style argumentation and focus on what is
actually important, even though I naturally get that there are some
users that use slow NFS attached storages, but breaking style here
won't cure them and I'm sure that they are capable of setting up such
a slow local storage that it won't make a real difference compared to
the NFS one.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agobump proxmox-sys dep to 0.5.6
Wolfgang Bumiller [Mon, 17 Jun 2024 12:06:25 +0000 (14:06 +0200)]
bump proxmox-sys dep to 0.5.6

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agoMerge branch '3.2.6'
Fabian Grünbichler [Mon, 17 Jun 2024 08:38:02 +0000 (10:38 +0200)]
Merge branch '3.2.6'

branched off to avoid a breaking change on master

3 months agobump version to 3.2.6-1
Fabian Grünbichler [Mon, 17 Jun 2024 08:18:53 +0000 (10:18 +0200)]
bump version to 3.2.6-1

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agoclient: pxar: fix fuse mount performance for split archives
Christian Ebner [Wed, 12 Jun 2024 13:17:13 +0000 (15:17 +0200)]
client: pxar: fix fuse mount performance for split archives

Adapt to the decoder/accessor method changes introduced in the pxar
library, which were introduced in order to move the consistency check
for metadata and payload data archives.

The new location of the checks allows to access the pxar archive via
a `Split` variant reader instance, without penalization when just
accessing the metadata, not reading any payload data.

This greatly improves performance when accessing fuse mounted
archives.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
bumped dependency after pxar version bump

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agoconfig: acme: use latest proxmox_sys::fs::ensure_dir_exists
Dietmar Maurer [Thu, 13 Jun 2024 09:58:09 +0000 (11:58 +0200)]
config: acme: use latest proxmox_sys::fs::ensure_dir_exists

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agodocs: add note for not using remote storages
Dominik Csapak [Tue, 11 Jun 2024 09:30:46 +0000 (11:30 +0200)]
docs: add note for not using remote storages

such as NFS or SMB. They will not provide the expected performance
and it's better to recommend against them.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agotape: handle PEWZ like regular early warning
Dominik Csapak [Mon, 10 Jun 2024 11:45:05 +0000 (13:45 +0200)]
tape: handle PEWZ like regular early warning

as a safeguard, should the disabling not work for some reason.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agotape: disable Programmable Early Warning Zone (PEWZ)
Dominik Csapak [Mon, 10 Jun 2024 11:45:04 +0000 (13:45 +0200)]
tape: disable Programmable Early Warning Zone (PEWZ)

since that leads to errors that we don't currently catch before we
reach the regular early warning on tape.

This can be read/set by the Device Configuration Extension Mode Page.
ignore errors on reading or writing, since it may not be available on
LTO-4

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agotape: refactor setting the mode page
Dominik Csapak [Mon, 10 Jun 2024 11:45:03 +0000 (13:45 +0200)]
tape: refactor setting the mode page

we'll reuse that code later for a different page/subpage

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agobump version to 3.2.5-1
Fabian Grünbichler [Mon, 10 Jun 2024 11:45:17 +0000 (13:45 +0200)]
bump version to 3.2.5-1

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agobump pxar to 0.11.1
Fabian Grünbichler [Mon, 10 Jun 2024 11:39:33 +0000 (13:39 +0200)]
bump pxar to 0.11.1

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agoextract: don't interpret prelude as OsStr
Fabian Grünbichler [Mon, 10 Jun 2024 11:38:10 +0000 (13:38 +0200)]
extract: don't interpret prelude as OsStr

that would drop the final byte, and the corresponding code has been removed
from pxar now as well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agoclient: pxar: encode prelude based on writer variant
Christian Ebner [Mon, 10 Jun 2024 11:06:21 +0000 (13:06 +0200)]
client: pxar: encode prelude based on writer variant

Currently, whether to encode the exlcude patterns passed via cli as
prelude or via the `.pxar-exclude-cli` is based on the presence of
a previous metadata accessor.
That leaves however to the encoding of the file entry instead of the
prelude for split archives in `data` mode and for the first snapshot
in a backup, creating undesired padding in the first payload chunk.

Therefore, use the pxar writer variant to make the decision instead.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: json encode cli exclude pattern in prelude
Christian Ebner [Mon, 10 Jun 2024 11:06:20 +0000 (13:06 +0200)]
client: pxar: json encode cli exclude pattern in prelude

The current encoding is not extensible, so encode the cli exclude
patterns as json instead. By this, the prelude is easily seralized
and deserialized, while remaining human readable.

Originally-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agofile-restore: list: improve pxar v2 performance
Christian Ebner [Mon, 10 Jun 2024 08:39:33 +0000 (10:39 +0200)]
file-restore: list: improve pxar v2 performance

Do not attach the payload reader for split pxar archives, as only the
metadata has to be accessed for listing.
This avoids that the decoder performs consistency checks with the
payload stream, which require chunk download and decoding, making the
listing unusable slow.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agodocs: add table listing possible change detection modes
Christian Ebner [Fri, 7 Jun 2024 13:12:51 +0000 (15:12 +0200)]
docs: add table listing possible change detection modes

Quick and concise listing of the available change detection modes for
reference.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: backup spec: rename change detection mode default
Christian Ebner [Fri, 7 Jun 2024 13:12:50 +0000 (15:12 +0200)]
client: backup spec: rename change detection mode default

The currently default variant is named `Default`, which is not future
prove since the default might change in the future. So rename it to
`Legacy` instead.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoapi: catalog: improve pxar v2 performance
Fabian Grünbichler [Mon, 10 Jun 2024 08:06:37 +0000 (10:06 +0200)]
api: catalog: improve pxar v2 performance

by skipping the payloader reader entirely, it's not needed for listing contents
and would make accessing larger archives too expensive.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Christian Ebner <c.ebner@proxmox.com>
3 months agorun cargo fmt
Fabian Grünbichler [Fri, 7 Jun 2024 12:00:33 +0000 (14:00 +0200)]
run cargo fmt

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agoapi: catalog/file-restore: use archive-name schema
Fabian Grünbichler [Fri, 7 Jun 2024 12:00:15 +0000 (14:00 +0200)]
api: catalog/file-restore: use archive-name schema

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agoclient: backup: conditionally write catalog for file level backups
Christian Ebner [Fri, 7 Jun 2024 11:37:52 +0000 (13:37 +0200)]
client: backup: conditionally write catalog for file level backups

Only write the catalog when using the regular backup mode, do not write
it when using the split archive mode.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agowww: content: lookup via metadata archive instead of catalog
Christian Ebner [Fri, 7 Jun 2024 11:37:51 +0000 (13:37 +0200)]
www: content: lookup via metadata archive instead of catalog

In case of pxar archives with split metadata and payload data, the
metadata archive has to be used to lookup entries for navigation
before performing a single file restore.

Decide based on the archive filename extension whether to use the
`catalog` or the `pxar-lookup` api endpoint.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agofile-restore: fallback to mpxar if catalog not present
Christian Ebner [Fri, 7 Jun 2024 11:37:50 +0000 (13:37 +0200)]
file-restore: fallback to mpxar if catalog not present

The `proxmox-file-restore list` command will uses the provided path to
lookup and list directory entries via the catalog. Fallback to using
the metadata archive if the catalog is not present for fast lookups in
a backup snapshot.

This is in preparation for dropping encoding of the catalog for
snapshots using split archive encoding. Proxmox VE's storage plugin
uses this to allow single file restore for LXCs.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agofile-restore: never list ppxar as archive
Christian Ebner [Fri, 7 Jun 2024 11:37:49 +0000 (13:37 +0200)]
file-restore: never list ppxar as archive

Payload data archives cannot be used to navigate the content, so
exclude them from the archive listing, as this is used by
Proxmox VE to list in the file browser.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoapi: datastore: add optional archive-name to file-restore
Christian Ebner [Fri, 7 Jun 2024 11:37:48 +0000 (13:37 +0200)]
api: datastore: add optional archive-name to file-restore

Allow to pass the archive name as optional api call parameter instead
of having it as prefix to the path.
If this parameter is given, instead of splitting of the archive name
from the path, the parameter itself is used, leaving the path
untouched.

This allows to restore single files from the archive, without having
to artificially construct the path in case of file restores for split
pxar archives, where the response path of the listing does not
include the archive, as opposed to the response provided by lookup
via the catalog.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoapi: datastore: conditional lookup for catalog endpoint
Christian Ebner [Fri, 7 Jun 2024 11:37:47 +0000 (13:37 +0200)]
api: datastore: conditional lookup for catalog endpoint

Add an optional `archive-name` parameter, indicating the metadata
archive to be used for directory content lookups instead of the
catalog. If provided, instead of the catalog reader, a pxar Accessor
instance is created to perform the lookup.

This is in preparation for dropping catalog encoding for snapshots
with split pxar archive encoding.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: tools: add helper to lookup `ArchiveEntry`s via pxar
Christian Ebner [Fri, 7 Jun 2024 11:37:46 +0000 (13:37 +0200)]
client: tools: add helper to lookup `ArchiveEntry`s via pxar

In preparation to lookup entries via the pxar metadata archive
instead of the catalog, in order to drop encoding the catalog
for snapshots using split pxar archives altogehter.

This helper allows to lookup the directory entries via the provided
accessor instance and formats them to be compatible with the output
as produced by lookups via the catalog.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoapi: datastore: move reusable code out of thread
Christian Ebner [Fri, 7 Jun 2024 11:37:45 +0000 (13:37 +0200)]
api: datastore: move reusable code out of thread

Move code that can be reused when having to  perform a lookup via the
pxar metadata archive instead of the catalog out of the thread.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoapi: datastore: factor out path decoding for catalog
Christian Ebner [Fri, 7 Jun 2024 11:37:44 +0000 (13:37 +0200)]
api: datastore: factor out path decoding for catalog

The file path passed to the catalog is base64 encoded, with an exception
for the root.
Factor this check and decoding step out into a helper function to make
it reusable when doing the same for lookups via the metadata archive
instead of the catalog.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: helper: fix minor formatting issue
Christian Ebner [Thu, 6 Jun 2024 17:28:13 +0000 (19:28 +0200)]
client: helper: fix minor formatting issue

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: fix minor formatting issue
Christian Ebner [Thu, 6 Jun 2024 17:28:12 +0000 (19:28 +0200)]
client: pxar: fix minor formatting issue

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: conditionally skip metadata reference test
Christian Ebner [Thu, 6 Jun 2024 08:17:11 +0000 (10:17 +0200)]
client: pxar: conditionally skip metadata reference test

The test will fail for all users not having euid/egid set to
1000/1000, as the reference test folder structure cannot be created
with the expected ownership.
Therefore, skip over the test if either euid or egid do not match
this condition.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: do not attempt to set uid/gid in test
Christian Ebner [Thu, 6 Jun 2024 08:17:10 +0000 (10:17 +0200)]
client: pxar: do not attempt to set uid/gid in test

Setting the uid/gid for the files and folders of the test directory
structure will not work when lacking the permissions.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agobump pxar build-dep to 0.11
Fabian Grünbichler [Wed, 5 Jun 2024 14:04:12 +0000 (16:04 +0200)]
bump pxar build-dep to 0.11

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agodocs: add section describing change detection mode
Christian Ebner [Tue, 26 Mar 2024 09:57:13 +0000 (10:57 +0100)]
docs: add section describing change detection mode

Describe the motivation and basic principle of the clients change
detection mode and show an example invocation.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agodocs: file formats: describe split pxar archive file layout
Christian Ebner [Thu, 14 Mar 2024 10:25:38 +0000 (11:25 +0100)]
docs: file formats: describe split pxar archive file layout

Describes the pxar metadata archive and the corresponding pxar payload
file-format layout.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: set cache limit based on nofile rlimit
Christian Ebner [Tue, 7 May 2024 13:16:03 +0000 (15:16 +0200)]
client: pxar: set cache limit based on nofile rlimit

The lookahead cache size requires the resource limit for open file
handles to be high in order to allow for efficient reuse of unchanged
file payloads.

Increase the nofile soft limit to the hard limit and dynamically adapt
the cache size to the new soft limit minus the half of the previous
soft limit.

The `PxarCreateOptions` and the `Archiver` are therefore extended by
an additional field to store the maximum cache size, with fallback to
a default size of 512 entries.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: tools: add helper to raise nofile rlimit
Christian Ebner [Tue, 7 May 2024 13:04:03 +0000 (15:04 +0200)]
client: tools: add helper to raise nofile rlimit

The default soft limit for open file handles is rather low, as some
apis (e.g. the POSIX `select(2)` syscall) do not work [0].

The lookahead cache use during the backup clients metadata comparison
to reuse unchanged files however requires much higher limits to work
effectively.

This helper function allows to raise the soft limit to the hard
limit, as provided by the `getrlimit(2)` syscall.

[0] https://0pointer.net/blog/file-descriptor-limits.html

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: add archive creation with reference test
Christian Ebner [Mon, 6 May 2024 09:35:01 +0000 (11:35 +0200)]
client: pxar: add archive creation with reference test

Add a basic regression test for archive creation with reference
metadata archive and index.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: chunk stream: switch payload stream chunker
Christian Ebner [Fri, 19 Apr 2024 15:14:12 +0000 (17:14 +0200)]
client: chunk stream: switch payload stream chunker

Use the dedicated chunker with boundary suggestions for the payload
stream, by attaching the channel sender to the archiver and the
channel receiver to the payload stream chunker.

The archiver sends the file boundaries for the chunker to consume.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agochunk stream: tests: add regression tests for payload chunker
Christian Ebner [Tue, 14 May 2024 09:57:47 +0000 (11:57 +0200)]
chunk stream: tests: add regression tests for payload chunker

Regression tests to cover suggested and forced boundaries as well as
chunk injection.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agochunker: tests: add regression tests for payload chunker
Christian Ebner [Mon, 13 May 2024 12:39:54 +0000 (14:39 +0200)]
chunker: tests: add regression tests for payload chunker

Test chunking of a payload stream with suggested chunk boundaries.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agodatastore: chunker: implement chunker for payload stream
Christian Ebner [Fri, 19 Apr 2024 13:47:11 +0000 (15:47 +0200)]
datastore: chunker: implement chunker for payload stream

Implement the Chunker trait for a dedicated payload stream chunker,
which extends the regular chunker by the option to suggest boundaries
to be used over the hast based boundaries whenever possible.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agodatastore: chunker: add Chunker trait
Christian Ebner [Fri, 19 Apr 2024 13:34:54 +0000 (15:34 +0200)]
datastore: chunker: add Chunker trait

Add the Chunker trait and move the current Chunker to ChunkerImpl to
implement the trait instead. This allows to use different chunker
implementations by dynamic dispatch and is in preparation for
implementing a dedicated payload chunker.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: add optional payload input to mount archive
Christian Ebner [Mon, 3 Jun 2024 14:46:07 +0000 (16:46 +0200)]
pxar: add optional payload input to mount archive

Allow to pass an optional input path to mount a split pxar archive
with dedicated payload data file.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: bin: support creation of split pxar archives via cli
Christian Ebner [Mon, 3 Jun 2024 14:37:16 +0000 (16:37 +0200)]
pxar: bin: support creation of split pxar archives via cli

Add support to create split pxar archives by redirecting the payload
output to a dedicated file.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: bin: test `pxar list` with payload-input
Christian Ebner [Mon, 3 Jun 2024 10:45:03 +0000 (12:45 +0200)]
pxar: bin: test `pxar list` with payload-input

Add a unit test to check for correct listing of pxar archives with
split payload input.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: bin: ignore version and prelude entries in listing
Christian Ebner [Mon, 27 May 2024 12:07:36 +0000 (14:07 +0200)]
pxar: bin: ignore version and prelude entries in listing

Do not list the pxar format version and the prelude entries in the
output of pxar list, these are not regular entries. Do include them
however when dumping with the debug environmet variable set.
Since the prelude is arbitrary in size, only show the content size.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: bin: show padding in debug output on archive list
Christian Ebner [Mon, 25 Mar 2024 13:15:11 +0000 (14:15 +0100)]
pxar: bin: show padding in debug output on archive list

In addition to the entries, also show the padding encountered in-between
referenced payloads.

Example invocation: `PXAR_LOG=debug pxar list archive.mpxar`

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: allow to restore prelude to optional path
Christian Ebner [Thu, 2 May 2024 09:26:57 +0000 (11:26 +0200)]
client: pxar: allow to restore prelude to optional path

Pxar archives allow to store additional information in a prelude
entry since pxar format version 2.

Add an optional parameter to `pxar` and `proxmox-backup-client` to
specify the path to restore the prelude to and pass this to the
archive extraction by extending the `PxarExtractOptions` by a
corresponding field. If none is given, the prelude is simply skipped
during restore.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: opt encode cli exclude patterns as Prelude
Christian Ebner [Fri, 22 Mar 2024 14:27:59 +0000 (15:27 +0100)]
client: pxar: opt encode cli exclude patterns as Prelude

Instead of encoding the pxar cli exclude patterns as regular file
within the root directory of an archive, store this information
directly after the pxar format version entry in the entry of kind
Prelude.

This behavior is however currently exclusive to the archives written
with format version 2 in a split metadata and payload case.

This is a breaking change for the encoding of new cli exclude
parameters. Any new exclude parameter will not be added to an already
present .pxar-cliexclude file, and it will not be created if not
present.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: add helper to handle optional preludes
Christian Ebner [Thu, 4 Apr 2024 10:49:42 +0000 (12:49 +0200)]
client: pxar: add helper to handle optional preludes

Pxar archives with format version 2 allows to store optional
information file format version and prelude entries.

Cover the case for these entries, the file format version entry being
introduced to distinguish between different file formats used for
encoding as well as the prelude entry used to store optional metadata
such as the pxar cli exlude parameters.

Add the logic to accept and decode these prelude entries when
accessing the archive via a decoder instance.

For now simply ignore them.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: backup writer: make backup info output more concise
Christian Ebner [Mon, 3 Jun 2024 08:24:48 +0000 (10:24 +0200)]
client: backup writer: make backup info output more concise

With the additional output in case of split pxar archives, the upload
statistics logged by the backup writer following a backup are crowded
and hard to read.

Make the output more concise by merging the currenlty 2 lines per
upload stream, shown as e.g.:

```
data.ppxar: had to backup 4 MiB of 10.943 GiB (compressed 159 B) in 49.30s
data.ppxar: average backup speed: 83.09 KiB/s
```

into a single line, shown as e.g.:

```
data.ppxar: had to back up 4 MiB of 10.943 GiB (159 B compressed) in 49.30 s (average 83.09 KiB/s)
```

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: create: show chunk injection stats info output
Christian Ebner [Thu, 21 Mar 2024 14:18:00 +0000 (15:18 +0100)]
pxar: create: show chunk injection stats info output

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: create: keep track of reused chunks and files
Christian Ebner [Tue, 23 Apr 2024 13:50:07 +0000 (15:50 +0200)]
pxar: create: keep track of reused chunks and files

Track and log reused or reencoded files as well as the reused chunks
and their paddings.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: backup writer: add injected chunk count to stats
Christian Ebner [Thu, 21 Mar 2024 09:08:23 +0000 (10:08 +0100)]
client: backup writer: add injected chunk count to stats

Track the number of injected chunks and show them in the debug output

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agofix #3174: client: pxar: enable caching and meta comparison
Christian Ebner [Fri, 24 May 2024 16:31:39 +0000 (18:31 +0200)]
fix #3174: client: pxar: enable caching and meta comparison

When walking the file system tree, check for each entry if it is
reusable, meaning that the metadata did not change and the payload
chunks can be reindexed instead of reencoding the whole data.

If the metadata matched, the range of the dynamic index entries for
that file are looked up in the previous payload data index.
Use the range and possible padding introduced by partial reuse of
chunks to decide whether to reuse the dynamic entries and encode
the file payloads as payload reference right away or cache the entry
for now and keep looking ahead.

If however a non-reusable (because changed) entry is encountered
before the padding threshold is reached, the entries on the cache are
flushed to the archive by reencoding them, resetting the cached state.

Reusable chunk digests and size as well as reference offsets to the
start of regular files payloads within the payload stream are injected
into the backup stream by sending them to the chunker via a dedicated
channel, forcing a chunk boundary and inserting the chunks.

If the threshold value for reuse is reached, the chunks are injected
in the payload stream and the references with the corresponding
offsets encoded in the metadata stream.

Since multiple files might be contained within a single chunk, it is
assured that the deduplication of chunks is performed, by keeping back
the last chunk, so following files might as well reuse that same
chunk without double indexing it.  It is assured that this chunk is
injected in the stream also in case that the following lookups lead to
a cache clear and reencoding.

Directory boundaries are cached as well, and written as part of the
encoding when flushing.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: refactor catalog encoding for directories
Christian Ebner [Fri, 24 May 2024 17:11:10 +0000 (19:11 +0200)]
client: pxar: refactor catalog encoding for directories

Move the catalog directory start and end encoding from `add_entry`
to the `add_directory`, the latter being called by the previous.

By this, the `add_entry` method can be reused to walk the filesystem
tree in the context of an enabled lookahead cache without encoding
anything.

No functional change intended.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: caching: add look-ahead cache
Christian Ebner [Tue, 23 Apr 2024 13:16:26 +0000 (15:16 +0200)]
pxar: caching: add look-ahead cache

Add a lookahead cache and the neccessary types to store the required
data and keep track of directory boundaries while traversing the
filesystem tree, in order to postpone a decision if to reuse or
reencode a given regular file with unchanged metadata.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: add method for metadata comparison
Christian Ebner [Wed, 21 Feb 2024 13:50:40 +0000 (14:50 +0100)]
client: pxar: add method for metadata comparison

Add method to compare metadata of current file entry against metadata
of the entry looked up in the previous backup snapshot. If the
metadata matched, the start offset pointing to the files payload
header in the payload steam is returned.

This is in preparation for reusing payload chunks for unchanged files.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: implement prepare reference method
Christian Ebner [Wed, 21 Feb 2024 12:06:46 +0000 (13:06 +0100)]
client: implement prepare reference method

Implement a method that prepares the decoder instance to access a
previous snapshots metadata index and payload index in order to
pass it to the pxar archiver. The archiver than can utilize these
to compare the metadata for files to the previous state and gather
reusable chunks.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agospecs: add backup detection mode specification
Christian Ebner [Tue, 26 Sep 2023 09:28:55 +0000 (11:28 +0200)]
specs: add backup detection mode specification

Adds the specification for switching the detection mode used to
identify regular files which changed since a reference backup run.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: streams: add channels for dynamic entry injection
Christian Ebner [Wed, 21 Feb 2024 10:58:14 +0000 (11:58 +0100)]
client: streams: add channels for dynamic entry injection

To reuse dynamic entries of a previous backup run and index them for
the new snapshot. Adds a non-blocking channel between the pxar
archiver and the chunk stream, as well as the chunk stream and the
backup writer.

The archiver sends forced boundary positions and the dynamic
entries to inject into the chunk stream following this boundary.

The chunk stream consumes this channel inputs as receiver whenever a
new chunk is requested by the upload stream, forcing a non-regular
chunk boundary in the pxar stream at the requested positions.

The dynamic entries to inject and the boundary are then send via the
second asynchronous channel to the backup writer's upload stream,
indexing them by inserting the dynamic entries as known chunks into
the upload stream.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agochunker: add method to reset chunker state
Christian Ebner [Mon, 13 May 2024 12:37:23 +0000 (14:37 +0200)]
chunker: add method to reset chunker state

When forcing a boundary, the internal chunker state is not in sync
with the chunk stream anymore. The reset method therefore allows
to reset the internal state.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: chunk stream: add struct to hold injection state
Christian Ebner [Tue, 19 Mar 2024 09:23:08 +0000 (10:23 +0100)]
client: chunk stream: add struct to hold injection state

Adds a dedicated structure to hold the optional sender and receiver
instances and state for injection of reused dynamic entries in the
payload stream for split stream pxar archives.

The asynchronous channels must only be attached to the payload
archive, leaving the current behavior for the metadata archive and
current default encoding without reusing payload chunks of previous
snapshots.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoupload stream: implement reused chunk injector
Christian Ebner [Thu, 21 Sep 2023 12:46:56 +0000 (14:46 +0200)]
upload stream: implement reused chunk injector

In order to be included in the backups index file, reused payload
chunks have to be injected into the payload upload stream at a
forced boundary. The chunker forces a chunk boundary and sends the
list of reusable dynamic entries to be uploaded.

This implements the logic to receive these dynamic entries via the
corresponding communication channel from the chunker and inject the
entries into the backup upload stream by looking for the matching
chunk boundary, already forced by the chunker.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: helper for lookup of reusable dynamic entries
Christian Ebner [Thu, 14 Mar 2024 14:07:03 +0000 (15:07 +0100)]
client: pxar: helper for lookup of reusable dynamic entries

The helper method allows to lookup the entries of a dynamic index
which fully cover a given offset range. Further, the helper returns
the start padding from the start offset of the dynamic index entry
to the start offset of the given range and the end padding.

This will be used to lookup size and digest for chunks covering the
payload range of a regular file in order to re-use found chunks by
indexing them in the archives index file instead of re-encoding the
payload.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: include payload offset in entry listing
Christian Ebner [Fri, 15 Mar 2024 08:46:06 +0000 (09:46 +0100)]
client: pxar: include payload offset in entry listing

Also display the payload offset as listing output when the regular file
entry had a payload reference rather than the payload encoded in the
archive. This allows for debugging by inspecting the raw payload data
file at given offset.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: bin: add more context to extraction error
Christian Ebner [Mon, 25 Mar 2024 11:53:48 +0000 (12:53 +0100)]
pxar: bin: add more context to extraction error

Show more of the extraction error context provided by the pxar decoder.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: bin: cover listing for split archives
Christian Ebner [Mon, 27 May 2024 11:57:44 +0000 (13:57 +0200)]
pxar: bin: cover listing for split archives

Allows to list entries of split pxar archives. As the decoder skips
over the file payloads, the corresponding payload file has to be
provided. Otherwise the decoder would skip inside the metadata
archive, leading to incorrect decoding.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agopxar: bin: add optional payload input for archive restore
Christian Ebner [Mon, 25 Mar 2024 10:59:46 +0000 (11:59 +0100)]
pxar: bin: add optional payload input for archive restore

Allows to pass the optional payload input to restore for cases where the
regular file payloads are stored in the split archive.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agofile restore: show more error context when extraction fails
Christian Ebner [Wed, 24 Apr 2024 10:02:14 +0000 (12:02 +0200)]
file restore: show more error context when extraction fails

Otherwise the context swallows the actual, underlying error message.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agofile restore: cover split metadata and payload archives
Christian Ebner [Tue, 23 Apr 2024 17:25:55 +0000 (19:25 +0200)]
file restore: cover split metadata and payload archives

Attach the payload data archive as input stream to the decoder
and accessor instances for split archives.
Allows to restore contents from split archives via the
`proxmox-file-restore extract` command, by passing the metadata
archive name.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agofile restore: factor out getting pxar reader
Christian Ebner [Tue, 23 Apr 2024 17:19:16 +0000 (19:19 +0200)]
file restore: factor out getting pxar reader

Factor out the logic to get the pxar reader into a dedicated function
so it can be reused to get the payload data archive reader instance.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agofile restore: cover extension for split pxar archives
Christian Ebner [Mon, 19 Feb 2024 13:40:49 +0000 (14:40 +0100)]
file restore: cover extension for split pxar archives

Cover the additional `.mpxar` for metadata archive and `.ppxar` for
the payload data for pxar archives written as split archive.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agowww: cover metadata extension for pxar archives
Christian Ebner [Mon, 19 Feb 2024 13:45:49 +0000 (14:45 +0100)]
www: cover metadata extension for pxar archives

Allows to access the pxar metadata archives for navigation and
download via the Proxmox Backup Server web ui.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agocatalog: shell: make split pxar archives accessible
Christian Ebner [Wed, 21 Feb 2024 19:39:48 +0000 (20:39 +0100)]
catalog: shell: make split pxar archives accessible

Cover the cases where the pxar archive was uploaded as split payload
data and metadata streams. Instantiate the required reader and
decoder instances to access the metadata and payload data archives,
using the corresponding helper methods.
Allows to restore split metadata and payload stream pxar archives via
the catalog shell.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoapi: datastore: attach split archive payload chunk reader
Christian Ebner [Tue, 20 Feb 2024 14:49:18 +0000 (15:49 +0100)]
api: datastore: attach split archive payload chunk reader

Attach the payload chunk reader for pxar archives which have been
uploaded using split streams for metadata and payload data.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: mount: make split pxar archives mountable
Christian Ebner [Thu, 15 Feb 2024 11:47:32 +0000 (12:47 +0100)]
client: mount: make split pxar archives mountable

Cover the cases where the pxar archive was uploaded as split payload
data and metadata streams. Instantiate the required reader and
decoder instances to access the metadata and payload data archives.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: tools: cover extension for split pxar archives
Christian Ebner [Mon, 19 Feb 2024 13:50:28 +0000 (14:50 +0100)]
client: tools: cover extension for split pxar archives

Cover the additional `.mpxar` for metadata archive and `.ppxar` for
the payload data file in the cli parameter completion callback.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>