-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Allow rollbacking updates #5523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
…ndex or index-scheduler
0364213
to
09a6656
Compare
09a6656
to
c5360bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks impressively easy to implement (apart from some little quirks here and there). I still have one question.
To use this new ability, one must cancel a processing or failed (or enqueued)
DatabaseUpgrade
task.
I don't get how someone could cancel a failed task. Is it because Meilisearch enqueues one upgrade task by index, and if one fails, it is a dedicated task in the task queue that can be rolled back? I am not sure if the task queue has been modified to accept such user requests to cancel failed (already processed) tasks.
if version != Some(package_version) { | ||
return Err(Error::UnrecoverableError(Box::new( | ||
Error::IndexSchedulerVersionMismatch { | ||
index_scheduler_version: version.unwrap_or((1, 12, 0)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it expected to see a raw 1.12.0 version here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ho! It's the default version if we don't have one 🤔
Thank you for the review @Kerollmops
This is because of a small targeted modification to the code that handles cancelation. This only applies to
No, Meilisearch does not do this. Meilisearch enqueues a single upgrade task to upgrade all indexes.
No, if the upgrade of a single index fails, the entire upgrade task fails.
Alright, let's see how this happens, step by step.
|
Co-authored-by: Clément Renault <clement@meilisearch.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing performances 👍
Pull Request
Related issue
Fixes #5529
What does this PR do?
This PR adds the ability to rollback the migration to a newer version.
To use this new ability, one must cancel a processing or failed (or enqueued)
DatabaseUpgrade
task.Doing so will also cancel all enqueued, processing or failed
DatabaseUpgrade
tasks.The rollback takes place during the processing of the
taskCancelation
task itself.The rollback executes the following algorithm:
VERSION
file is rewritten to the target version.As the index rollback uses the
PREV_SNAPSHOT
feature from LMDB, it has good properties:Implementation
Index::rollback
function that attempts to rollback an index to a previous version using the described rollback algorithmIndexMapper::rollback_index
function that puts the index in safe conditions to be rollbacked, regarding the cache of indexes.tick
function):taskCancelation
tasks beforedatabaseUpgrade
tasks. When starting a Meilisearch that has an upgrade task and a task cancelation, this allows executing the canceling task before the upgrade task.taskCancelation
should disable the execution of all other tasks (should deletion tasks be allowed as well?)upgrade
, so that calling the cancel route can abort adatabaseUpgrade
task that is currently processing. For now the support is rather superficial (one check between each index), it could be improved to add cancel points while an index is upgrading.taskCancelation
tasks to call the rollback routine when at least one database upgrade task is canceled.index.rs