public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager v2 09/15] task cache: include archive file path in error log messages
Date: Mon, 13 Jul 2026 11:49:31 +0200	[thread overview]
Message-ID: <20260713094937.151838-10-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260713094937.151838-1-l.wagner@proxmox.com>

This should make any kind of troubleshooting much simpler.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---

Notes:
    Changes since v1:
      - Avoid .expect() by storing the ArchiveFile and the ArchiveIterator
        together in a tuple (thx @ Dominik)

 server/src/remote_tasks/task_cache.rs | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/server/src/remote_tasks/task_cache.rs b/server/src/remote_tasks/task_cache.rs
index 655f018b..99c9b6ad 100644
--- a/server/src/remote_tasks/task_cache.rs
+++ b/server/src/remote_tasks/task_cache.rs
@@ -1065,8 +1065,8 @@ impl Iterator for TaskArchiveIterator<'_> {
 struct InnerTaskArchiveIterator {
     /// Archive files to read.
     files: Vec<ArchiveFile>,
-    /// Archive iterator we are currently using, if any
-    current: Option<ArchiveIterator>,
+    /// Archive iterator we are currently using, and the corresponding archive file, if any.
+    current: Option<(ArchiveIterator, ArchiveFile)>,
 }
 
 impl InnerTaskArchiveIterator {
@@ -1085,10 +1085,14 @@ impl Iterator for InnerTaskArchiveIterator {
     fn next(&mut self) -> Option<Self::Item> {
         loop {
             match &mut self.current {
-                Some(current) => {
+                Some((current, file)) => {
                     let next = current.next();
                     if next.is_some() {
-                        return next;
+                        return next.map(|res| {
+                            res.with_context(|| {
+                                format!("failed to read from {file}", file = file.path.display())
+                            })
+                        });
                     } else {
                         self.current = None;
                     }
@@ -1099,7 +1103,7 @@ impl Iterator for InnerTaskArchiveIterator {
 
                     match next_file.iter() {
                         Ok(Some(iter)) => {
-                            self.current = Some(iter);
+                            self.current = Some((iter, next_file));
                             break 'inner;
                         }
                         Ok(None) => {
@@ -1107,7 +1111,8 @@ impl Iterator for InnerTaskArchiveIterator {
                         }
                         Err(err) => {
                             log::error!(
-                                "could not create archive iterator while iteration over task archive files, skipping: {err:#}"
+                                "could not create task archive iterator for {file}, skipping: {err:#}",
+                                file = next_file.path.display()
                             )
                         }
                     }
@@ -1292,7 +1297,7 @@ impl JournalIterator {
             .flat_map(|task| match task {
                 Ok(task) => Some(task),
                 Err(err) => {
-                    log::error!("could not read task while iterating over archive file: {err:#}");
+                    log::error!("could not read task while iterating over journal file: {err:#}");
                     None
                 }
             })
-- 
2.47.3





  parent reply	other threads:[~2026-07-13  9:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  9:49 [PATCH datacenter-manager/proxmox v2 00/15] task cache improvements (archive corruption handling, error handling) Lukas Wagner
2026-07-13  9:49 ` [PATCH proxmox v2 01/15] sys: fs: don't replace file extension make_tmp_file Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 02/15] task cache: fix missing cutoff state for PBS remotes Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 03/15] task cache: refresh task: don't apply journal if the archive was rotated Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 04/15] task cache: rotate/init: align timestamp for new files to UTC midnight Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 05/15] task cache: add test case for task cache rotation Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 06/15] task cache: pre-compute static paths during initialization Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 07/15] task cache: only initialize `TaskCache` struct once Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 08/15] task cache: archive iterator: don't yield more items if reading from file failed Lukas Wagner
2026-07-13  9:49 ` Lukas Wagner [this message]
2026-07-13  9:49 ` [PATCH datacenter-manager v2 10/15] task cache: introduce ArchiveFileWriter Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 11/15] task cache: use ArchiveFileWriter when creating new archive files Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 12/15] task cache: trigger repair of corruption when applying journal Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 13/15] task cache: trigger repair of corruption when compressing archive files Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 14/15] task cache: trigger repair of corruption after read-accesses Lukas Wagner
2026-07-13  9:49 ` [PATCH datacenter-manager v2 15/15] task cache: handle potentially duplicated archive files after 'compress_archive_file' Lukas Wagner

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=20260713094937.151838-10-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pdm-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal