forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Migrations] Only reindex indices if needed (elastic#147371)
Fixes elastic#124946 ## Summary Takes a step toward optimising our migration paths by only reindexing (an expensive operation) when needed by checking whether the current SO mappings have "changed". By "changed" we mean that we have detected a new md5 checksum of any registered saved object type relative to the hashes we have stored. ## How to test These changes are constrained to the `model.ts`, a test was added for correctly detecting that mappings are the same during the `INIT` phase to send us down the correct migration path. Additionally, we have a new Jest integration test `skip_reindex.test.ts` that runs Kibana and inspects the logs for the expected model transitions. Everything else should remain the same. ## Happy path for skipping reindex ``` RUN INIT IF !versionMigrationIsComplete AND !kibana indexBelongsToLaterVersion AND !waitForMigrationCompletion AND mappingsAreUnchanged THEN the migration operations must target the existing .kibana_x.y.z_001 index RUN PREPARE_COMPATIBLE_MIGRATION (new state) we remove old version aliases (prevent old reads/writes), and set the current version alias (prevent old migrations) SKIP LEGACY_SET_WRITE_BLOCK SKIP ... SKIP SET_SOURCE_WRITE_BLOCK SKIP ... SKIP REFRESH_TARGET RUN OUTDATED_DOCUMENTS_SEARCH_OPEN_PIT ... RUN MARK_VERSION_INDEX_READY DONE ``` ## Notes * This optimisation will only be triggered when there are no mappings changes AND we are upgrading to a new version. This does not cover all cases. In future we will make this more sophisticated by checking for incompatible changes to mappings and only reindexing when those occur. ## Related * elastic#147503 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Gerard Soldevila <[email protected]>
- Loading branch information
1 parent
eb2c9ce
commit bcb8a13
Showing
9 changed files
with
394 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.