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.
[esArchiver] Automatically cleanup SO indices when SO documents are f…
…ound in data.json (elastic#159582) The ultimate goal of this PR is to lay the groundwork to be able to remove the "dynamic" `mappings.json`, which probably should have never existed. With the PR, detecting SO documents in the `data.json` will automatically trigger a cleanup of the SO indices. This, in turn, will allow not having to define "dynamic" saved objects indices (i.e. those with the `$KIBANA_PACKAGE_VERSION` variable in the `mappings.json`). IIUC the idea behind the dynamic indices was to have SO indices that are aligned with the current stack version, avoiding the extra overhead of having to migrate the inserted documents, and reducing overall test times. Nonetheless, what is happening today is: 1. FTR starts ES and Kibana. 2. Kibana creates current version SO indices at startup (empty ones). 3. `esArchiver.load()` processes the `mappings.json`. 3.1. It detects that we are defining SO indices and **deletes** existing saved object indices. 3.2 It then re-creates these indices according to the definitions on `mappings.json`. 4. `esArchiver.load()` processes the `data.json`. Specifically, it inserts SO documents present in `data.json`. 5. `esArchiver.load()` calls the _KibanaMigrator_ to make sure that the inserted documents are up-to-date, hoping they are already aligned with current stack version (which is not always the case, not even with "dynamic" mappings). Two interesting things to note: - Steps 3 to 5 happen whilst Kibana is already started and running. If Kibana queries SO indices during `esArchiver.load()`, and a request to ES is made **right after** 3.2, the result might be elastic#158918. - Having dynamic SO indices' definitions, deleting the "official" indices created by Kibana (3.1), and recreating them hoping to be aligned with current stack version (3.2) is non-sense. We could use the existing SO indices instead, and simply clean them up whenever we are about to insert SO documents. Performing that cleanup is precisely the goal of this PR. Then, in subsequent PRs like https://github.com/elastic/kibana/pull/159397/files, tackling the flaky tests, we'll be able to simply remove the "dynamic" `mappings.json` definitions, causing `esArchiver` to rely on SO indices created by Kibana. Thanks to this PR, the FTR tests won't need to explicitly cleanup saved object indices in the `before` hooks.
- Loading branch information
1 parent
69f35b3
commit bbb5fc4
Showing
6 changed files
with
133 additions
and
27 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
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