mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
Merge #384
384: Replace memmap with memmap2 r=Kerollmops a=palfrey [memmap is unmaintained](https://rustsec.org/advisories/RUSTSEC-2020-0077.html) and needs replacing. memmap2 is a drop-in replacement fork that's well maintained. Note that the version numbers got reset on fork, hence the lower values. Co-authored-by: Tom Parker-Shemilt <palfrey@tevp.net>
This commit is contained in:
commit
c7db4176f3
@ -11,7 +11,7 @@ byte-unit = { version = "4.0.9", default-features = false, features = ["std"] }
|
|||||||
crossbeam-channel = "0.5.0"
|
crossbeam-channel = "0.5.0"
|
||||||
heed = { git = "https://github.com/Kerollmops/heed", tag = "v0.12.1" }
|
heed = { git = "https://github.com/Kerollmops/heed", tag = "v0.12.1" }
|
||||||
meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", tag = "v0.2.5" }
|
meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", tag = "v0.2.5" }
|
||||||
memmap = "0.7.0"
|
memmap2 = "0.5.0"
|
||||||
milli = { path = "../milli" }
|
milli = { path = "../milli" }
|
||||||
once_cell = "1.5.2"
|
once_cell = "1.5.2"
|
||||||
rayon = "1.5.0"
|
rayon = "1.5.0"
|
||||||
|
@ -868,7 +868,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let file = file.into_std().await;
|
let file = file.into_std().await;
|
||||||
let mmap = unsafe { memmap::Mmap::map(&file).expect("can't map file") };
|
let mmap = unsafe { memmap2::Mmap::map(&file).expect("can't map file") };
|
||||||
|
|
||||||
let method = match update_method.as_deref() {
|
let method = match update_method.as_deref() {
|
||||||
Some("replace") => String::from("replace"),
|
Some("replace") => String::from("replace"),
|
||||||
|
@ -23,7 +23,7 @@ human_format = "1.0.3"
|
|||||||
levenshtein_automata = { version = "0.2.0", features = ["fst_automaton"] }
|
levenshtein_automata = { version = "0.2.0", features = ["fst_automaton"] }
|
||||||
linked-hash-map = "0.5.4"
|
linked-hash-map = "0.5.4"
|
||||||
meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", tag = "v0.2.5" }
|
meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", tag = "v0.2.5" }
|
||||||
memmap = "0.7.0"
|
memmap2 = "0.5.0"
|
||||||
obkv = "0.2.0"
|
obkv = "0.2.0"
|
||||||
once_cell = "1.5.2"
|
once_cell = "1.5.2"
|
||||||
ordered-float = "2.1.1"
|
ordered-float = "2.1.1"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use memmap::Mmap;
|
use memmap2::Mmap;
|
||||||
|
|
||||||
/// Wrapper around Mmap allowing to virtualy clone grenad-chunks
|
/// Wrapper around Mmap allowing to virtualy clone grenad-chunks
|
||||||
/// in a parallel process like the indexing.
|
/// in a parallel process like the indexing.
|
||||||
|
@ -70,7 +70,7 @@ pub unsafe fn into_clonable_grenad(
|
|||||||
reader: grenad::Reader<File>,
|
reader: grenad::Reader<File>,
|
||||||
) -> Result<grenad::Reader<CursorClonableMmap>> {
|
) -> Result<grenad::Reader<CursorClonableMmap>> {
|
||||||
let file = reader.into_inner();
|
let file = reader.into_inner();
|
||||||
let mmap = memmap::Mmap::map(&file)?;
|
let mmap = memmap2::Mmap::map(&file)?;
|
||||||
let cursor = io::Cursor::new(ClonableMmap::from(mmap));
|
let cursor = io::Cursor::new(ClonableMmap::from(mmap));
|
||||||
let reader = grenad::Reader::new(cursor)?;
|
let reader = grenad::Reader::new(cursor)?;
|
||||||
Ok(reader)
|
Ok(reader)
|
||||||
|
Loading…
Reference in New Issue
Block a user