Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog/126077.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 126077
summary: Preventing `ConcurrentModificationException` when updating settings for more
than one index
area: Indices APIs
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public void testThatNonDynamicSettingChangesTakeEffect() throws Exception {
* This test makes sure that when non-dynamic settings are updated that they actually take effect (as opposed to just being set
* in the cluster state).
*/
createIndex("test", Settings.EMPTY);
createIndex("test-1", Settings.EMPTY);
createIndex("test-2", Settings.EMPTY);
MetadataUpdateSettingsService metadataUpdateSettingsService = internalCluster().getCurrentMasterNodeInstance(
MetadataUpdateSettingsService.class
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ ClusterState execute(ClusterState currentState) {
allocationService.getShardRoutingRoleStrategy(),
currentState.routingTable()
);
for (Index index : openIndices) {
for (Index index : new HashSet<>(openIndices)) {
// We only want to take on the expense of reopening all shards for an index if the setting is really changing
Settings existingSettings = currentState.getMetadata().index(index).getSettings();
boolean needToReopenIndex = false;
Expand Down