From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-datacenter-manager 1/2] server: remote task archive: handle missing journal file gracefully
Date: Wed, 3 Sep 2025 16:48:51 +0200 [thread overview]
Message-ID: <20250903144852.370452-2-l.wagner@proxmox.com> (raw)
In-Reply-To: <20250903144852.370452-1-l.wagner@proxmox.com>
This file is only created after the first update round. This fixes a
'could not create task archive iterator' error when requesting the task
list directly after server startup, in case the journal was deleted or
has not existed before.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
server/src/remote_tasks/task_cache.rs | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/server/src/remote_tasks/task_cache.rs b/server/src/remote_tasks/task_cache.rs
index e9e708e4..57047c8c 100644
--- a/server/src/remote_tasks/task_cache.rs
+++ b/server/src/remote_tasks/task_cache.rs
@@ -952,14 +952,27 @@ impl<'a> TaskArchiveIterator<'a> {
.peekable();
if let Some(journal) = journal {
- let journal_reader = Box::new(BufReader::new(File::open(journal)?));
- let journal_task_iterator = JournalIterator::new(journal_reader).peekable();
- let merge_task_iter = MergeTaskIterator::new(journal_task_iterator, inner);
+ let file = File::open(journal);
- Ok(Self {
- inner: Box::new(merge_task_iter),
- _lock: lock,
- })
+ match file {
+ Ok(file) => {
+ let journal_reader = Box::new(BufReader::new(file));
+ let journal_task_iterator = JournalIterator::new(journal_reader).peekable();
+ let merge_task_iter = MergeTaskIterator::new(journal_task_iterator, inner);
+
+ Ok(Self {
+ inner: Box::new(merge_task_iter),
+ _lock: lock,
+ })
+ }
+ Err(err) if err.kind() == ErrorKind::NotFound => Ok(Self {
+ inner: Box::new(inner),
+ _lock: lock,
+ }),
+ Err(err) => {
+ return Err(err.into());
+ }
+ }
} else {
Ok(Self {
inner: Box::new(inner),
--
2.47.2
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-09-03 14:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 14:48 [pdm-devel] [PATCH proxmox-datacenter-manager 0/2] improve handling of missing task cache files Lukas Wagner
2025-09-03 14:48 ` Lukas Wagner [this message]
2025-09-03 14:48 ` [pdm-devel] [PATCH proxmox-datacenter-manager 2/2] server: remote task cache: improve handling of missing archive files Lukas Wagner
2025-09-03 15:01 ` [pdm-devel] applied-series: [PATCH proxmox-datacenter-manager 0/2] improve handling of missing task cache files Thomas Lamprecht
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=20250903144852.370452-2-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