Skip to content

Commit 764d824

Browse files
andrrossvinaykpud
authored andcommitted
Ignore archived settings on update (opensearch-project#18885)
Prior to this change all settings updates would fail if archived settings were present, even when attempting to update unrelated settings. This change ignores archived settings when validating a settings update. Signed-off-by: Andrew Ross <[email protected]>
1 parent 2909027 commit 764d824

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
9696
- Field-level ignore_malformed should override index-level setting ([#18706](https://github.com/opensearch-project/OpenSearch/pull/18706))
9797
- Fixed Staggered merge - load average replace with AverageTrackers, some Default thresholds modified ([#18666](https://github.com/opensearch-project/OpenSearch/pull/18666))
9898
- Use `new SecureRandom()` to avoid blocking ([18729](https://github.com/opensearch-project/OpenSearch/issues/18729))
99+
- Ignore archived settings on update ([#8714](https://github.com/opensearch-project/OpenSearch/issues/8714))
99100
- Ignore awareness attributes when a custom preference string is included with a search request ([#18848](https://github.com/opensearch-project/OpenSearch/pull/18848))
100101
- Use ScoreDoc instead of FieldDoc when creating TopScoreDocCollectorManager to avoid unnecessary conversion ([#18802](https://github.com/opensearch-project/OpenSearch/pull/18802))
101102
- Fix leafSorter optimization for ReadOnlyEngine and NRTReplicationEngine ([#18639](https://github.com/opensearch-project/OpenSearch/pull/18639))

server/src/internalClusterTest/java/org/opensearch/indices/settings/ArchivedIndexSettingsIT.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ public void testArchiveSettings() throws Exception {
8888
startsWith("Can't update non dynamic settings [[archived.index.dummy]] for open indices [[test")
8989
);
9090

91+
// Verify that a random unrelated setting can be updated when archived settings are present.
92+
client().admin()
93+
.indices()
94+
.prepareUpdateSettings("test")
95+
.setSettings(Settings.builder().put("index.max_terms_count", 1024).build())
96+
.execute()
97+
.actionGet();
98+
9199
// close the index.
92100
client().admin().indices().prepareClose("test").get();
93101

server/src/main/java/org/opensearch/cluster/metadata/MetadataUpdateSettingsService.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ public ClusterState execute(ClusterState currentState) {
357357
Settings finalSettings = indexSettings.build();
358358
indexScopedSettings.validate(
359359
finalSettings.filter(k -> indexScopedSettings.isPrivateSetting(k) == false),
360-
true
360+
true, // validateDependencies
361+
false, // ignorePrivateSettings
362+
true // ignoreArchivedSettings
361363
);
362364
metadataBuilder.put(IndexMetadata.builder(indexMetadata).settings(finalSettings));
363365
}
@@ -389,9 +391,9 @@ public ClusterState execute(ClusterState currentState) {
389391
Settings finalSettings = indexSettings.build();
390392
indexScopedSettings.validate(
391393
finalSettings.filter(k -> indexScopedSettings.isPrivateSetting(k) == false),
392-
true,
393-
false,
394-
true
394+
true, // validateDependencies
395+
false, // ignorePrivateSettings
396+
true // ignoreArchivedSettings
395397
);
396398
metadataBuilder.put(IndexMetadata.builder(indexMetadata).settings(finalSettings));
397399
}

0 commit comments

Comments
 (0)