Skip to content

Commit 3bcd0b5

Browse files
Remove cluster state to keep function clean. (#67866)
1 parent e5a15d4 commit 3bcd0b5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,7 @@ private ClusterState applyCreateIndexWithTemporaryService(final ClusterState cur
439439
* Given a state and index settings calculated after applying templates, validate metadata for
440440
* the new index, returning an {@link IndexMetadata} for the new index
441441
*/
442-
private IndexMetadata buildAndValidateTemporaryIndexMetadata(final ClusterState currentState,
443-
final Settings aggregatedIndexSettings,
442+
private IndexMetadata buildAndValidateTemporaryIndexMetadata(final Settings aggregatedIndexSettings,
444443
final CreateIndexClusterStateUpdateRequest request,
445444
final int routingNumShards) {
446445

@@ -481,7 +480,7 @@ private ClusterState applyCreateIndexRequestWithV1Templates(final ClusterState c
481480
aggregateIndexSettings(currentState, request, MetadataIndexTemplateService.resolveSettings(templates),
482481
null, settings, indexScopedSettings, shardLimitValidator, indexSettingProviders);
483482
int routingNumShards = getIndexNumberOfRoutingShards(aggregatedIndexSettings, null);
484-
IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(currentState, aggregatedIndexSettings, request, routingNumShards);
483+
IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(aggregatedIndexSettings, request, routingNumShards);
485484

486485
return applyCreateIndexWithTemporaryService(currentState, request, silent, null, tmpImd, List.of(mappings),
487486
indexService -> resolveAndValidateAliases(request.index(), request.aliases(),
@@ -514,7 +513,7 @@ private ClusterState applyCreateIndexRequestWithV2Template(final ClusterState cu
514513
MetadataIndexTemplateService.resolveSettings(currentState.metadata(), templateName),
515514
null, settings, indexScopedSettings, shardLimitValidator, indexSettingProviders);
516515
int routingNumShards = getIndexNumberOfRoutingShards(aggregatedIndexSettings, null);
517-
IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(currentState, aggregatedIndexSettings, request, routingNumShards);
516+
IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(aggregatedIndexSettings, request, routingNumShards);
518517

519518
return applyCreateIndexWithTemporaryService(currentState, request, silent, null, tmpImd, mappings,
520519
indexService -> resolveAndValidateAliases(request.index(), request.aliases(),
@@ -560,7 +559,7 @@ private ClusterState applyCreateIndexRequestWithExistingMetadata(final ClusterSt
560559
final Settings aggregatedIndexSettings = aggregateIndexSettings(currentState, request, Settings.EMPTY,
561560
sourceMetadata, settings, indexScopedSettings, shardLimitValidator, indexSettingProviders);
562561
final int routingNumShards = getIndexNumberOfRoutingShards(aggregatedIndexSettings, sourceMetadata);
563-
IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(currentState, aggregatedIndexSettings, request, routingNumShards);
562+
IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(aggregatedIndexSettings, request, routingNumShards);
564563

565564
return applyCreateIndexWithTemporaryService(currentState, request, silent, sourceMetadata, tmpImd, List.of(mappings),
566565
indexService -> resolveAndValidateAliases(request.index(), request.aliases(), Collections.emptyList(),

0 commit comments

Comments
 (0)