Data Migrations: Improve Disabling and Restoration of ElasticSearch Indexing Settings #4187
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
With this PR, we're improving the disablement and restoration of ES indexing settings. Having these improvements would also be useful for previous data migrations, but for now, we won't be porting them to those. We'll start thinking about it when an actual need arises.
First of all, when disabling indexing on an index, we no longer set the
number_of_replicas
to zero. From this doc:So, because there is risk involved, we decided to simply not fiddle with this setting.
Furthermore, we've addressed an index restoration issue. Prior to this PR, when doing a restoration, previously retrieved ES index would be used. Which is OK, because this way we ensure the original index settings are applied back to the inedx.
But, if a user stopped the data migration manually, and then rerun it, then the restoration step would incorrectly again set "disable indexing" settings. This is because it would use the index settings that were retrieved at the beginning of the new run, which, because the previous run has been manually stopped, still contain
refresh_interval: -1
. Ultimately, this setting would be applied when restoring index settings, effectively leaving the "indexing: disabled" setting still active.How Has This Been Tested?
Manually. Relying on existing Jest tests.
Documentation
Changelog.