Use IndexMetaData settings as a basis for new index settings (#25310)

In MockFSDirectory we should use the actual indexes settings to build
a new IndexMetaData settings object instead of the node settings.

Relates to #25297
This commit is contained in:
Simon Willnauer 2017-06-20 15:44:19 +02:00 committed by GitHub
parent 93e29d290f
commit 5abb7c4bec
1 changed files with 3 additions and 1 deletions

View File

@ -166,7 +166,9 @@ public class MockFSDirectoryService extends FsDirectoryService {
final IndexSettings indexSettings = indexStore.getIndexSettings(); final IndexSettings indexSettings = indexStore.getIndexSettings();
final IndexMetaData build = IndexMetaData.builder(indexSettings.getIndexMetaData()) final IndexMetaData build = IndexMetaData.builder(indexSettings.getIndexMetaData())
.settings(Settings.builder() .settings(Settings.builder()
.put(indexSettings.getSettings().getAsMap()) // do not copy the secure settings as they will be copied again later on! // don't use the settings from indexSettings#getSettings() they are merged with node settings and might contain
// secure settings that should not be copied in here since the new IndexSettings ctor below will barf if we do
.put(indexSettings.getIndexMetaData().getSettings())
.put(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(), .put(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(),
RandomPicks.randomFrom(random, IndexModule.Type.values()).getSettingsKey())) RandomPicks.randomFrom(random, IndexModule.Type.values()).getSettingsKey()))
.build(); .build();