[pbs-devel] [PATCH proxmox-backup v2 6/7] api2: tape/restore: finish temporary catalog at the end

Dominik Csapak d.csapak at proxmox.com
Thu Jul 22 15:41:05 CEST 2021


in 'restore_archive', we reach that 'catalog.commit()' for
* every skipped snapshot (we already call 'commit_if_large' then before)
* every skipped chunk archive (no change in catalog since we do not read
  the chunk archive in that case)
* after reading a catalog (no change in catalog)

in all other cases, we call 'commit_if_large' and return early,
meaning that the 'commit' there was executed too often and
unnecessary, so change it to a finish and after the loop over the files,
before the call to 'finish_temporary_database' (which only renames
the file into place)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/api2/tape/restore.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/api2/tape/restore.rs b/src/api2/tape/restore.rs
index 1b0bc03f..806304aa 100644
--- a/src/api2/tape/restore.rs
+++ b/src/api2/tape/restore.rs
@@ -998,6 +998,8 @@ pub fn restore_media(
         restore_archive(worker.clone(), reader, current_file_number, target, &mut catalog, checked_chunks_map, verbose)?;
     }
 
+    catalog.finish()?;
+
     MediaCatalog::finish_temporary_database(status_path, &media_id.label.uuid, true)?;
 
     Ok(())
@@ -1150,8 +1152,6 @@ fn restore_archive<'a>(
          _ =>  bail!("unknown content magic {:?}", header.content_magic),
     }
 
-    catalog.commit()?;
-
     Ok(())
 }
 
-- 
2.30.2






More information about the pbs-devel mailing list