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:

  1. For each index, attempts to roll back the index
    1. Make sure the index is closed so that there aren't any remaining references to the index
    2. 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.
    3. 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.
    4. 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.
    5. 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.
  2. 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
  3. 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:

Telemetry

List all the new or updated telemetry

No new telemetry

Error handling