Better handle errors when trying to clone the handles

This commit is contained in:
Kerollmops
2025-11-06 11:15:34 +01:00
parent 375b5600cd
commit 4fc048ff20
2 changed files with 4 additions and 4 deletions

View File

@@ -373,7 +373,7 @@ fn stream_tarball_into_pipe(
));
let path = indexes_dir.join(uuid.to_string()).join("data.mdb");
let index = index_scheduler.index_mapper.index(&rtxn, &name)?;
let mut index_file = index.try_clone_inner_file().unwrap();
let mut index_file = index.try_clone_inner_file()?;
// Note: A previous snapshot operation may have left the cursor
// at the end of the file so we need to seek to the start.
index_file.seek(SeekFrom::Start(0))?;
@@ -385,7 +385,7 @@ fn stream_tarball_into_pipe(
// 4. Snapshot the auth LMDB env
progress.update_progress(SnapshotCreationProgress::SnapshotTheApiKeys);
let mut auth_env_file = index_scheduler.scheduler.auth_env.try_clone_inner_file().unwrap();
let mut auth_env_file = index_scheduler.scheduler.auth_env.try_clone_inner_file()?;
// Note: A previous snapshot operation may have left the cursor
// at the end of the file so we need to seek to the start.
auth_env_file.seek(SeekFrom::Start(0))?;

View File

@@ -425,8 +425,8 @@ impl Index {
self.env.info().map_size
}
pub fn try_clone_inner_file(&self) -> Result<File> {
Ok(self.env.try_clone_inner_file()?)
pub fn try_clone_inner_file(&self) -> heed::Result<File> {
self.env.try_clone_inner_file()
}
pub fn copy_to_file(&self, file: &mut File, option: CompactionOption) -> Result<()> {