mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
update the test with the stats
This commit is contained in:
parent
0cc25c7e4c
commit
cfc1e193b6
5 changed files with 56 additions and 17 deletions
|
@ -1,17 +1,19 @@
|
|||
use heed::RwTxn;
|
||||
|
||||
use crate::progress::{Progress, VariableNameStep};
|
||||
use crate::{Index, InternalError, Result};
|
||||
|
||||
pub fn upgrade(index: &Index, progress: Progress) -> Result<()> {
|
||||
let wtxn = index.env.write_txn()?;
|
||||
let from = index.get_version(&wtxn)?;
|
||||
/// Return true if the cached stats of the index must be regenerated
|
||||
pub fn upgrade(wtxn: &mut RwTxn, index: &Index, progress: Progress) -> Result<bool> {
|
||||
let from = index.get_version(wtxn)?;
|
||||
let upgrade_functions =
|
||||
[(v1_12_to_v1_13 as fn(&Index, Progress) -> Result<()>, "Upgrading from v1.12 to v1.13")];
|
||||
|
||||
let start = match from {
|
||||
let (start, regenerate_stats) = match from {
|
||||
// If there was no version it means we're coming from the v1.12
|
||||
None | Some((1, 12, _)) => 0,
|
||||
None | Some((1, 12, _)) => (0, false),
|
||||
// We must handle the current version in the match because in case of a failure some index may have been upgraded but not other.
|
||||
Some((1, 13, _)) => return Ok(()),
|
||||
Some((1, 13, _)) => return Ok(false),
|
||||
Some((major, minor, patch)) => {
|
||||
return Err(InternalError::CannotUpgradeToVersion(major, minor, patch).into())
|
||||
}
|
||||
|
@ -29,7 +31,7 @@ pub fn upgrade(index: &Index, progress: Progress) -> Result<()> {
|
|||
(upgrade_function)(index, progress.clone())?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(regenerate_stats)
|
||||
}
|
||||
|
||||
fn v1_12_to_v1_13(_index: &Index, _progress: Progress) -> Result<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue