API/behavior changes
Describe routes and behavior changes
Ability to cancel processing
, failed
and enqueued
databaseUpgrade
tasks
Adds the ability to roll back the upgrade 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.
Rollback algorithm
The rollback executes the following algorithm:
- For each index, attempts to roll back the index
- Make sure the index is closed so that there aren't any remaining references to the index
- Reopen the index normally, check if its version is the target version (index was never upgraded in the first place). If it is, move to the next index.
- If the version is different from the target version, attempt to open the index in a special mode where its data is the data from before the last write to the index.
- If the version of the index in the special mode is the target version, then write something to the index, and commit, discarding the last write to the index.
- Otherwise, the rollback cannot be performed. Restart Meilisearch to attempt the upgrade again. Note that this situation might happen if new data has been rewritten to the index since its upgrade, which should not be possible as new tasks are not processed before the upgrade completes fully.
- After all the indexes have been rolled back, the index scheduler itself is downgraded to the target version: note that currently only the version of the index scheduler is rewritten; in case of non-backward compatible changes in the task queue, one should incorporate a proper downgrade procedure
- Lastly, the
VERSION
file is rewritten to the target version.
Rollback properties
As the index rollback uses the PREV_SNAPSHOT
feature from LMDB, it has good properties:
- Rollback should not require much free disk space
- Rollback should be extremely fast, even if upgrading the index was a long operation
- Rollback does not have a lot of "points of failure"
Telemetry
List all the new or updated telemetry
No new telemetry
Error handling