mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-27 07:14:26 +01:00
Merge branch 'stable'
This commit is contained in:
commit
84a3e95fa4
@ -1,3 +1,7 @@
|
||||
## v0.14.1
|
||||
|
||||
- Fix version mismatch in snapshot importation (#959)
|
||||
|
||||
## v0.14.0
|
||||
|
||||
- Fix facet distribution case (#797)
|
||||
|
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -1493,7 +1493,7 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
|
||||
|
||||
[[package]]
|
||||
name = "meilisearch-core"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"assert_matches",
|
||||
@ -1540,14 +1540,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "meilisearch-error"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
dependencies = [
|
||||
"actix-http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "meilisearch-http"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
dependencies = [
|
||||
"actix-cors",
|
||||
"actix-http",
|
||||
@ -1596,7 +1596,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "meilisearch-schema"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"meilisearch-error",
|
||||
@ -1607,7 +1607,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "meilisearch-tokenizer"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
dependencies = [
|
||||
"deunicode",
|
||||
"slice-group-by",
|
||||
@ -1615,7 +1615,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "meilisearch-types"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"zerocopy",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "meilisearch-core"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
license = "MIT"
|
||||
authors = ["Kerollmops <clement@meilisearch.com>"]
|
||||
edition = "2018"
|
||||
@ -24,10 +24,10 @@ intervaltree = "0.2.5"
|
||||
itertools = "0.9.0"
|
||||
levenshtein_automata = { version = "0.2.0", features = ["fst_automaton"] }
|
||||
log = "0.4.8"
|
||||
meilisearch-error = { path = "../meilisearch-error", version = "0.14.0" }
|
||||
meilisearch-schema = { path = "../meilisearch-schema", version = "0.14.0" }
|
||||
meilisearch-tokenizer = { path = "../meilisearch-tokenizer", version = "0.14.0" }
|
||||
meilisearch-types = { path = "../meilisearch-types", version = "0.14.0" }
|
||||
meilisearch-error = { path = "../meilisearch-error", version = "0.14.1" }
|
||||
meilisearch-schema = { path = "../meilisearch-schema", version = "0.14.1" }
|
||||
meilisearch-tokenizer = { path = "../meilisearch-tokenizer", version = "0.14.1" }
|
||||
meilisearch-types = { path = "../meilisearch-types", version = "0.14.1" }
|
||||
once_cell = "1.3.1"
|
||||
ordered-float = { version = "1.0.2", features = ["serde"] }
|
||||
pest = { git = "https://github.com/MarinPostma/pest.git", tag = "meilisearch-patch1" }
|
||||
|
@ -40,6 +40,7 @@ pub struct Database {
|
||||
indexes_store: heed::Database<Str, Unit>,
|
||||
indexes: RwLock<HashMap<String, (Index, thread::JoinHandle<MResult<()>>)>>,
|
||||
update_fn: Arc<ArcSwapFn>,
|
||||
database_version: (u32, u32, u32),
|
||||
}
|
||||
|
||||
pub struct DatabaseOptions {
|
||||
@ -165,7 +166,7 @@ fn update_awaiter(
|
||||
|
||||
/// Ensures Meilisearch version is compatible with the database, returns an error versions mismatch.
|
||||
/// If create is set to true, a VERSION file is created with the current version.
|
||||
fn version_guard(path: &Path, create: bool) -> MResult<()> {
|
||||
fn version_guard(path: &Path, create: bool) -> MResult<(u32, u32, u32)> {
|
||||
let current_version_major = env!("CARGO_PKG_VERSION_MAJOR");
|
||||
let current_version_minor = env!("CARGO_PKG_VERSION_MINOR");
|
||||
let current_version_patch = env!("CARGO_PKG_VERSION_PATCH");
|
||||
@ -186,9 +187,16 @@ fn version_guard(path: &Path, create: bool) -> MResult<()> {
|
||||
// the first is always the complete match, safe to unwrap because we have a match
|
||||
let version_major = version.get(1).unwrap().as_str();
|
||||
let version_minor = version.get(2).unwrap().as_str();
|
||||
let version_patch = version.get(3).unwrap().as_str();
|
||||
|
||||
if version_major != current_version_major || version_minor != current_version_minor {
|
||||
return Err(Error::VersionMismatch(format!("{}.{}.XX", version_major, version_minor)));
|
||||
Err(Error::VersionMismatch(format!("{}.{}.XX", version_major, version_minor)))
|
||||
} else {
|
||||
Ok((
|
||||
version_major.parse().or_else(|e| Err(Error::VersionMismatch(format!("error parsing database version: {}", e))))?,
|
||||
version_minor.parse().or_else(|e| Err(Error::VersionMismatch(format!("error parsing database version: {}", e))))?,
|
||||
version_patch.parse().or_else(|e| Err(Error::VersionMismatch(format!("error parsing database version: {}", e))))?
|
||||
))
|
||||
}
|
||||
}
|
||||
Err(error) => {
|
||||
@ -202,17 +210,22 @@ fn version_guard(path: &Path, create: bool) -> MResult<()> {
|
||||
current_version_major,
|
||||
current_version_minor,
|
||||
current_version_patch).as_bytes())?;
|
||||
|
||||
Ok((
|
||||
current_version_major.parse().or_else(|e| Err(Error::VersionMismatch(format!("error parsing database version: {}", e))))?,
|
||||
current_version_minor.parse().or_else(|e| Err(Error::VersionMismatch(format!("error parsing database version: {}", e))))?,
|
||||
current_version_patch.parse().or_else(|e| Err(Error::VersionMismatch(format!("error parsing database version: {}", e))))?
|
||||
))
|
||||
} else {
|
||||
// when no version file is found and we were not told to create one, this
|
||||
// means that the version is inferior to the one this feature was added in.
|
||||
return Err(Error::VersionMismatch("<0.12.0".to_string()));
|
||||
Err(Error::VersionMismatch("<0.12.0".to_string()))
|
||||
}
|
||||
}
|
||||
_ => return Err(error.into())
|
||||
_ => Err(error.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl Database {
|
||||
@ -224,7 +237,7 @@ impl Database {
|
||||
fs::create_dir_all(&path)?;
|
||||
|
||||
// create file only if main db wasn't created before (first run)
|
||||
version_guard(path.as_ref(), !main_path.exists() && !update_path.exists())?;
|
||||
let database_version = version_guard(path.as_ref(), !main_path.exists() && !update_path.exists())?;
|
||||
|
||||
fs::create_dir_all(&main_path)?;
|
||||
let env = heed::EnvOpenOptions::new()
|
||||
@ -302,6 +315,7 @@ impl Database {
|
||||
indexes_store,
|
||||
indexes: RwLock::new(indexes),
|
||||
update_fn,
|
||||
database_version,
|
||||
})
|
||||
}
|
||||
|
||||
@ -469,10 +483,19 @@ impl Database {
|
||||
|
||||
let env_path = path.join("main");
|
||||
let env_update_path = path.join("update");
|
||||
let env_version_path = path.join("VERSION");
|
||||
|
||||
fs::create_dir(&env_path)?;
|
||||
fs::create_dir(&env_update_path)?;
|
||||
|
||||
// write Database Version
|
||||
let (current_version_major, current_version_minor, current_version_patch) = self.database_version;
|
||||
let mut version_file = File::create(&env_version_path)?;
|
||||
version_file.write_all(format!("{}.{}.{}",
|
||||
current_version_major,
|
||||
current_version_minor,
|
||||
current_version_patch).as_bytes())?;
|
||||
|
||||
let env_path = env_path.join("data.mdb");
|
||||
let env_file = self.env.copy_to_path(&env_path, CompactionOption::Enabled)?;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "meilisearch-error"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
authors = ["marin <postma.marin@protonmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "meilisearch-http"
|
||||
description = "MeiliSearch HTTP server"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
license = "MIT"
|
||||
authors = [
|
||||
"Quentin de Quelen <quentin@dequelen.me>",
|
||||
@ -33,10 +33,10 @@ http = "0.1.19"
|
||||
indexmap = { version = "1.3.2", features = ["serde-1"] }
|
||||
log = "0.4.8"
|
||||
main_error = "0.1.0"
|
||||
meilisearch-core = { path = "../meilisearch-core", version = "0.14.0" }
|
||||
meilisearch-error = { path = "../meilisearch-error", version = "0.14.0" }
|
||||
meilisearch-schema = { path = "../meilisearch-schema", version = "0.14.0" }
|
||||
meilisearch-tokenizer = {path = "../meilisearch-tokenizer", version = "0.14.0"}
|
||||
meilisearch-core = { path = "../meilisearch-core", version = "0.14.1" }
|
||||
meilisearch-error = { path = "../meilisearch-error", version = "0.14.1" }
|
||||
meilisearch-schema = { path = "../meilisearch-schema", version = "0.14.1" }
|
||||
meilisearch-tokenizer = {path = "../meilisearch-tokenizer", version = "0.14.1"}
|
||||
mime = "0.3.16"
|
||||
rand = "0.7.3"
|
||||
regex = "1.3.6"
|
||||
|
@ -1,13 +1,13 @@
|
||||
[package]
|
||||
name = "meilisearch-schema"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
license = "MIT"
|
||||
authors = ["Kerollmops <renault.cle@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
indexmap = { version = "1.3.2", features = ["serde-1"] }
|
||||
meilisearch-error = { path = "../meilisearch-error", version = "0.14.0" }
|
||||
meilisearch-error = { path = "../meilisearch-error", version = "0.14.1" }
|
||||
serde = { version = "1.0.105", features = ["derive"] }
|
||||
serde_json = { version = "1.0.50", features = ["preserve_order"] }
|
||||
zerocopy = "0.3.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "meilisearch-tokenizer"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
license = "MIT"
|
||||
authors = ["Kerollmops <renault.cle@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "meilisearch-types"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
license = "MIT"
|
||||
authors = ["Clément Renault <renault.cle@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
Loading…
Reference in New Issue
Block a user