* [PATCH proxmox-backup] client: pxar: let backup stream callers see each archived entry
@ 2026-11-30 10:03 Dietmar Maurer
2026-12-01 2:27 ` applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Dietmar Maurer @ 2026-11-30 10:03 UTC (permalink / raw)
To: pbs-devel
A graphical client wants to show which file a running backup is at.
Byte counts alone can mislead: a sparse file, such as a core dump,
can be read for a long time while the counter climbs far beyond the
data size on disk.
The archiver already calls a per-entry callback, but the stream
hardwired it to a debug log line. Callers can now pass their own
callback, which runs in addition to the log line. The command line
client passes none, so its behavior is unchanged.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
pbs-client/src/pxar_backup_stream.rs | 17 ++++++++++++++++-
proxmox-backup-client/src/main.rs | 1 +
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/pbs-client/src/pxar_backup_stream.rs b/pbs-client/src/pxar_backup_stream.rs
index 430eee01f..ed179bddf 100644
--- a/pbs-client/src/pxar_backup_stream.rs
+++ b/pbs-client/src/pxar_backup_stream.rs
@@ -22,6 +22,9 @@ use pbs_datastore::catalog::{BackupCatalogWriter, CatalogWriter};
use crate::inject_reused_chunks::InjectChunks;
use crate::pxar::create::PxarWriters;
+/// Called with the archive-relative path of each entry before it is encoded.
+pub type PxarEntryCallback = Box<dyn FnMut(&Path) + Send>;
+
/// Stream implementation to encode and upload .pxar archives.
///
/// The hyper client needs an async Stream for file upload, so we
@@ -50,6 +53,7 @@ impl PxarBackupStream {
options: crate::pxar::PxarCreateOptions,
boundaries: Option<mpsc::Sender<InjectChunks>>,
separate_payload_stream: bool,
+ mut on_entry: Option<PxarEntryCallback>,
) -> Result<(Self, Option<Self>), Error> {
let buffer_size = 256 * 1024;
@@ -97,6 +101,9 @@ impl PxarBackupStream {
crate::pxar::Flags::DEFAULT,
move |path| {
debug!("{:?}", path);
+ if let Some(on_entry) = on_entry.as_mut() {
+ on_entry(path);
+ }
Ok(())
},
options,
@@ -145,10 +152,18 @@ impl PxarBackupStream {
options: crate::pxar::PxarCreateOptions,
boundaries: Option<mpsc::Sender<InjectChunks>>,
separate_payload_stream: bool,
+ on_entry: Option<PxarEntryCallback>,
) -> Result<(Self, Option<Self>), Error> {
let dir = nix::dir::Dir::open(dirname, OFlag::O_DIRECTORY, Mode::empty())?;
- Self::new(dir, catalog, options, boundaries, separate_payload_stream)
+ Self::new(
+ dir,
+ catalog,
+ options,
+ boundaries,
+ separate_payload_stream,
+ on_entry,
+ )
}
}
diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index 5238a75ea..156e457de 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -281,6 +281,7 @@ async fn backup_directory<P: AsRef<Path>>(
pxar_create_options,
Some(payload_boundaries_tx),
payload_target.is_some(),
+ None,
)?;
let mut chunk_stream = ChunkStream::new(pxar_stream, chunk_size, None, None);
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* applied: [PATCH proxmox-backup] client: pxar: let backup stream callers see each archived entry
2026-11-30 10:03 [PATCH proxmox-backup] client: pxar: let backup stream callers see each archived entry Dietmar Maurer
@ 2026-12-01 2:27 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-12-01 2:27 UTC (permalink / raw)
To: pbs-devel, Dietmar Maurer
On Mon, 30 Nov 2026 11:03:00 +0100, Dietmar Maurer wrote:
> A graphical client wants to show which file a running backup is at.
> Byte counts alone can mislead: a sparse file, such as a core dump,
> can be read for a long time while the counter climbs far beyond the
> data size on disk.
>
> The archiver already calls a per-entry callback, but the stream
> hardwired it to a debug log line. Callers can now pass their own
> callback, which runs in addition to the log line. The command line
> client passes none, so its behavior is unchanged.
>
> [...]
Applied, thanks!
I put a fix in front of it, so that the backup streams end with an
error instead of waiting forever if the archiver ever panics. The
backup is lost either way, but a hanging client never reports the
failure and, for example, leaves a vzdump job running and the guest
locked until someone kills it. That was pre-existing, but now a panic
in a caller's callback, e.g. on a send to a broken GUI channel, would
hang the backup too.
I also clarified the doc comment of the callback: the archiver can
still skip an entry after the call, for example if it vanished, and in
the metadata change detection mode it may read a file's contents
later, or reuse them from the previous snapshot without reading them;
which is fine for your use case but might be unexpected for others
reusing this in the future.
[1/1] client: pxar: let backup stream callers see each archived entry
commit: e8d87d029c99d32c89e255a64d3fc09a79ce3a1c
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-01 2:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 10:03 [PATCH proxmox-backup] client: pxar: let backup stream callers see each archived entry Dietmar Maurer
2026-12-01 2:27 ` applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.