apply all the comments changes

This commit is contained in:
Tamo 2025-01-22 14:30:14 +01:00 committed by Louis Dureuil
parent 7d95950ce6
commit 705d31e8bd
No known key found for this signature in database
4 changed files with 6 additions and 6 deletions

View File

@ -300,7 +300,7 @@ fn upgrade_failure() {
handle.advance_one_successful_batch(); handle.advance_one_successful_batch();
snapshot!(snapshot_index_scheduler(&index_scheduler), name: "after_processing_everything"); snapshot!(snapshot_index_scheduler(&index_scheduler), name: "after_processing_everything");
// When deleting the single upgrade task it should remove the three associated batches // When deleting the single upgrade task it should remove the associated batch
let _task = index_scheduler let _task = index_scheduler
.register( .register(
KindWithContent::TaskDeletion { KindWithContent::TaskDeletion {

View File

@ -25,11 +25,11 @@ pub fn upgrade_task_queue(tasks_path: &Path, from: (u32, u32, u32)) -> anyhow::R
|| (major == current_major && minor == current_minor && patch > current_patch) || (major == current_major && minor == current_minor && patch > current_patch)
{ {
bail!( bail!(
"Database version {major}.{minor}.{patch} is higher than the binary version {current_major}.{current_minor}.{current_patch}. Downgrade is not supported", "Database version {major}.{minor}.{patch} is higher than the Meilisearch version {current_major}.{current_minor}.{current_patch}. Downgrade is not supported",
); );
} else if major < 1 || (major == current_major && minor < 12) { } else if major < 1 || (major == current_major && minor < 12) {
bail!( bail!(
"Database version {major}.{minor}.{patch} is too old for the experimental dumpless upgrade feature. Please generate a dump using the v{major}.{minor}.{patch} and imports it in the v{current_major}.{current_minor}.{current_patch}", "Database version {major}.{minor}.{patch} is too old for the experimental dumpless upgrade feature. Please generate a dump using the v{major}.{minor}.{patch} and import it in the v{current_major}.{current_minor}.{current_patch}",
); );
} else { } else {
bail!("Unknown database version: v{major}.{minor}.{patch}"); bail!("Unknown database version: v{major}.{minor}.{patch}");

View File

@ -339,7 +339,7 @@ fn open_or_create_database_unchecked(
} }
} }
/// Ensures Meilisearch version is compatible with the database, returns an error versions mismatch. /// Ensures Meilisearch version is compatible with the database, returns an error in case of version mismatch.
fn check_version_and_update_task_queue( fn check_version_and_update_task_queue(
db_path: &Path, db_path: &Path,
experimental_dumpless_upgrade: bool, experimental_dumpless_upgrade: bool,

View File

@ -43,7 +43,7 @@ async fn version_too_old() {
std::fs::write(db_path.join("VERSION"), "1.11.9999").unwrap(); std::fs::write(db_path.join("VERSION"), "1.11.9999").unwrap();
let options = Opt { experimental_dumpless_upgrade: true, ..default_settings }; let options = Opt { experimental_dumpless_upgrade: true, ..default_settings };
let err = Server::new_with_options(options).await.map(|_| ()).unwrap_err(); let err = Server::new_with_options(options).await.map(|_| ()).unwrap_err();
snapshot!(err, @"Database version 1.11.9999 is too old for the experimental dumpless upgrade feature. Please generate a dump using the v1.11.9999 and imports it in the v1.13.0"); snapshot!(err, @"Database version 1.11.9999 is too old for the experimental dumpless upgrade feature. Please generate a dump using the v1.11.9999 and import it in the v1.13.0");
} }
#[actix_rt::test] #[actix_rt::test]
@ -58,7 +58,7 @@ async fn version_requires_downgrade() {
std::fs::write(db_path.join("VERSION"), format!("{major}.{minor}.{patch}")).unwrap(); std::fs::write(db_path.join("VERSION"), format!("{major}.{minor}.{patch}")).unwrap();
let options = Opt { experimental_dumpless_upgrade: true, ..default_settings }; let options = Opt { experimental_dumpless_upgrade: true, ..default_settings };
let err = Server::new_with_options(options).await.map(|_| ()).unwrap_err(); let err = Server::new_with_options(options).await.map(|_| ()).unwrap_err();
snapshot!(err, @"Database version 1.13.1 is higher than the binary version 1.13.0. Downgrade is not supported"); snapshot!(err, @"Database version 1.13.1 is higher than the Meilisearch version 1.13.0. Downgrade is not supported");
} }
#[actix_rt::test] #[actix_rt::test]