From: Robert Obkircher <r.obkircher@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH v1 proxmox-backup 1/3] datastore: fix local path for .i.bad chunk files during S3 GC
Date: Mon, 13 Jul 2026 15:22:24 +0200 [thread overview]
Message-ID: <20260713132338.170565-2-r.obkircher@proxmox.com> (raw)
In-Reply-To: <20260713132338.170565-1-r.obkircher@proxmox.com>
Do not push an additional path segment with the extension, and rename
the confusing variable. The additional segment caused a rather cryptic
"TASK ERROR: Not a directory (os error 20)" error during Phase 2 if
the .i.bad file existed locally.
If it doesn't exist locally, the S3 object was and continues to be
deleted, unless it is the very first one and the corresponding chunk
expected marker exists. This behavior might not be desirable if the
files are missing because the datastore was recreated with the "reuse
existing datastore" option.
Fixes: 27e3f5b7b ("GC: fix: don't drop bad extension for S3 object to chunk path helper")
Signed-off-by: Robert Obkircher <r.obkircher@proxmox.com>
---
pbs-datastore/src/datastore.rs | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index e2d1ae67c..3079fe833 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -2678,8 +2678,8 @@ impl DataStore {
// Check object is actually a chunk
let path = Path::new::<str>(object_key);
// file_name() should always be Some, as objects will have a filename
- let digest = path.file_name()?;
- let bytes = digest.as_bytes();
+ let file_name = path.file_name()?;
+ let bytes = file_name.as_bytes();
let bad_ext_len = ".0.bad".len();
let bad_chunk = if bytes.len() == 64 + bad_ext_len {
true
@@ -2693,19 +2693,15 @@ impl DataStore {
}
// Safe since contains valid ascii hexdigits only as checked above.
- let digest_str = digest.to_string_lossy();
+ let digest_str = file_name.to_string_lossy();
let hexdigit_prefix = unsafe { digest_str.get_unchecked(0..4) };
let mut chunk_path = self.base_path();
chunk_path.push(".chunks");
chunk_path.push(hexdigit_prefix);
- chunk_path.push(digest);
- if bad_chunk {
- let extension = unsafe { digest_str.get_unchecked(64..64 + bad_ext_len) };
- chunk_path.push(extension);
- }
+ chunk_path.push(file_name);
let mut digest_bytes = [0u8; 32];
- let digest = digest.as_bytes();
+ let digest = file_name.as_bytes();
// safe to unwrap as already checked above
hex::decode_to_slice(&digest[..64], &mut digest_bytes).unwrap();
--
2.47.3
next prev parent reply other threads:[~2026-07-13 13:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 13:22 [PATCH v1 proxmox-backup 0/3] improve handling of bad S3 chunks during GC Robert Obkircher
2026-07-13 13:22 ` Robert Obkircher [this message]
2026-07-13 13:22 ` [PATCH v1 proxmox-backup 2/3] datastore: check that .i.bad files from S3 actually match that pattern Robert Obkircher
2026-07-13 13:22 ` [PATCH v1 proxmox-backup 3/3] datastore: introduce helper function to parse digest from S3ObjectKey Robert Obkircher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260713132338.170565-2-r.obkircher@proxmox.com \
--to=r.obkircher@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox