diff --git a/meilisearch-http/src/helpers/compression.rs b/meilisearch-http/src/helpers/compression.rs index 7e8b5e3f3..e12e5b479 100644 --- a/meilisearch-http/src/helpers/compression.rs +++ b/meilisearch-http/src/helpers/compression.rs @@ -18,10 +18,12 @@ pub fn to_tar_gz(src: &Path, dest: &Path) -> Result<(), Error> { } pub fn from_tar_gz(src: impl AsRef, dest: impl AsRef) -> Result<(), Error> { + println!("inflating from {:?} to {:?}", src.as_ref(), dest.as_ref()); let f = File::open(&src)?; let gz = GzDecoder::new(f); let mut ar = Archive::new(gz); create_dir_all(&dest)?; ar.unpack(&dest)?; + println!("here"); Ok(()) } diff --git a/meilisearch-http/src/index_controller/index_actor.rs b/meilisearch-http/src/index_controller/index_actor.rs index 4b5c68b56..bfa3097a7 100644 --- a/meilisearch-http/src/index_controller/index_actor.rs +++ b/meilisearch-http/src/index_controller/index_actor.rs @@ -423,7 +423,11 @@ impl IndexActor { .map_err(|e| IndexError::Error(e.into()))?; if let Some(index) = self.store.get(uuid).await? { - let index_path = path.join(format!("index-{}", uuid)); + let mut index_path = path.join(format!("index-{}", uuid)); + create_dir_all(&index_path) + .await + .map_err(|e| IndexError::Error(e.into()))?; + index_path.push("data.mdb"); spawn_blocking(move || -> anyhow::Result<()> { // Get write txn to wait for ongoing write transaction before snapshot. let _txn = index.write_txn()?; diff --git a/meilisearch-http/src/index_controller/update_store.rs b/meilisearch-http/src/index_controller/update_store.rs index 587b060af..e17c56e10 100644 --- a/meilisearch-http/src/index_controller/update_store.rs +++ b/meilisearch-http/src/index_controller/update_store.rs @@ -380,13 +380,13 @@ where } pub fn snapshot(&self, txn: &mut heed::RwTxn, path: impl AsRef, uuid: Uuid) -> anyhow::Result<()> { - println!("snapshoting updates in {:?}", path.as_ref()); let update_path = path.as_ref().join("updates"); create_dir_all(&update_path)?; - let snapshot_path = update_path.join(format!("update-{}", uuid)); + let mut snapshot_path = update_path.join(format!("update-{}", uuid)); // acquire write lock to prevent further writes during snapshot - println!("acquired lock"); + create_dir_all(&snapshot_path)?; + snapshot_path.push("data.mdb"); // create db snapshot self.env.copy_to_path(&snapshot_path, CompactionOption::Enabled)?; diff --git a/meilisearch-http/src/index_controller/uuid_resolver.rs b/meilisearch-http/src/index_controller/uuid_resolver.rs index 7d755e9b6..5bdbe667f 100644 --- a/meilisearch-http/src/index_controller/uuid_resolver.rs +++ b/meilisearch-http/src/index_controller/uuid_resolver.rs @@ -253,8 +253,9 @@ impl HeedUuidStore { } fn from_snapshot(snapshot: impl AsRef, path: impl AsRef) -> anyhow::Result { - let snapshot = snapshot.as_ref().join("uuids"); - compression::from_tar_gz(snapshot, &path)?; + let src = snapshot.as_ref().join("uuids"); + let dst = path.as_ref().join("uuids"); + compression::from_tar_gz(src, dst)?; Self::new(path) } } @@ -347,7 +348,9 @@ impl UuidStore for HeedUuidStore { let uuid = Uuid::from_slice(uuid)?; entries.push(uuid) } - path.push("uuids"); + path.push("index_uuids"); + create_dir_all(&path).unwrap(); + path.push("data.mdb"); env.copy_to_path(path, CompactionOption::Enabled)?; Ok(entries) })