mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-03-12 19:11:42 +01:00
Dumpless upgrade from v1.13 to v1.14
This commit is contained in:
parent
c1fa3e81a0
commit
39c58d8085
@ -1,15 +1,17 @@
|
|||||||
mod v1_12;
|
mod v1_12;
|
||||||
mod v1_13;
|
mod v1_13;
|
||||||
|
mod v1_14;
|
||||||
|
|
||||||
use heed::RwTxn;
|
use heed::RwTxn;
|
||||||
use v1_12::{V1_12_3_To_V1_13_0, 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_V1_13_1, V1_13_1_To_Current};
|
use v1_13::{V1_13_0_To_V1_13_1, V1_13_1_To_Latest_V1_13};
|
||||||
|
use v1_14::Latest_V1_13_To_Latest_V1_14;
|
||||||
|
|
||||||
use crate::progress::{Progress, VariableNameStep};
|
use crate::progress::{Progress, VariableNameStep};
|
||||||
use crate::{Index, InternalError, Result};
|
use crate::{Index, InternalError, Result};
|
||||||
|
|
||||||
trait UpgradeIndex {
|
trait UpgradeIndex {
|
||||||
/// Returns true if the index scheduler must regenerate its cached stats
|
/// Returns `true` if the index scheduler must regenerate its cached stats.
|
||||||
fn upgrade(
|
fn upgrade(
|
||||||
&self,
|
&self,
|
||||||
wtxn: &mut RwTxn,
|
wtxn: &mut RwTxn,
|
||||||
@ -32,15 +34,17 @@ pub fn upgrade(
|
|||||||
&V1_12_To_V1_12_3 {},
|
&V1_12_To_V1_12_3 {},
|
||||||
&V1_12_3_To_V1_13_0 {},
|
&V1_12_3_To_V1_13_0 {},
|
||||||
&V1_13_0_To_V1_13_1 {},
|
&V1_13_0_To_V1_13_1 {},
|
||||||
&V1_13_1_To_Current {},
|
&V1_13_1_To_Latest_V1_13 {},
|
||||||
|
&Latest_V1_13_To_Latest_V1_14 {},
|
||||||
];
|
];
|
||||||
|
|
||||||
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,
|
(1, 13, 0) => 2,
|
||||||
|
(1, 13, _) => 4,
|
||||||
// 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, _) => 3,
|
(1, 14, _) => 4,
|
||||||
(major, minor, patch) => {
|
(major, minor, patch) => {
|
||||||
return Err(InternalError::CannotUpgradeToVersion(major, minor, patch).into())
|
return Err(InternalError::CannotUpgradeToVersion(major, minor, patch).into())
|
||||||
}
|
}
|
||||||
@ -50,7 +54,6 @@ pub fn upgrade(
|
|||||||
let upgrade_path = &upgrade_functions[start..];
|
let upgrade_path = &upgrade_functions[start..];
|
||||||
|
|
||||||
let mut current_version = from;
|
let mut current_version = from;
|
||||||
|
|
||||||
let mut regenerate_stats = false;
|
let mut regenerate_stats = false;
|
||||||
for (i, upgrade) in upgrade_path.iter().enumerate() {
|
for (i, upgrade) in upgrade_path.iter().enumerate() {
|
||||||
let target = upgrade.target_version();
|
let target = upgrade.target_version();
|
||||||
|
@ -37,9 +37,9 @@ impl UpgradeIndex for V1_13_0_To_V1_13_1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub(super) struct V1_13_1_To_Current();
|
pub(super) struct V1_13_1_To_Latest_V1_13();
|
||||||
|
|
||||||
impl UpgradeIndex for V1_13_1_To_Current {
|
impl UpgradeIndex for V1_13_1_To_Latest_V1_13 {
|
||||||
fn upgrade(
|
fn upgrade(
|
||||||
&self,
|
&self,
|
||||||
_wtxn: &mut RwTxn,
|
_wtxn: &mut RwTxn,
|
||||||
|
40
crates/milli/src/update/upgrade/v1_14.rs
Normal file
40
crates/milli/src/update/upgrade/v1_14.rs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
use heed::RwTxn;
|
||||||
|
|
||||||
|
use super::UpgradeIndex;
|
||||||
|
use crate::progress::Progress;
|
||||||
|
use crate::{make_enum_progress, Index, Result};
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
pub(super) struct Latest_V1_13_To_Latest_V1_14();
|
||||||
|
|
||||||
|
impl UpgradeIndex for Latest_V1_13_To_Latest_V1_14 {
|
||||||
|
fn upgrade(
|
||||||
|
&self,
|
||||||
|
wtxn: &mut RwTxn,
|
||||||
|
index: &Index,
|
||||||
|
_original: (u32, u32, u32),
|
||||||
|
progress: Progress,
|
||||||
|
) -> Result<bool> {
|
||||||
|
make_enum_progress! {
|
||||||
|
enum VectorStore {
|
||||||
|
UpdateInternalVersions,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progress.update_progress(VectorStore::UpdateInternalVersions);
|
||||||
|
|
||||||
|
let rtxn = index.read_txn()?;
|
||||||
|
arroy::upgrade::cosine_from_0_5_to_0_6(
|
||||||
|
&rtxn,
|
||||||
|
index.vector_arroy,
|
||||||
|
&mut wtxn,
|
||||||
|
index.vector_arroy,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn target_version(&self) -> (u32, u32, u32) {
|
||||||
|
(1, 14, 0)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user