]> git.proxmox.com Git - proxmox-backup.git/commitdiff
api2: tape/restore: commit temporary catalog at the end
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 20 Jul 2021 08:55:11 +0000 (10:55 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 28 Jul 2021 09:28:03 +0000 (11:28 +0200)
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 move it after the loop over the files, before
finishing the temporary database.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/api2/tape/restore.rs

index 1b0bc03f5b8aabb674f24c8f9baa53894fb35f6c..14b43c07cd3e7a9b83d3e369f199cf890afa7781 100644 (file)
@@ -998,6 +998,8 @@ pub fn restore_media(
         restore_archive(worker.clone(), reader, current_file_number, target, &mut catalog, checked_chunks_map, verbose)?;
     }
 
+    catalog.commit()?;
+
     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(())
 }