From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH pbs 2/2] fix #4761: pbs-client: backup_writer: improve error reporting
Date: Wed, 7 Jun 2023 16:07:01 +0200 [thread overview]
Message-ID: <20230607140701.125092-2-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20230607140701.125092-1-m.sandoval@proxmox.com>
We check if the manifest contains an index for the requested archive, if
it does not we avoid downloading it and report a more helpful error
message.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
Best viewed with git diff -w.
pbs-client/src/backup_writer.rs | 56 +++++++++++++++++++--------------
1 file changed, 32 insertions(+), 24 deletions(-)
diff --git a/pbs-client/src/backup_writer.rs b/pbs-client/src/backup_writer.rs
index 2e18a060..03dbcab7 100644
--- a/pbs-client/src/backup_writer.rs
+++ b/pbs-client/src/backup_writer.rs
@@ -282,33 +282,41 @@ impl BackupWriter {
let close_path = format!("{}_close", prefix);
if let Some(manifest) = options.previous_manifest {
- // try, but ignore errors
- match ArchiveType::from_path(archive_name) {
- Ok(ArchiveType::FixedIndex) => {
- if let Err(err) = self
- .download_previous_fixed_index(
- archive_name,
- &manifest,
- known_chunks.clone(),
- )
- .await
- {
- log::warn!("Error downloading .fidx from previous manifest: {}", err);
+ if !manifest
+ .files()
+ .iter()
+ .any(|file| file.filename == archive_name)
+ {
+ log::info!("There is no index with the name {archive_name}");
+ } else {
+ // try, but ignore errors
+ match ArchiveType::from_path(archive_name) {
+ Ok(ArchiveType::FixedIndex) => {
+ if let Err(err) = self
+ .download_previous_fixed_index(
+ archive_name,
+ &manifest,
+ known_chunks.clone(),
+ )
+ .await
+ {
+ log::warn!("Error downloading .fidx from previous manifest: {}", err);
+ }
}
- }
- Ok(ArchiveType::DynamicIndex) => {
- if let Err(err) = self
- .download_previous_dynamic_index(
- archive_name,
- &manifest,
- known_chunks.clone(),
- )
- .await
- {
- log::warn!("Error downloading .didx from previous manifest: {}", err);
+ Ok(ArchiveType::DynamicIndex) => {
+ if let Err(err) = self
+ .download_previous_dynamic_index(
+ archive_name,
+ &manifest,
+ known_chunks.clone(),
+ )
+ .await
+ {
+ log::warn!("Error downloading .didx from previous manifest: {}", err);
+ }
}
+ _ => { /* do nothing */ }
}
- _ => { /* do nothing */ }
}
}
--
2.39.2
next prev parent reply other threads:[~2023-06-07 14:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 14:07 [pbs-devel] [PATCH pbs 1/2] pbs-client: backup-writer: use log::warn instead of eprintln! Maximiliano Sandoval
2023-06-07 14:07 ` Maximiliano Sandoval [this message]
2023-06-07 14:11 ` [pbs-devel] [PATCH pbs 2/2] fix #4761: pbs-client: backup_writer: improve error reporting Maximiliano Sandoval
2023-07-19 9:08 ` [pbs-devel] applied-series: [PATCH pbs 1/2] pbs-client: backup-writer: use log::warn instead of eprintln! Fabian Grünbichler
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=20230607140701.125092-2-m.sandoval@proxmox.com \
--to=m.sandoval@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 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.