Merge pull request #781 from MarinPostma/fix-benchmarks

Fix benchmarks and remove unused dependencies
This commit is contained in:
Clément Renault 2020-06-19 17:13:32 +02:00 committed by GitHub
commit 33bfcbeba7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 100 deletions

91
Cargo.lock generated
View File

@ -49,27 +49,6 @@ dependencies = [
"futures", "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]] [[package]]
name = "actix-http" name = "actix-http"
version = "1.0.1" version = "1.0.1"
@ -884,7 +863,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"version_check 0.9.2", "version_check",
] ]
[[package]] [[package]]
@ -1316,7 +1295,7 @@ dependencies = [
"rand_xoshiro", "rand_xoshiro",
"sized-chunks", "sized-chunks",
"typenum", "typenum",
"version_check 0.9.2", "version_check",
] ]
[[package]] [[package]]
@ -1574,7 +1553,6 @@ name = "meilisearch-http"
version = "0.11.0" version = "0.11.0"
dependencies = [ dependencies = [
"actix-cors", "actix-cors",
"actix-files",
"actix-http", "actix-http",
"actix-rt", "actix-rt",
"actix-service", "actix-service",
@ -1622,12 +1600,10 @@ dependencies = [
name = "meilisearch-schema" name = "meilisearch-schema"
version = "0.11.0" version = "0.11.0"
dependencies = [ dependencies = [
"bincode",
"indexmap", "indexmap",
"meilisearch-error", "meilisearch-error",
"serde", "serde",
"serde_json", "serde_json",
"toml",
"zerocopy", "zerocopy",
] ]
@ -1753,16 +1729,6 @@ dependencies = [
"void", "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]] [[package]]
name = "ntapi" name = "ntapi"
version = "0.3.4" version = "0.3.4"
@ -2008,7 +1974,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
"version_check 0.9.2", "version_check",
] ]
[[package]] [[package]]
@ -2021,7 +1987,7 @@ dependencies = [
"quote", "quote",
"syn", "syn",
"syn-mid", "syn-mid",
"version_check 0.9.2", "version_check",
] ]
[[package]] [[package]]
@ -2836,16 +2802,6 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "toml"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
dependencies = [
"indexmap",
"serde",
]
[[package]] [[package]]
name = "tower-service" name = "tower-service"
version = "0.3.0" version = "0.3.0"
@ -2924,7 +2880,7 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [ dependencies = [
"version_check 0.9.2", "version_check",
] ]
[[package]] [[package]]
@ -3013,37 +2969,6 @@ dependencies = [
"serde", "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]] [[package]]
name = "vec_map" name = "vec_map"
version = "0.8.2" version = "0.8.2"
@ -3060,12 +2985,6 @@ dependencies = [
"chrono", "chrono",
] ]
[[package]]
name = "version_check"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.2" version = "0.9.2"

View File

@ -2,11 +2,12 @@
#[macro_use] #[macro_use]
extern crate assert_matches; extern crate assert_matches;
use std::sync::mpsc; use std::error::Error;
use std::path::Path;
use std::fs::File; use std::fs::File;
use std::io::BufReader; use std::io::BufReader;
use std::iter; use std::iter;
use std::path::Path;
use std::sync::mpsc;
use meilisearch_core::{Database, DatabaseOptions}; use meilisearch_core::{Database, DatabaseOptions};
use meilisearch_core::{ProcessedUpdateResult, UpdateStatus}; use meilisearch_core::{ProcessedUpdateResult, UpdateStatus};
@ -28,9 +29,10 @@ fn prepare_database(path: &Path) -> Database {
database.set_update_callback(Box::new(update_fn)); database.set_update_callback(Box::new(update_fn));
let mut writer = db.main_write_txn().unwrap(); db.main_write::<_, _, Box<dyn Error>>(|writer| {
index.main.put_schema(&mut writer, &Schema::with_primary_key("id")).unwrap(); index.main.put_schema(writer, &Schema::with_primary_key("id")).unwrap();
writer.commit().unwrap(); Ok(())
}).unwrap();
let settings_update: SettingsUpdate = { let settings_update: SettingsUpdate = {
let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../datasets/movies/settings.json"); 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() settings.into_update().unwrap()
}; };
let mut update_writer = db.update_write_txn().unwrap(); db.update_write::<_, _, Box<dyn Error>>(|writer| {
let _update_id = index.settings_update(&mut update_writer, settings_update).unwrap(); let _update_id = index.settings_update(writer, settings_update).unwrap();
update_writer.commit().unwrap(); Ok(())
}).unwrap();
let mut additions = index.documents_addition(); let mut additions = index.documents_addition();
@ -58,9 +61,10 @@ fn prepare_database(path: &Path) -> Database {
additions.update_document(document); additions.update_document(document);
} }
let mut update_writer = db.update_write_txn().unwrap(); let update_id = db.update_write::<_, _, Box<dyn Error>>(|writer| {
let update_id = additions.finalize(&mut update_writer).unwrap(); let update_id = additions.finalize(writer).unwrap();
update_writer.commit().unwrap(); Ok(update_id)
}).unwrap();
// block until the transaction is processed // block until the transaction is processed
let _ = receiver.into_iter().find(|id| *id == update_id); let _ = receiver.into_iter().find(|id| *id == update_id);

View File

@ -18,7 +18,6 @@ default = ["sentry"]
[dependencies] [dependencies]
actix-cors = "0.2.0" actix-cors = "0.2.0"
actix-files = "0.2.1"
actix-http = "1" actix-http = "1"
actix-rt = "1" actix-rt = "1"
actix-service = "1.0.5" actix-service = "1.0.5"

View File

@ -6,10 +6,8 @@ authors = ["Kerollmops <renault.cle@gmail.com>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
bincode = "1.2.1"
indexmap = { version = "1.3.2", features = ["serde-1"] } indexmap = { version = "1.3.2", features = ["serde-1"] }
meilisearch-error = { path = "../meilisearch-error", version = "0.11.0" } meilisearch-error = { path = "../meilisearch-error", version = "0.11.0" }
serde = { version = "1.0.105", features = ["derive"] } serde = { version = "1.0.105", features = ["derive"] }
serde_json = { version = "1.0.50", features = ["preserve_order"] } serde_json = { version = "1.0.50", features = ["preserve_order"] }
toml = { version = "0.5.6", features = ["preserve_order"] }
zerocopy = "0.3.0" zerocopy = "0.3.0"