From 24192fc5504894c0aa61576cbc6e3ea2a50c041b Mon Sep 17 00:00:00 2001 From: tamo Date: Wed, 5 May 2021 18:03:21 +0200 Subject: [PATCH] fix tests --- meilisearch-http/src/index_controller/dump_actor/v1.rs | 1 - meilisearch-http/src/index_controller/dump_actor/v2.rs | 1 - meilisearch-http/src/index_controller/index_actor/mod.rs | 4 ++-- meilisearch-http/src/index_controller/update_actor/actor.rs | 2 +- .../src/index_controller/update_actor/update_store.rs | 6 ++++-- meilisearch-http/tests/settings/get_settings.rs | 2 -- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/meilisearch-http/src/index_controller/dump_actor/v1.rs b/meilisearch-http/src/index_controller/dump_actor/v1.rs index 3a20299f3..f22120849 100644 --- a/meilisearch-http/src/index_controller/dump_actor/v1.rs +++ b/meilisearch-http/src/index_controller/dump_actor/v1.rs @@ -89,7 +89,6 @@ pub fn import_index(size: usize, dump_path: &Path, index_path: &Path) -> anyhow: // extract `settings.json` file and import content let settings = import_settings(&dump_path)?; - dbg!(&settings); let settings: index_controller::Settings = settings.into(); let update_builder = UpdateBuilder::new(0); index.update_settings(&settings, update_builder)?; diff --git a/meilisearch-http/src/index_controller/dump_actor/v2.rs b/meilisearch-http/src/index_controller/dump_actor/v2.rs index 7b9a56772..5c5e5fb2d 100644 --- a/meilisearch-http/src/index_controller/dump_actor/v2.rs +++ b/meilisearch-http/src/index_controller/dump_actor/v2.rs @@ -25,7 +25,6 @@ pub fn import_index(size: usize, dump_path: &Path, index_path: &Path) -> anyhow: let settings = import_settings(&dump_path)?; let update_builder = UpdateBuilder::new(0); index.update_settings(&settings, update_builder)?; - dbg!(settings); let update_builder = UpdateBuilder::new(1); let file = File::open(&dump_path.join("documents.jsonl"))?; diff --git a/meilisearch-http/src/index_controller/index_actor/mod.rs b/meilisearch-http/src/index_controller/index_actor/mod.rs index 0145a33d9..cf6a81223 100644 --- a/meilisearch-http/src/index_controller/index_actor/mod.rs +++ b/meilisearch-http/src/index_controller/index_actor/mod.rs @@ -178,8 +178,8 @@ mod test { self.as_ref().snapshot(uuid, path).await } - async fn dump(&self, uuid: Uuid, path: PathBuf) -> IndexResult<()> { - self.as_ref().dump(uuid, path).await + async fn dump(&self, uid: String, uuid: Uuid, path: PathBuf) -> IndexResult<()> { + self.as_ref().dump(uid, uuid, path).await } async fn get_index_stats(&self, uuid: Uuid) -> IndexResult { diff --git a/meilisearch-http/src/index_controller/update_actor/actor.rs b/meilisearch-http/src/index_controller/update_actor/actor.rs index 64794bc6f..fe4458acd 100644 --- a/meilisearch-http/src/index_controller/update_actor/actor.rs +++ b/meilisearch-http/src/index_controller/update_actor/actor.rs @@ -241,7 +241,7 @@ where tokio::task::spawn_blocking(move || -> anyhow::Result<()> { update_store.dump(&uuids, path.to_path_buf())?; - // Perform the snapshot of each index concurently. Only a third of the capabilities of + // Perform the dump of each index concurently. Only a third of the capabilities of // the index actor at a time not to put too much pressure on the index actor let path = &path; let handle = &index_handle; diff --git a/meilisearch-http/src/index_controller/update_actor/update_store.rs b/meilisearch-http/src/index_controller/update_actor/update_store.rs index d767dfa93..f3d7dfd0a 100644 --- a/meilisearch-http/src/index_controller/update_actor/update_store.rs +++ b/meilisearch-http/src/index_controller/update_actor/update_store.rs @@ -11,6 +11,7 @@ use arc_swap::ArcSwap; use heed::types::{ByteSlice, OwnedType, SerdeJson}; use heed::zerocopy::U64; use heed::{BytesDecode, BytesEncode, CompactionOption, Database, Env, EnvOpenOptions}; +use log::error; use parking_lot::{Mutex, MutexGuard}; use tokio::runtime::Handle; use tokio::sync::mpsc; @@ -77,6 +78,7 @@ pub enum State { Idle, Processing(Uuid, Processing), Snapshoting, + Dumping, } impl<'a> BytesEncode<'a> for NextIdCodec { @@ -227,7 +229,7 @@ impl UpdateStore { match res { Ok(Some(_)) => (), Ok(None) => break, - Err(e) => eprintln!("error while processing update: {}", e), + Err(e) => error!("error while processing update: {}", e), } } // the ownership on the arc has been taken, we need to exit. @@ -520,7 +522,7 @@ impl UpdateStore { pub fn dump(&self, uuids: &HashSet<(String, Uuid)>, path: PathBuf) -> anyhow::Result<()> { use std::io::prelude::*; let state_lock = self.state.write(); - state_lock.swap(State::Snapshoting); // TODO: TAMO rename the state somehow + state_lock.swap(State::Dumping); let txn = self.env.write_txn()?; diff --git a/meilisearch-http/tests/settings/get_settings.rs b/meilisearch-http/tests/settings/get_settings.rs index a39dd54e9..4230e19f8 100644 --- a/meilisearch-http/tests/settings/get_settings.rs +++ b/meilisearch-http/tests/settings/get_settings.rs @@ -82,9 +82,7 @@ async fn reset_all_settings() { assert_eq!(response["searchableAttributes"], json!(["bar"])); assert_eq!(response["stopWords"], json!(["the"])); - eprintln!("BEFORE"); index.delete_settings().await; - eprintln!("AFTER"); index.wait_update_id(1).await; let (response, code) = index.settings().await;