public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v2] fix #5229: tape: remove max sequence number limit
Date: Mon, 12 Feb 2024 13:27:34 +0100	[thread overview]
Message-ID: <20240212122734.1991317-1-d.csapak@proxmox.com> (raw)

The idea was to limit the number of tapes in a media set, but this was
not enforced when adding a medium to a media set, only on read/parsing
the inventory. With that, it is possible to create media sets greater
than the limit which in turn blocks access to most functions via
api/cli/gui due to the check.

Instead of enforcing an arbitrary limit, simply warn on creation when
the media-set is very large (20).

To restore the whole media set, the time taken would still be at least 38
hours for LTO-4 and 250 hours for LTO-9.

We already have a section in the docs where we tell about the
disadvantages of large media sets.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* better sentence in commit message about restore time
* keep the limit as a constant (but with a different name, at different
  location)
 src/tape/media_set.rs       | 10 ----------
 src/tape/pool_writer/mod.rs | 12 ++++++++++++
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/tape/media_set.rs b/src/tape/media_set.rs
index 8c08efd9..894c8ae3 100644
--- a/src/tape/media_set.rs
+++ b/src/tape/media_set.rs
@@ -13,8 +13,6 @@ pub struct MediaSet {
 }
 
 impl MediaSet {
-    pub const MEDIA_SET_MAX_SEQ_NR: u64 = 100;
-
     #[allow(clippy::new_without_default)]
     pub fn new() -> Self {
         let uuid = Uuid::generate();
@@ -41,14 +39,6 @@ impl MediaSet {
     }
 
     pub fn insert_media(&mut self, uuid: Uuid, seq_nr: u64) -> Result<(), Error> {
-        if seq_nr > Self::MEDIA_SET_MAX_SEQ_NR {
-            bail!(
-                "media set sequence number to large in media set {} ({} > {})",
-                self.uuid.to_string(),
-                seq_nr,
-                Self::MEDIA_SET_MAX_SEQ_NR
-            );
-        }
         let seq_nr = seq_nr as usize;
         if self.media_list.len() > seq_nr {
             if self.media_list[seq_nr].is_some() {
diff --git a/src/tape/pool_writer/mod.rs b/src/tape/pool_writer/mod.rs
index f1224bdd..a6ba4a1d 100644
--- a/src/tape/pool_writer/mod.rs
+++ b/src/tape/pool_writer/mod.rs
@@ -32,6 +32,10 @@ use super::file_formats::{
     PROXMOX_BACKUP_CATALOG_ARCHIVE_MAGIC_1_0, PROXMOX_BACKUP_CATALOG_ARCHIVE_MAGIC_1_1,
 };
 
+// Warn when the sequence number reaches this limit, as large
+// media sets are error prone and take a very long time to restore from.
+const MEDIA_SET_SEQ_NR_WARN_LIMIT: u64 = 20;
+
 struct PoolWriterState {
     drive: Box<dyn TapeDriver>,
     // Media Uuid from loaded media
@@ -272,6 +276,14 @@ impl PoolWriter {
 
         let media_set = media.media_set_label().unwrap();
 
+        if is_new_media && media_set.seq_nr >= MEDIA_SET_SEQ_NR_WARN_LIMIT {
+            task_warn!(
+                worker,
+                "large media-set detected ({}), consider using a different allocation policy",
+                media_set.seq_nr
+            );
+        }
+
         drive.assert_encryption_mode(media_set.encryption_key_fingerprint.is_some())?;
 
         self.status = Some(PoolWriterState {
-- 
2.30.2





             reply	other threads:[~2024-02-12 12:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 12:27 Dominik Csapak [this message]
2024-02-12 13:06 ` [pbs-devel] applied: " Dietmar Maurer

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=20240212122734.1991317-1-d.csapak@proxmox.com \
    --to=d.csapak@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal