From 085d3b9d9496fe7d2767a63be1b7ddf5ff556c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Fri, 30 Oct 2020 11:42:00 +0100 Subject: [PATCH] Update heed to 0.10.0 --- Cargo.lock | 35 ++++++++++++++++++++++--- Cargo.toml | 2 +- src/mdfs.rs | 2 +- src/search.rs | 2 +- src/subcommand/serve.rs | 4 +-- src/update/clear_documents.rs | 4 +-- src/update/delete_documents.rs | 4 +-- src/update/index_documents/mod.rs | 4 +-- src/update/index_documents/transform.rs | 2 +- src/update/update_builder.rs | 6 ++--- 10 files changed, 47 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e707317f2..63c0ea192 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -344,6 +344,15 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" +dependencies = [ + "crossbeam-utils 0.6.6", +] + [[package]] name = "crossbeam-queue" version = "0.2.2" @@ -354,6 +363,16 @@ dependencies = [ "crossbeam-utils 0.7.2", ] +[[package]] +name = "crossbeam-utils" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" +dependencies = [ + "cfg-if 0.1.10", + "lazy_static", +] + [[package]] name = "crossbeam-utils" version = "0.7.2" @@ -689,9 +708,9 @@ dependencies = [ [[package]] name = "heed" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cbfcd936aa75c7cb1a8485dd2506ea0ae204e2131bf614d8aa4e5f4177455b1" +checksum = "68e5fb45cfad5bc754aeeac84a1e963aed4b34e577e388524e0d8ed6b50fbab0" dependencies = [ "byteorder", "heed-traits", @@ -700,6 +719,7 @@ dependencies = [ "lmdb-rkv-sys", "once_cell", "page_size", + "synchronoise", "url", "zerocopy", ] @@ -1604,7 +1624,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280" dependencies = [ "crossbeam-deque", - "crossbeam-queue", + "crossbeam-queue 0.2.2", "crossbeam-utils 0.7.2", "lazy_static", "num_cpus", @@ -1925,6 +1945,15 @@ dependencies = [ "syn", ] +[[package]] +name = "synchronoise" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d717ed0efc9d39ab3b642a096bc369a3e02a38a51c41845d7fe31bdad1d6eaeb" +dependencies = [ + "crossbeam-queue 0.1.2", +] + [[package]] name = "synstructure" version = "0.12.4" diff --git a/Cargo.toml b/Cargo.toml index 9d30a6c44..d4a67c623 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ flate2 = "1.0.17" fst = "0.4.4" fxhash = "0.2.1" grenad = { git = "https://github.com/Kerollmops/grenad.git", rev = "ce3517f" } -heed = { version = "0.9.0", default-features = false, features = ["lmdb"] } +heed = { version = "0.10.0", default-features = false, features = ["lmdb"] } human_format = "1.0.3" indexmap = { version = "1.6.0", features = ["serde-1"] } jemallocator = "0.3.2" diff --git a/src/mdfs.rs b/src/mdfs.rs index 746d4bd4d..3182fa96e 100644 --- a/src/mdfs.rs +++ b/src/mdfs.rs @@ -8,7 +8,7 @@ use crate::Index; /// A mana depth first search implementation. pub struct Mdfs<'a> { index: &'a Index, - rtxn: &'a heed::RoTxn, + rtxn: &'a heed::RoTxn<'a>, words: &'a [(HashMap, RoaringBitmap)], union_cache: HashMap<(usize, u8), RoaringBitmap>, candidates: RoaringBitmap, diff --git a/src/search.rs b/src/search.rs index 98376bf7e..ae2b5d127 100644 --- a/src/search.rs +++ b/src/search.rs @@ -21,7 +21,7 @@ pub struct Search<'a> { query: Option, offset: usize, limit: usize, - rtxn: &'a heed::RoTxn, + rtxn: &'a heed::RoTxn<'a>, index: &'a Index, } diff --git a/src/subcommand/serve.rs b/src/subcommand/serve.rs index bd88c3661..7081a2a00 100644 --- a/src/subcommand/serve.rs +++ b/src/subcommand/serve.rs @@ -292,7 +292,7 @@ pub fn run(opt: Opt) -> anyhow::Result<()> { .len() as usize; // And the number of documents in the database. - let rtxn = index_cloned.clone().read_txn().unwrap(); + let rtxn = index_cloned.read_txn().unwrap(); let docs_count = index_cloned.clone().number_of_documents(&rtxn).unwrap() as usize; IndexTemplate { db_name: db_name_cloned.clone(), db_size, docs_count } @@ -330,7 +330,7 @@ pub fn run(opt: Opt) -> anyhow::Result<()> { .len() as usize; // And the number of documents in the database. - let rtxn = index_cloned.clone().read_txn().unwrap(); + let rtxn = index_cloned.read_txn().unwrap(); let docs_count = index_cloned.clone().number_of_documents(&rtxn).unwrap() as usize; let template = UpdatesTemplate { diff --git a/src/update/clear_documents.rs b/src/update/clear_documents.rs index 4e68aac4c..ae739bd0b 100644 --- a/src/update/clear_documents.rs +++ b/src/update/clear_documents.rs @@ -2,12 +2,12 @@ use roaring::RoaringBitmap; use crate::Index; pub struct ClearDocuments<'t, 'u, 'i> { - wtxn: &'t mut heed::RwTxn<'u>, + wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index, } impl<'t, 'u, 'i> ClearDocuments<'t, 'u, 'i> { - pub fn new(wtxn: &'t mut heed::RwTxn<'u>, index: &'i Index) -> ClearDocuments<'t, 'u, 'i> { + pub fn new(wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index) -> ClearDocuments<'t, 'u, 'i> { ClearDocuments { wtxn, index } } diff --git a/src/update/delete_documents.rs b/src/update/delete_documents.rs index e9c3370de..1b29ab0d1 100644 --- a/src/update/delete_documents.rs +++ b/src/update/delete_documents.rs @@ -8,7 +8,7 @@ use crate::{Index, BEU32, SmallString32}; use super::ClearDocuments; pub struct DeleteDocuments<'t, 'u, 'i> { - wtxn: &'t mut heed::RwTxn<'u>, + wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index, users_ids_documents_ids: fst::Map>, documents_ids: RoaringBitmap, @@ -16,7 +16,7 @@ pub struct DeleteDocuments<'t, 'u, 'i> { impl<'t, 'u, 'i> DeleteDocuments<'t, 'u, 'i> { pub fn new( - wtxn: &'t mut heed::RwTxn<'u>, + wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index, ) -> anyhow::Result> { diff --git a/src/update/index_documents/mod.rs b/src/update/index_documents/mod.rs index 2551a2f46..739d44f13 100644 --- a/src/update/index_documents/mod.rs +++ b/src/update/index_documents/mod.rs @@ -181,7 +181,7 @@ pub enum IndexDocumentsMethod { } pub struct IndexDocuments<'t, 'u, 'i> { - wtxn: &'t mut heed::RwTxn<'u>, + wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index, log_every_n: Option, max_nb_chunks: Option, @@ -195,7 +195,7 @@ pub struct IndexDocuments<'t, 'u, 'i> { } impl<'t, 'u, 'i> IndexDocuments<'t, 'u, 'i> { - pub fn new(wtxn: &'t mut heed::RwTxn<'u>, index: &'i Index) -> IndexDocuments<'t, 'u, 'i> { + pub fn new(wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index) -> IndexDocuments<'t, 'u, 'i> { IndexDocuments { wtxn, index, diff --git a/src/update/index_documents/transform.rs b/src/update/index_documents/transform.rs index 1200d8403..0c9425ffb 100644 --- a/src/update/index_documents/transform.rs +++ b/src/update/index_documents/transform.rs @@ -23,7 +23,7 @@ pub struct TransformOutput { } pub struct Transform<'t, 'i> { - pub rtxn: &'t heed::RoTxn, + pub rtxn: &'t heed::RoTxn<'t>, pub index: &'i Index, pub chunk_compression_type: CompressionType, pub chunk_compression_level: Option, diff --git a/src/update/update_builder.rs b/src/update/update_builder.rs index 293930bbf..42c4f0754 100644 --- a/src/update/update_builder.rs +++ b/src/update/update_builder.rs @@ -72,7 +72,7 @@ impl UpdateBuilder { pub fn clear_documents<'t, 'u, 'i>( self, - wtxn: &'t mut heed::RwTxn<'u>, + wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index, ) -> ClearDocuments<'t, 'u, 'i> { @@ -81,7 +81,7 @@ impl UpdateBuilder { pub fn delete_documents<'t, 'u, 'i>( self, - wtxn: &'t mut heed::RwTxn<'u>, + wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index, ) -> anyhow::Result> { @@ -90,7 +90,7 @@ impl UpdateBuilder { pub fn index_documents<'t, 'u, 'i>( self, - wtxn: &'t mut heed::RwTxn<'u>, + wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index, ) -> IndexDocuments<'t, 'u, 'i> {