mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-15 23:30:37 +08:00
force dumpless upgrade to recompute stats
This commit is contained in:
parent
41203f0931
commit
bd27fe7d02
@ -1,7 +1,9 @@
|
|||||||
mod v1_12;
|
mod v1_12;
|
||||||
|
mod v1_13;
|
||||||
|
|
||||||
use heed::RwTxn;
|
use heed::RwTxn;
|
||||||
use v1_12::{V1_12_3_To_Current, V1_12_To_V1_12_3};
|
use v1_12::{V1_12_3_To_V1_13_0, V1_12_To_V1_12_3};
|
||||||
|
use v1_13::V1_13_0_To_Current;
|
||||||
|
|
||||||
use crate::progress::{Progress, VariableNameStep};
|
use crate::progress::{Progress, VariableNameStep};
|
||||||
use crate::{Index, InternalError, Result};
|
use crate::{Index, InternalError, Result};
|
||||||
@ -26,11 +28,13 @@ pub fn upgrade(
|
|||||||
progress: Progress,
|
progress: Progress,
|
||||||
) -> Result<bool> {
|
) -> Result<bool> {
|
||||||
let from = index.get_version(wtxn)?.unwrap_or(db_version);
|
let from = index.get_version(wtxn)?.unwrap_or(db_version);
|
||||||
let upgrade_functions: &[&dyn UpgradeIndex] = &[&V1_12_To_V1_12_3 {}, &V1_12_3_To_Current()];
|
let upgrade_functions: &[&dyn UpgradeIndex] =
|
||||||
|
&[&V1_12_To_V1_12_3 {}, &V1_12_3_To_V1_13_0 {}, &V1_13_0_To_Current()];
|
||||||
|
|
||||||
let start = match from {
|
let start = match from {
|
||||||
(1, 12, 0..=2) => 0,
|
(1, 12, 0..=2) => 0,
|
||||||
(1, 12, 3..) => 1,
|
(1, 12, 3..) => 1,
|
||||||
|
(1, 13, 0) => 2,
|
||||||
// We must handle the current version in the match because in case of a failure some index may have been upgraded but not other.
|
// We must handle the current version in the match because in case of a failure some index may have been upgraded but not other.
|
||||||
(1, 13, _) => return Ok(false),
|
(1, 13, _) => return Ok(false),
|
||||||
(major, minor, patch) => {
|
(major, minor, patch) => {
|
||||||
|
@ -32,9 +32,9 @@ impl UpgradeIndex for V1_12_To_V1_12_3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub(super) struct V1_12_3_To_Current();
|
pub(super) struct V1_12_3_To_V1_13_0 {}
|
||||||
|
|
||||||
impl UpgradeIndex for V1_12_3_To_Current {
|
impl UpgradeIndex for V1_12_3_To_V1_13_0 {
|
||||||
fn upgrade(
|
fn upgrade(
|
||||||
&self,
|
&self,
|
||||||
_wtxn: &mut RwTxn,
|
_wtxn: &mut RwTxn,
|
||||||
@ -42,7 +42,8 @@ impl UpgradeIndex for V1_12_3_To_Current {
|
|||||||
_original: (u32, u32, u32),
|
_original: (u32, u32, u32),
|
||||||
_progress: Progress,
|
_progress: Progress,
|
||||||
) -> Result<bool> {
|
) -> Result<bool> {
|
||||||
Ok(false)
|
// recompute the indexes stats
|
||||||
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn target_version(&self) -> (u32, u32, u32) {
|
fn target_version(&self) -> (u32, u32, u32) {
|
||||||
|
29
crates/milli/src/update/upgrade/v1_13.rs
Normal file
29
crates/milli/src/update/upgrade/v1_13.rs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
use heed::RwTxn;
|
||||||
|
|
||||||
|
use super::UpgradeIndex;
|
||||||
|
use crate::constants::{VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH};
|
||||||
|
use crate::progress::Progress;
|
||||||
|
use crate::{Index, Result};
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
pub(super) struct V1_13_0_To_Current();
|
||||||
|
|
||||||
|
impl UpgradeIndex for V1_13_0_To_Current {
|
||||||
|
fn upgrade(
|
||||||
|
&self,
|
||||||
|
_wtxn: &mut RwTxn,
|
||||||
|
_index: &Index,
|
||||||
|
_original: (u32, u32, u32),
|
||||||
|
_progress: Progress,
|
||||||
|
) -> Result<bool> {
|
||||||
|
Ok(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn target_version(&self) -> (u32, u32, u32) {
|
||||||
|
(
|
||||||
|
VERSION_MAJOR.parse().unwrap(),
|
||||||
|
VERSION_MINOR.parse().unwrap(),
|
||||||
|
VERSION_PATCH.parse().unwrap(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user