* [PATCH proxmox-backup] fix #8186: pxar: fix off-by-one error in dynamic entry range end check
@ 2026-11-09 13:39 Christian Ebner
2026-11-09 23:30 ` applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2026-11-09 13:39 UTC (permalink / raw)
To: pbs-devel
With change-detection-mode metadata, the pxar archiver tires to reuse
unchanged files instead of re-encoding them. This happens by
comparing the file metadata against the matching file from the
previous metadata archive. If reusable, the range of dynamic entries
to reuse from the previous payload archive are determined. To avoid
reusing many partial chunks with only little actual payload, the
archiver uses a lookahead cache and keeps a continuous range of
reusable dynamic entries in order to decide whether to reuse or
re-encode cached entries.
The check for dynamic entries included in the files payload range was
however off-by-one, checking only if the end of the dynamic entry is
smaller than the range end. This however leads to unnecessary
inclusion of the next entry in case the end was equal, with the
consequence that files which potentially could have been reused might
get re-encoded, if the payload padding exceeds the padding threshold.
Both, dynamic entries end and range end are exclusive, so check for
equality in order to only include strictly required dynamic entries.
Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=8186
Reported-by: <moamarch@zoho.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
pbs-client/src/pxar/create.rs | 44 ++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index 4d25341a7..b1266b1fc 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -1468,7 +1468,7 @@ fn lookup_dynamic_entries(
};
indices.push(reusable_dynamic_entry);
- if range.end < end {
+ if range.end <= end {
padding_end = end - range.end;
break;
}
@@ -2187,6 +2187,48 @@ mod tests {
let _ = std::fs::remove_file(&path);
}
+ #[test]
+ fn lookup_dynamic_entries_range_end_check() {
+ use pbs_datastore::dynamic_index::{DynamicIndexReader, DynamicIndexWriter};
+
+ let testdir = create_testdir("lookup_dynamic_entries_range_end_check")
+ .expect("Should be able to create test dir");
+ let path = testdir.join("lookup_dynamic_entries.didx");
+ let _ = std::fs::remove_file(&path);
+
+ let mut writer = DynamicIndexWriter::create(&path).unwrap();
+ writer.add_chunk(1024, &[0xAAu8; 32]).unwrap();
+ writer.add_chunk(2048, &[0xBBu8; 32]).unwrap();
+ writer.add_chunk(3072, &[0xCCu8; 32]).unwrap();
+ let _csum = writer.close().unwrap();
+
+ let reader = DynamicIndexReader::open(&path).unwrap();
+ for (range, count, start_padding, end_padding) in [
+ (0..1024, 1, 0, 0),
+ (16..1024, 1, 16, 0),
+ (0..1000, 1, 0, 24),
+ (1024..2048, 1, 0, 0),
+ (0..2048, 2, 0, 0),
+ (0..2049, 3, 0, 1023),
+ ] {
+ let (indices, start, end) = super::lookup_dynamic_entries(&reader, &range).unwrap();
+ assert_eq!(
+ indices.len(),
+ count,
+ "incorrect chunk count: got {}, expected {count} for {range:?}",
+ indices.len(),
+ );
+ assert_eq!(
+ start, start_padding,
+ "incorrect start padding: got {start}, expected {start_padding} for {range:?}"
+ );
+ assert_eq!(
+ end, end_padding,
+ "incorrect end padding: got {end}, expected {end_padding} for {range:?}"
+ );
+ }
+ }
+
/// Inversions that span cache ranges must be caught by the global tracking; a per-range
/// implementation would have reset on flush and accepted the second offset, after which
/// the encoder strict check would still abort the backup.
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* applied: [PATCH proxmox-backup] fix #8186: pxar: fix off-by-one error in dynamic entry range end check
2026-11-09 13:39 [PATCH proxmox-backup] fix #8186: pxar: fix off-by-one error in dynamic entry range end check Christian Ebner
@ 2026-11-09 23:30 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-11-09 23:30 UTC (permalink / raw)
To: pbs-devel, Christian Ebner
On Mon, 09 Nov 2026 14:39:00 +0100, Christian Ebner wrote:
> With change-detection-mode metadata, the pxar archiver tires to reuse
> unchanged files instead of re-encoding them. This happens by
> comparing the file metadata against the matching file from the
> previous metadata archive. If reusable, the range of dynamic entries
> to reuse from the previous payload archive are determined. To avoid
> reusing many partial chunks with only little actual payload, the
> archiver uses a lookahead cache and keeps a continuous range of
> reusable dynamic entries in order to decide whether to reuse or
> re-encode cached entries.
>
> [...]
Applied, thanks!
[1/1] fix #8186: pxar: fix off-by-one error in dynamic entry range end check
commit: 3a7518533b2a5f118ea5ab77f6f579f6d8ba6f68
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-09 23:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09 13:39 [PATCH proxmox-backup] fix #8186: pxar: fix off-by-one error in dynamic entry range end check Christian Ebner
2026-11-09 23:30 ` 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.