From c52d6d0741ffe2c4b08a82d8795069177a05b8f3 Mon Sep 17 00:00:00 2001 From: mpostma Date: Tue, 16 Jun 2020 20:56:32 +0200 Subject: [PATCH 1/2] fix broken benchmarks --- meilisearch-core/benches/search_benchmark.rs | 26 +++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/meilisearch-core/benches/search_benchmark.rs b/meilisearch-core/benches/search_benchmark.rs index dc4c7cdc1..e25245468 100644 --- a/meilisearch-core/benches/search_benchmark.rs +++ b/meilisearch-core/benches/search_benchmark.rs @@ -2,11 +2,12 @@ #[macro_use] extern crate assert_matches; -use std::sync::mpsc; -use std::path::Path; +use std::error::Error; use std::fs::File; use std::io::BufReader; use std::iter; +use std::path::Path; +use std::sync::mpsc; use meilisearch_core::{Database, DatabaseOptions}; use meilisearch_core::{ProcessedUpdateResult, UpdateStatus}; @@ -28,9 +29,10 @@ fn prepare_database(path: &Path) -> Database { database.set_update_callback(Box::new(update_fn)); - let mut writer = db.main_write_txn().unwrap(); - index.main.put_schema(&mut writer, &Schema::with_primary_key("id")).unwrap(); - writer.commit().unwrap(); + db.main_write::<_, _, Box>(|writer| { + index.main.put_schema(writer, &Schema::with_primary_key("id")).unwrap(); + Ok(()) + }).unwrap(); let settings_update: SettingsUpdate = { let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../datasets/movies/settings.json"); @@ -40,9 +42,10 @@ fn prepare_database(path: &Path) -> Database { settings.into_update().unwrap() }; - let mut update_writer = db.update_write_txn().unwrap(); - let _update_id = index.settings_update(&mut update_writer, settings_update).unwrap(); - update_writer.commit().unwrap(); + db.update_write::<_, _, Box>(|writer| { + let _update_id = index.settings_update(writer, settings_update).unwrap(); + Ok(()) + }).unwrap(); let mut additions = index.documents_addition(); @@ -58,9 +61,10 @@ fn prepare_database(path: &Path) -> Database { additions.update_document(document); } - let mut update_writer = db.update_write_txn().unwrap(); - let update_id = additions.finalize(&mut update_writer).unwrap(); - update_writer.commit().unwrap(); + let update_id = db.update_write::<_, _, Box>(|writer| { + let update_id = additions.finalize(writer).unwrap(); + Ok(update_id) + }).unwrap(); // block until the transaction is processed let _ = receiver.into_iter().find(|id| *id == update_id); From 3143ffe2082f50e995e4f85704464b6aae4dab38 Mon Sep 17 00:00:00 2001 From: mpostma Date: Tue, 16 Jun 2020 20:56:55 +0200 Subject: [PATCH 2/2] remove unused dependencies --- Cargo.lock | 91 ++--------------------------------- meilisearch-http/Cargo.toml | 1 - meilisearch-schema/Cargo.toml | 2 - 3 files changed, 5 insertions(+), 89 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc0d453bb..2d81b3b60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,27 +49,6 @@ dependencies = [ "futures", ] -[[package]] -name = "actix-files" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193b22cb1f7b4ff12a4eb2415d6d19e47e44ea93e05930b30d05375ea29d3529" -dependencies = [ - "actix-http", - "actix-service", - "actix-web", - "bitflags", - "bytes 0.5.4", - "derive_more", - "futures-core", - "futures-util", - "log", - "mime", - "mime_guess", - "percent-encoding 2.1.0", - "v_htmlescape", -] - [[package]] name = "actix-http" version = "1.0.1" @@ -884,7 +863,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" dependencies = [ "backtrace", - "version_check 0.9.2", + "version_check", ] [[package]] @@ -1316,7 +1295,7 @@ dependencies = [ "rand_xoshiro", "sized-chunks", "typenum", - "version_check 0.9.2", + "version_check", ] [[package]] @@ -1574,7 +1553,6 @@ name = "meilisearch-http" version = "0.11.0" dependencies = [ "actix-cors", - "actix-files", "actix-http", "actix-rt", "actix-service", @@ -1622,12 +1600,10 @@ dependencies = [ name = "meilisearch-schema" version = "0.11.0" dependencies = [ - "bincode", "indexmap", "meilisearch-error", "serde", "serde_json", - "toml", "zerocopy", ] @@ -1753,16 +1729,6 @@ dependencies = [ "void", ] -[[package]] -name = "nom" -version = "4.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" -dependencies = [ - "memchr", - "version_check 0.1.5", -] - [[package]] name = "ntapi" version = "0.3.4" @@ -2008,7 +1974,7 @@ dependencies = [ "proc-macro2", "quote", "syn", - "version_check 0.9.2", + "version_check", ] [[package]] @@ -2021,7 +1987,7 @@ dependencies = [ "quote", "syn", "syn-mid", - "version_check 0.9.2", + "version_check", ] [[package]] @@ -2836,16 +2802,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" -dependencies = [ - "indexmap", - "serde", -] - [[package]] name = "tower-service" version = "0.3.0" @@ -2924,7 +2880,7 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" dependencies = [ - "version_check 0.9.2", + "version_check", ] [[package]] @@ -3013,37 +2969,6 @@ dependencies = [ "serde", ] -[[package]] -name = "v_escape" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "660b101c07b5d0863deb9e7fb3138777e858d6d2a79f9e6049a27d1cc77c6da6" -dependencies = [ - "v_escape_derive", -] - -[[package]] -name = "v_escape_derive" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ca2a14bc3fc5b64d188b087a7d3a927df87b152e941ccfbc66672e20c467ae" -dependencies = [ - "nom", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "v_htmlescape" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33e939c0d8cf047514fb6ba7d5aac78bc56677a6938b2ee67000b91f2e97e41" -dependencies = [ - "cfg-if", - "v_escape", -] - [[package]] name = "vec_map" version = "0.8.2" @@ -3060,12 +2985,6 @@ dependencies = [ "chrono", ] -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" - [[package]] name = "version_check" version = "0.9.2" diff --git a/meilisearch-http/Cargo.toml b/meilisearch-http/Cargo.toml index 87862e7d0..03f01fe81 100644 --- a/meilisearch-http/Cargo.toml +++ b/meilisearch-http/Cargo.toml @@ -18,7 +18,6 @@ default = ["sentry"] [dependencies] actix-cors = "0.2.0" -actix-files = "0.2.1" actix-http = "1" actix-rt = "1" actix-service = "1.0.5" diff --git a/meilisearch-schema/Cargo.toml b/meilisearch-schema/Cargo.toml index 29f06992f..05013d944 100644 --- a/meilisearch-schema/Cargo.toml +++ b/meilisearch-schema/Cargo.toml @@ -6,10 +6,8 @@ authors = ["Kerollmops "] edition = "2018" [dependencies] -bincode = "1.2.1" indexmap = { version = "1.3.2", features = ["serde-1"] } meilisearch-error = { path = "../meilisearch-error", version = "0.11.0" } serde = { version = "1.0.105", features = ["derive"] } serde_json = { version = "1.0.50", features = ["preserve_order"] } -toml = { version = "0.5.6", features = ["preserve_order"] } zerocopy = "0.3.0"