Add settings assertion in internal index reindexer

When performing an internal reindex, we add a setting marking the source
as read-only. We also check that this index is not already
read-only. This means that when we add the read-only setting, we expect
that it is already not there. This commit adds an assertion before we
increment the settings version validating that this is indeed the case.
This commit is contained in:
Jason Tedor 2018-10-16 06:46:06 -04:00
parent 05911fb499
commit 145bafea88
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
1 changed files with 2 additions and 3 deletions

View File

@ -151,9 +151,8 @@ public class InternalIndexReindexer<T> {
.put(IndexMetaData.INDEX_READ_ONLY_SETTING.getKey(), true)
.build();
final IndexMetaData.Builder builder = IndexMetaData.builder(indexMetaData).settings(indexSettingsBuilder);
if (same(indexMetaData.getSettings(), indexSettingsBuilder) == false) {
assert same(indexMetaData.getSettings(), indexSettingsBuilder) == false;
builder.settingsVersion(1 + builder.settingsVersion());
}
MetaData.Builder metaDataBuilder = MetaData.builder(currentState.metaData()).put(builder);