diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/desirednodes/TransportUpdateDesiredNodesAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/desirednodes/TransportUpdateDesiredNodesAction.java index 86b476f84ecff..da9626d14ca60 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/desirednodes/TransportUpdateDesiredNodesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/desirednodes/TransportUpdateDesiredNodesAction.java @@ -22,14 +22,12 @@ import org.elasticsearch.cluster.desirednodes.VersionConflictException; import org.elasticsearch.cluster.metadata.DesiredNodes; import org.elasticsearch.cluster.metadata.DesiredNodesMetadata; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.routing.RerouteService; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.cluster.service.MasterServiceTaskQueue; import org.elasticsearch.common.Priority; import org.elasticsearch.common.util.concurrent.EsExecutors; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.injection.guice.Inject; import org.elasticsearch.tasks.Task; import org.elasticsearch.threadpool.ThreadPool; @@ -42,7 +40,6 @@ public class TransportUpdateDesiredNodesAction extends TransportMasterNodeAction { private static final Logger logger = LogManager.getLogger(TransportUpdateDesiredNodesAction.class); - private final FeatureService featureService; private final MasterServiceTaskQueue taskQueue; @Inject @@ -50,10 +47,8 @@ public TransportUpdateDesiredNodesAction( TransportService transportService, ClusterService clusterService, RerouteService rerouteService, - FeatureService featureService, ThreadPool threadPool, ActionFilters actionFilters, - IndexNameExpressionResolver indexNameExpressionResolver, AllocationService allocationService ) { super( @@ -67,7 +62,6 @@ public TransportUpdateDesiredNodesAction( UpdateDesiredNodesResponse::new, EsExecutors.DIRECT_EXECUTOR_SERVICE ); - this.featureService = featureService; this.taskQueue = clusterService.createTaskQueue( "update-desired-nodes", Priority.URGENT, diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/NodeJoinExecutor.java b/server/src/main/java/org/elasticsearch/cluster/coordination/NodeJoinExecutor.java index 916a192d53871..77d77099f92cb 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/NodeJoinExecutor.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/NodeJoinExecutor.java @@ -371,7 +371,7 @@ private static void blockForbiddenVersions(TransportVersion joiningTransportVers * that are also present across the whole cluster as a result. */ private Set calculateEffectiveClusterFeatures(DiscoveryNodes nodes, Map> nodeFeatures) { - if (featureService.featuresCanBeAssumedForNodes(nodes)) { + if (FeatureService.featuresCanBeAssumedForNodes(nodes)) { Set assumedFeatures = featureService.getNodeFeatures() .values() .stream() @@ -382,7 +382,7 @@ private Set calculateEffectiveClusterFeatures(DiscoveryNodes nodes, Map< // add all assumed features to the featureset of all nodes of the next major version nodeFeatures = new HashMap<>(nodeFeatures); for (var node : nodes.getNodes().entrySet()) { - if (featureService.featuresCanBeAssumedForNode(node.getValue())) { + if (FeatureService.featuresCanBeAssumedForNode(node.getValue())) { assert nodeFeatures.containsKey(node.getKey()) : "Node " + node.getKey() + " does not have any features"; nodeFeatures.computeIfPresent(node.getKey(), (k, v) -> { var newFeatures = new HashSet<>(v); @@ -525,7 +525,7 @@ private Set enforceNodeFeatureBarrier(DiscoveryNode node, Set ef return newNodeFeatures; } - if (featureService.featuresCanBeAssumedForNode(node)) { + if (FeatureService.featuresCanBeAssumedForNode(node)) { // it might still be ok for this node to join if this node can have assumed features, // and all the missing features are assumed // we can get the NodeFeature object direct from this node's registered features diff --git a/server/src/main/java/org/elasticsearch/features/FeatureService.java b/server/src/main/java/org/elasticsearch/features/FeatureService.java index 9f4ec6209c6f1..a4316aeeaf30d 100644 --- a/server/src/main/java/org/elasticsearch/features/FeatureService.java +++ b/server/src/main/java/org/elasticsearch/features/FeatureService.java @@ -53,14 +53,14 @@ public Map getNodeFeatures() { /** * Returns {@code true} if {@code node} can have assumed features. */ - public boolean featuresCanBeAssumedForNode(DiscoveryNode node) { + public static boolean featuresCanBeAssumedForNode(DiscoveryNode node) { return ClusterFeatures.featuresCanBeAssumedForNode(node); } /** * Returns {@code true} if one or more nodes in {@code nodes} can have assumed features. */ - public boolean featuresCanBeAssumedForNodes(DiscoveryNodes nodes) { + public static boolean featuresCanBeAssumedForNodes(DiscoveryNodes nodes) { return ClusterFeatures.featuresCanBeAssumedForNodes(nodes); } diff --git a/server/src/main/java/org/elasticsearch/health/metadata/HealthMetadataService.java b/server/src/main/java/org/elasticsearch/health/metadata/HealthMetadataService.java index 0d30e157a3a09..1c3ac11fb50ed 100644 --- a/server/src/main/java/org/elasticsearch/health/metadata/HealthMetadataService.java +++ b/server/src/main/java/org/elasticsearch/health/metadata/HealthMetadataService.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.Nullable; import org.elasticsearch.core.Tuple; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.gateway.GatewayService; import java.util.List; @@ -50,7 +49,6 @@ public class HealthMetadataService { private static final Logger logger = LogManager.getLogger(HealthMetadataService.class); private final ClusterService clusterService; - private final FeatureService featureService; private final ClusterStateListener clusterStateListener; private final MasterServiceTaskQueue taskQueue; private volatile boolean enabled; @@ -64,17 +62,16 @@ public class HealthMetadataService { // ClusterState to maintain an up-to-date version of it across the cluster. private volatile HealthMetadata localHealthMetadata; - private HealthMetadataService(ClusterService clusterService, FeatureService featureService, Settings settings) { + private HealthMetadataService(ClusterService clusterService, Settings settings) { this.clusterService = clusterService; - this.featureService = featureService; this.clusterStateListener = this::updateOnClusterStateChange; this.enabled = ENABLED_SETTING.get(settings); this.localHealthMetadata = initialHealthMetadata(settings); this.taskQueue = clusterService.createTaskQueue("health metadata service", Priority.NORMAL, new Executor()); } - public static HealthMetadataService create(ClusterService clusterService, FeatureService featureService, Settings settings) { - HealthMetadataService healthMetadataService = new HealthMetadataService(clusterService, featureService, settings); + public static HealthMetadataService create(ClusterService clusterService, Settings settings) { + HealthMetadataService healthMetadataService = new HealthMetadataService(clusterService, settings); healthMetadataService.registerListeners(); return healthMetadataService; } diff --git a/server/src/main/java/org/elasticsearch/health/node/DiskHealthIndicatorService.java b/server/src/main/java/org/elasticsearch/health/node/DiskHealthIndicatorService.java index c975e1d1abd91..841973911d150 100644 --- a/server/src/main/java/org/elasticsearch/health/node/DiskHealthIndicatorService.java +++ b/server/src/main/java/org/elasticsearch/health/node/DiskHealthIndicatorService.java @@ -18,7 +18,6 @@ import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.util.set.Sets; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.health.Diagnosis; import org.elasticsearch.health.HealthIndicatorDetails; import org.elasticsearch.health.HealthIndicatorImpact; @@ -73,11 +72,9 @@ public class DiskHealthIndicatorService implements HealthIndicatorService { private static final String IMPACT_CLUSTER_FUNCTIONALITY_UNAVAILABLE_ID = "cluster_functionality_unavailable"; private final ClusterService clusterService; - private final FeatureService featureService; - public DiskHealthIndicatorService(ClusterService clusterService, FeatureService featureService) { + public DiskHealthIndicatorService(ClusterService clusterService) { this.clusterService = clusterService; - this.featureService = featureService; } @Override diff --git a/server/src/main/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutor.java b/server/src/main/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutor.java index 7c37a0ce5d927..48cbbb188dd91 100644 --- a/server/src/main/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutor.java +++ b/server/src/main/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutor.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.TimeValue; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.node.NodeClosedException; import org.elasticsearch.persistent.AllocatedPersistentTask; import org.elasticsearch.persistent.PersistentTaskParams; @@ -60,22 +59,15 @@ public final class HealthNodeTaskExecutor extends PersistentTasksExecutor currentTask = new AtomicReference<>(); private final ClusterStateListener taskStarter; private final ClusterStateListener shutdownListener; private volatile boolean enabled; - private HealthNodeTaskExecutor( - ClusterService clusterService, - PersistentTasksService persistentTasksService, - FeatureService featureService, - Settings settings - ) { + private HealthNodeTaskExecutor(ClusterService clusterService, PersistentTasksService persistentTasksService, Settings settings) { super(TASK_NAME, clusterService.threadPool().executor(ThreadPool.Names.MANAGEMENT)); this.clusterService = clusterService; this.persistentTasksService = persistentTasksService; - this.featureService = featureService; this.taskStarter = this::startTask; this.shutdownListener = this::shuttingDown; this.enabled = ENABLED_SETTING.get(settings); @@ -84,16 +76,10 @@ private HealthNodeTaskExecutor( public static HealthNodeTaskExecutor create( ClusterService clusterService, PersistentTasksService persistentTasksService, - FeatureService featureService, Settings settings, ClusterSettings clusterSettings ) { - HealthNodeTaskExecutor healthNodeTaskExecutor = new HealthNodeTaskExecutor( - clusterService, - persistentTasksService, - featureService, - settings - ); + HealthNodeTaskExecutor healthNodeTaskExecutor = new HealthNodeTaskExecutor(clusterService, persistentTasksService, settings); healthNodeTaskExecutor.registerListeners(clusterSettings); return healthNodeTaskExecutor; } diff --git a/server/src/main/java/org/elasticsearch/indices/IndicesService.java b/server/src/main/java/org/elasticsearch/indices/IndicesService.java index 1df5bddeff9e3..3212488cc3011 100644 --- a/server/src/main/java/org/elasticsearch/indices/IndicesService.java +++ b/server/src/main/java/org/elasticsearch/indices/IndicesService.java @@ -79,7 +79,6 @@ import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.env.ShardLock; import org.elasticsearch.env.ShardLockObtainFailedException; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.gateway.MetaStateService; import org.elasticsearch.gateway.MetadataStateFormat; import org.elasticsearch.index.CloseUtils; @@ -236,7 +235,6 @@ public class IndicesService extends AbstractLifecycleComponent private final ScriptService scriptService; private final ClusterService clusterService; private final Client client; - private final FeatureService featureService; private volatile Map indices = Map.of(); private final Map> pendingDeletes = new HashMap<>(); private final AtomicInteger numUncompletedDeletes = new AtomicInteger(); @@ -309,7 +307,6 @@ protected void doStart() { this.scriptService = builder.scriptService; this.clusterService = builder.clusterService; this.client = builder.client; - this.featureService = builder.featureService; this.idFieldDataEnabled = INDICES_ID_FIELD_DATA_ENABLED_SETTING.get(clusterService.getSettings()); clusterService.getClusterSettings().addSettingsUpdateConsumer(INDICES_ID_FIELD_DATA_ENABLED_SETTING, this::setIdFieldDataEnabled); this.indicesFieldDataCache = new IndicesFieldDataCache(settings, new IndexFieldDataCache.Listener() { diff --git a/server/src/main/java/org/elasticsearch/indices/IndicesServiceBuilder.java b/server/src/main/java/org/elasticsearch/indices/IndicesServiceBuilder.java index 66e8f98f77fef..36c40b57d1aca 100644 --- a/server/src/main/java/org/elasticsearch/indices/IndicesServiceBuilder.java +++ b/server/src/main/java/org/elasticsearch/indices/IndicesServiceBuilder.java @@ -20,7 +20,6 @@ import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.core.Nullable; import org.elasticsearch.env.NodeEnvironment; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.gateway.MetaStateService; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.SlowLogFieldProvider; @@ -67,7 +66,6 @@ public class IndicesServiceBuilder { ScriptService scriptService; ClusterService clusterService; Client client; - FeatureService featureService; MetaStateService metaStateService; Collection>> engineFactoryProviders = List.of(); Map directoryFactories = Map.of(); @@ -173,11 +171,6 @@ public IndicesServiceBuilder client(Client client) { return this; } - public IndicesServiceBuilder featureService(FeatureService featureService) { - this.featureService = featureService; - return this; - } - public IndicesServiceBuilder metaStateService(MetaStateService metaStateService) { this.metaStateService = metaStateService; return this; @@ -230,7 +223,6 @@ public IndicesService build() { Objects.requireNonNull(scriptService); Objects.requireNonNull(clusterService); Objects.requireNonNull(client); - Objects.requireNonNull(featureService); Objects.requireNonNull(metaStateService); Objects.requireNonNull(engineFactoryProviders); Objects.requireNonNull(directoryFactories); diff --git a/server/src/main/java/org/elasticsearch/node/NodeConstruction.java b/server/src/main/java/org/elasticsearch/node/NodeConstruction.java index 17ca4805c9b08..da568be30e0df 100644 --- a/server/src/main/java/org/elasticsearch/node/NodeConstruction.java +++ b/server/src/main/java/org/elasticsearch/node/NodeConstruction.java @@ -847,7 +847,6 @@ public Map searchFields() { .scriptService(scriptService) .clusterService(clusterService) .client(client) - .featureService(featureService) .metaStateService(metaStateService) .valuesSourceRegistry(searchModule.getValuesSourceRegistry()) .requestCacheKeyDifferentiator(searchModule.getRequestCacheKeyDifferentiator()) @@ -1147,7 +1146,6 @@ public Map searchFields() { clusterService, threadPool, systemIndices, - featureService, clusterModule.getIndexNameExpressionResolver(), metadataUpdateSettingsService, metadataCreateIndexService @@ -1161,7 +1159,6 @@ public Map searchFields() { discoveryModule.getCoordinator(), clusterService, transportService, - featureService, threadPool, telemetryProvider, repositoriesService, @@ -1333,7 +1330,6 @@ private Module loadDiagnosticServices( Coordinator coordinator, ClusterService clusterService, TransportService transportService, - FeatureService featureService, ThreadPool threadPool, TelemetryProvider telemetryProvider, RepositoriesService repositoriesService, @@ -1351,7 +1347,7 @@ private Module loadDiagnosticServices( var serverHealthIndicatorServices = Stream.of( new StableMasterHealthIndicatorService(coordinationDiagnosticsService, clusterService), new RepositoryIntegrityHealthIndicatorService(clusterService), - new DiskHealthIndicatorService(clusterService, featureService), + new DiskHealthIndicatorService(clusterService), new ShardsCapacityHealthIndicatorService(clusterService), fileSettingsHealthIndicatorService ); @@ -1369,7 +1365,7 @@ private Module loadDiagnosticServices( healthService, telemetryProvider ); - HealthMetadataService healthMetadataService = HealthMetadataService.create(clusterService, featureService, settings); + HealthMetadataService healthMetadataService = HealthMetadataService.create(clusterService, settings); List> healthTrackers = List.of( new DiskHealthTracker(nodeService, clusterService), @@ -1644,7 +1640,6 @@ private Module loadPersistentTasksService( ClusterService clusterService, ThreadPool threadPool, SystemIndices systemIndices, - FeatureService featureService, IndexNameExpressionResolver indexNameExpressionResolver, MetadataUpdateSettingsService metadataUpdateSettingsService, MetadataCreateIndexService metadataCreateIndexService @@ -1661,7 +1656,6 @@ private Module loadPersistentTasksService( HealthNodeTaskExecutor healthNodeTaskExecutor = HealthNodeTaskExecutor.create( clusterService, persistentTasksService, - featureService, settingsModule.getSettings(), clusterService.getClusterSettings() ); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java index 439b61cc43ddf..0e0b7f3f5f5ec 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java @@ -290,7 +290,6 @@ static class LowCardinality extends GlobalOrdinalsStringTermsAggregator { BucketCountThresholds bucketCountThresholds, AggregationContext context, Aggregator parent, - boolean remapGlobalOrds, SubAggCollectionMode collectionMode, boolean showTermDocCountError, Map metadata, @@ -308,7 +307,7 @@ static class LowCardinality extends GlobalOrdinalsStringTermsAggregator { ALWAYS_TRUE, context, parent, - remapGlobalOrds, + false, collectionMode, showTermDocCountError, CardinalityUpperBound.ONE, @@ -385,7 +384,7 @@ protected void doClose() { Releasables.close(resultStrategy, segmentDocCounts, collectionStrategy); } - private void mapSegmentCountsToGlobalCounts(LongUnaryOperator mapping) throws IOException { + private void mapSegmentCountsToGlobalCounts(LongUnaryOperator mapping) { for (long i = 1; i < segmentDocCounts.size(); i++) { // We use set(...) here, because we need to reset the slow to 0. // segmentDocCounts get reused over the segments and otherwise counts would be too high. @@ -395,7 +394,7 @@ private void mapSegmentCountsToGlobalCounts(LongUnaryOperator mapping) throws IO } long ord = i - 1; // remember we do +1 when counting long globalOrd = mapping.applyAsLong(ord); - incrementBucketDocCount(collectionStrategy.globalOrdToBucketOrd(0, globalOrd), inc); + incrementBucketDocCount(collectionStrategy.globalOrdToBucketOrd(globalOrd), inc); } } } @@ -440,7 +439,7 @@ abstract static class CollectionStrategy implements Releasable { /** * Convert a global ordinal into a bucket ordinal. */ - abstract long globalOrdToBucketOrd(long owningBucketOrd, long globalOrd); + abstract long globalOrdToBucketOrd(long globalOrd); /** * Create the aggregation result @@ -491,8 +490,7 @@ void collectGlobalOrd(long owningBucketOrd, int doc, long globalOrd, LeafBucketC } @Override - long globalOrdToBucketOrd(long owningBucketOrd, long globalOrd) { - assert owningBucketOrd == 0; + long globalOrdToBucketOrd(long globalOrd) { return globalOrd; } @@ -659,8 +657,8 @@ void collectGlobalOrd(long owningBucketOrd, int doc, long globalOrd, LeafBucketC } @Override - long globalOrdToBucketOrd(long owningBucketOrd, long globalOrd) { - return bucketOrds.find(owningBucketOrd, globalOrd); + long globalOrdToBucketOrd(long globalOrd) { + return bucketOrds.find(0, globalOrd); } private void collectZeroDocEntriesIfNeeded(long owningBucketOrd) throws IOException { @@ -789,7 +787,7 @@ InternalAggregation[] buildAggregations(LongArray owningBucketOrds) throws IOExc /** * Strategy for building results. */ - abstract class ResultStrategy< + abstract static class ResultStrategy< R extends InternalAggregation, B extends InternalMultiBucketAggregation.InternalBucket, TB extends InternalMultiBucketAggregation.InternalBucket> implements Releasable { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificanceLookup.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificanceLookup.java index a5534f75d4f6a..9bd0e7eac35a0 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificanceLookup.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificanceLookup.java @@ -89,8 +89,7 @@ interface BackgroundFrequencyForLong extends Releasable { this.backgroundFilter = null; } } else { - Query contextFiltered = context.filterQuery(backgroundQuery); - this.backgroundFilter = contextFiltered; + this.backgroundFilter = context.filterQuery(backgroundQuery); } /* * We need to use a superset size that includes deleted docs or we diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java index da5ae37b08228..5a692b934a41c 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java @@ -511,7 +511,6 @@ Aggregator create( bucketCountThresholds, context, parent, - false, subAggCollectMode, showTermDocCountError, metadata, diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/UnmappedSignificantTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/UnmappedSignificantTerms.java index 6d1370f147f36..82011528fef71 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/UnmappedSignificantTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/UnmappedSignificantTerms.java @@ -8,7 +8,6 @@ */ package org.elasticsearch.search.aggregations.bucket.terms; -import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.search.DocValueFormat; @@ -40,7 +39,7 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms { - private Bucket(BytesRef term, long subsetDf, long supersetDf, InternalAggregations aggregations, DocValueFormat format) { + private Bucket(long subsetDf, long supersetDf, InternalAggregations aggregations, DocValueFormat format) { super(subsetDf, supersetDf, aggregations, format); } } diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/desirednodes/TransportUpdateDesiredNodesActionTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/desirednodes/TransportUpdateDesiredNodesActionTests.java index c8d7f9b7948cb..f32ebd3235144 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/desirednodes/TransportUpdateDesiredNodesActionTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/desirednodes/TransportUpdateDesiredNodesActionTests.java @@ -21,12 +21,10 @@ import org.elasticsearch.cluster.metadata.DesiredNodes; import org.elasticsearch.cluster.metadata.DesiredNodesMetadata; import org.elasticsearch.cluster.metadata.DesiredNodesTestCase; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.routing.RerouteService; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.test.MockUtils; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; @@ -53,10 +51,8 @@ public void testWriteBlocks() { transportService, mock(ClusterService.class), mock(RerouteService.class), - mock(FeatureService.class), threadPool, mock(ActionFilters.class), - mock(IndexNameExpressionResolver.class), mock(AllocationService.class) ); @@ -81,10 +77,8 @@ public void testNoBlocks() { transportService, mock(ClusterService.class), mock(RerouteService.class), - mock(FeatureService.class), threadPool, mock(ActionFilters.class), - mock(IndexNameExpressionResolver.class), mock(AllocationService.class) ); diff --git a/server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java b/server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java index 07aa9af3b4030..b77f970d9e785 100644 --- a/server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java +++ b/server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java @@ -117,7 +117,7 @@ public void setUp() throws Exception { public void testServiceBasics() { Set discoveryNodes = createNodesWithAllRoles(); ClusterService clusterService = createClusterService(discoveryNodes, false); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); { HealthStatus expectedStatus = HealthStatus.UNKNOWN; HealthInfo healthInfo = HealthInfo.EMPTY_HEALTH_INFO; @@ -141,7 +141,7 @@ public void testServiceBasics() { public void testIndicatorYieldsGreenWhenNodeHasUnknownStatus() { Set discoveryNodes = createNodesWithAllRoles(); ClusterService clusterService = createClusterService(discoveryNodes, false); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); HealthStatus expectedStatus = HealthStatus.GREEN; HealthInfo healthInfo = createHealthInfoWithOneUnhealthyNode(HealthStatus.UNKNOWN, discoveryNodes); @@ -152,7 +152,7 @@ public void testIndicatorYieldsGreenWhenNodeHasUnknownStatus() { public void testGreen() throws IOException { Set discoveryNodes = createNodesWithAllRoles(); ClusterService clusterService = createClusterService(discoveryNodes, false); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); HealthStatus expectedStatus = HealthStatus.GREEN; HealthInfo healthInfo = createHealthInfoWithOneUnhealthyNode(expectedStatus, discoveryNodes); HealthIndicatorResult result = diskHealthIndicatorService.calculate(true, healthInfo); @@ -187,7 +187,7 @@ public void testYellowMixedNodes() throws IOException { final var clusterService = createClusterService(Set.of(), allNodes, indexNameToNodeIdsMap); HealthStatus expectedStatus = HealthStatus.YELLOW; HealthInfo healthInfo = createHealthInfo(new HealthInfoConfig(expectedStatus, allNodes.size(), allNodes)); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); HealthIndicatorResult result = diskHealthIndicatorService.calculate(true, healthInfo); assertThat(result.status(), equalTo(expectedStatus)); assertThat(result.symptom(), containsString("with roles: [data")); @@ -265,7 +265,7 @@ public void testRedNoBlockedIndicesAndRedAllRoleNodes() throws IOException { indexNameToNodeIdsMap.put(indexName, new HashSet<>(randomNonEmptySubsetOf(affectedNodeIds))); } ClusterService clusterService = createClusterService(Set.of(), discoveryNodes, indexNameToNodeIdsMap); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); Map diskInfoByNode = new HashMap<>(); for (DiscoveryNode discoveryNode : discoveryNodes) { if (affectedNodeIds.contains(discoveryNode.getId())) { @@ -329,7 +329,7 @@ public void testRedNoBlockedIndicesAndRedAllRoleNodes() throws IOException { public void testRedWithBlockedIndicesAndGreenNodes() throws IOException { Set discoveryNodes = createNodesWithAllRoles(); ClusterService clusterService = createClusterService(discoveryNodes, true); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); HealthStatus expectedStatus = HealthStatus.RED; HealthInfo healthInfo = createHealthInfoWithOneUnhealthyNode(HealthStatus.GREEN, discoveryNodes); @@ -374,7 +374,7 @@ public void testRedWithBlockedIndicesAndGreenNodes() throws IOException { public void testRedWithBlockedIndicesAndYellowNodes() throws IOException { Set discoveryNodes = createNodesWithAllRoles(); ClusterService clusterService = createClusterService(discoveryNodes, true); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); HealthStatus expectedStatus = HealthStatus.RED; int numberOfYellowNodes = randomIntBetween(1, discoveryNodes.size()); HealthInfo healthInfo = createHealthInfo(new HealthInfoConfig(HealthStatus.YELLOW, numberOfYellowNodes, discoveryNodes)); @@ -453,7 +453,7 @@ public void testRedBlockedIndicesAndRedAllRolesNodes() throws IOException { } } ClusterService clusterService = createClusterService(blockedIndices, discoveryNodes, indexNameToNodeIdsMap); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); HealthIndicatorResult result = diskHealthIndicatorService.calculate(true, healthInfo); assertThat(result.status(), equalTo(expectedStatus)); assertThat( @@ -492,7 +492,7 @@ public void testRedNodesWithoutAnyBlockedIndices() throws IOException { indexNameToNodeIdsMap.put(indexName, nonRedNodeIds); } ClusterService clusterService = createClusterService(Set.of(), discoveryNodes, indexNameToNodeIdsMap); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); HealthIndicatorResult result = diskHealthIndicatorService.calculate(true, healthInfo); assertThat(result.status(), equalTo(expectedStatus)); assertThat(result.impacts().size(), equalTo(3)); @@ -528,7 +528,7 @@ public void testMissingHealthInfo() { Set discoveryNodesInClusterState = new HashSet<>(discoveryNodes); discoveryNodesInClusterState.add(DiscoveryNodeUtils.create(randomAlphaOfLength(30), UUID.randomUUID().toString())); ClusterService clusterService = createClusterService(discoveryNodesInClusterState, false); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); { HealthInfo healthInfo = HealthInfo.EMPTY_HEALTH_INFO; HealthIndicatorResult result = diskHealthIndicatorService.calculate(true, healthInfo); @@ -560,7 +560,7 @@ public void testUnhealthyMasterNodes() { Set roles = Set.of(DiscoveryNodeRole.MASTER_ROLE, otherRole); Set discoveryNodes = createNodes(roles); ClusterService clusterService = createClusterService(discoveryNodes, false); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); HealthStatus expectedStatus = randomFrom(HealthStatus.RED, HealthStatus.YELLOW); int numberOfProblemNodes = randomIntBetween(1, discoveryNodes.size()); HealthInfo healthInfo = createHealthInfo(new HealthInfoConfig(expectedStatus, numberOfProblemNodes, discoveryNodes)); @@ -615,7 +615,7 @@ public void testUnhealthyNonDataNonMasterNodes() { Set roles = new HashSet<>(randomNonEmptySubsetOf(OTHER_ROLES)); Set nodes = createNodes(roles); ClusterService clusterService = createClusterService(nodes, false); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); HealthStatus expectedStatus = randomFrom(HealthStatus.RED, HealthStatus.YELLOW); int numberOfProblemNodes = randomIntBetween(1, nodes.size()); HealthInfo healthInfo = createHealthInfo(new HealthInfoConfig(expectedStatus, numberOfProblemNodes, nodes)); @@ -671,7 +671,7 @@ public void testBlockedIndexWithRedNonDataNodesAndYellowDataNodes() { Set masterNodes = createNodes(masterRole); Set otherNodes = createNodes(otherRoles); ClusterService clusterService = createClusterService(Sets.union(Sets.union(dataNodes, masterNodes), otherNodes), true); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); int numberOfRedMasterNodes = randomIntBetween(1, masterNodes.size()); int numberOfRedOtherNodes = randomIntBetween(1, otherNodes.size()); int numberOfYellowDataNodes = randomIntBetween(1, dataNodes.size()); @@ -893,7 +893,7 @@ public void testLimitNumberOfAffectedResources() { Set masterNodes = createNodes(20, masterRole); Set otherNodes = createNodes(10, otherRoles); ClusterService clusterService = createClusterService(Sets.union(Sets.union(dataNodes, masterNodes), otherNodes), true); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); int numberOfRedMasterNodes = masterNodes.size(); int numberOfRedOtherNodes = otherNodes.size(); int numberOfYellowDataNodes = dataNodes.size(); @@ -968,7 +968,7 @@ public void testLimitNumberOfAffectedResources() { public void testSkippingFieldsWhenVerboseIsFalse() { Set discoveryNodes = createNodesWithAllRoles(); ClusterService clusterService = createClusterService(discoveryNodes, false); - DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService, featureService); + DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService); HealthStatus expectedStatus = HealthStatus.RED; HealthInfo healthInfo = createHealthInfoWithOneUnhealthyNode(expectedStatus, discoveryNodes); HealthIndicatorResult result = diskHealthIndicatorService.calculate(false, healthInfo); diff --git a/server/src/test/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutorTests.java b/server/src/test/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutorTests.java index aee02fb288b55..420a655e092e2 100644 --- a/server/src/test/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutorTests.java +++ b/server/src/test/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutorTests.java @@ -94,7 +94,7 @@ public void tearDown() throws Exception { } public void testTaskCreation() throws Exception { - HealthNodeTaskExecutor.create(clusterService, persistentTasksService, featureService, settings, clusterSettings); + HealthNodeTaskExecutor.create(clusterService, persistentTasksService, settings, clusterSettings); clusterService.getClusterApplierService().onNewClusterState("initialization", this::initialState, ActionListener.noop()); // Ensure that if the task is gone, it will be recreated. clusterService.getClusterApplierService().onNewClusterState("initialization", this::initialState, ActionListener.noop()); @@ -110,13 +110,7 @@ public void testTaskCreation() throws Exception { } public void testSkippingTaskCreationIfItExists() { - HealthNodeTaskExecutor executor = HealthNodeTaskExecutor.create( - clusterService, - persistentTasksService, - featureService, - settings, - clusterSettings - ); + HealthNodeTaskExecutor executor = HealthNodeTaskExecutor.create(clusterService, persistentTasksService, settings, clusterSettings); executor.startTask(new ClusterChangedEvent("", stateWithHealthNodeSelectorTask(initialState()), ClusterState.EMPTY_STATE)); verify(persistentTasksService, never()).sendStartRequest( eq("health-node"), @@ -132,7 +126,6 @@ public void testDoNothingIfAlreadyShutdown() { HealthNodeTaskExecutor executor = HealthNodeTaskExecutor.create( clusterService, persistentTasksService, - featureService, settings, clusterSettings ); @@ -150,7 +143,6 @@ public void testAbortOnShutdown() { HealthNodeTaskExecutor executor = HealthNodeTaskExecutor.create( clusterService, persistentTasksService, - featureService, settings, clusterSettings ); @@ -165,13 +157,7 @@ public void testAbortOnShutdown() { } public void testAbortOnDisable() { - HealthNodeTaskExecutor executor = HealthNodeTaskExecutor.create( - clusterService, - persistentTasksService, - featureService, - settings, - clusterSettings - ); + HealthNodeTaskExecutor executor = HealthNodeTaskExecutor.create(clusterService, persistentTasksService, settings, clusterSettings); HealthNode task = mock(HealthNode.class); PersistentTaskState state = mock(PersistentTaskState.class); executor.nodeOperation(task, new HealthNodeTaskParams(), state); diff --git a/server/src/test/java/org/elasticsearch/indices/cluster/ClusterStateChanges.java b/server/src/test/java/org/elasticsearch/indices/cluster/ClusterStateChanges.java index 39c327ddee228..86053b7db8b39 100644 --- a/server/src/test/java/org/elasticsearch/indices/cluster/ClusterStateChanges.java +++ b/server/src/test/java/org/elasticsearch/indices/cluster/ClusterStateChanges.java @@ -133,7 +133,6 @@ public class ClusterStateChanges { private static final Settings SETTINGS = Settings.builder().put(PATH_HOME_SETTING.getKey(), "dummy").build(); - private final TransportService transportService; private final AllocationService allocationService; private final ClusterService clusterService; private final FeatureService featureService; @@ -221,7 +220,7 @@ protected ExecutorService createThreadPoolExecutor() { // services featureService = new FeatureService(List.of()); - transportService = new TransportService( + TransportService transportService = new TransportService( SETTINGS, transport, threadPool, diff --git a/server/src/test/java/org/elasticsearch/snapshots/SnapshotResiliencyTests.java b/server/src/test/java/org/elasticsearch/snapshots/SnapshotResiliencyTests.java index 061151a24c455..503ca22b3c313 100644 --- a/server/src/test/java/org/elasticsearch/snapshots/SnapshotResiliencyTests.java +++ b/server/src/test/java/org/elasticsearch/snapshots/SnapshotResiliencyTests.java @@ -2240,7 +2240,6 @@ public RecyclerBytesStreamOutput newNetworkBytesStream() { .scriptService(scriptService) .clusterService(clusterService) .client(client) - .featureService(new FeatureService(List.of())) .metaStateService(new MetaStateService(nodeEnv, namedXContentRegistry)) .mapperMetrics(MapperMetrics.NOOP) .build(); diff --git a/test/framework/src/main/java/org/elasticsearch/cluster/coordination/AbstractCoordinatorTestCase.java b/test/framework/src/main/java/org/elasticsearch/cluster/coordination/AbstractCoordinatorTestCase.java index ddfa61b53a0af..fbda65edee248 100644 --- a/test/framework/src/main/java/org/elasticsearch/cluster/coordination/AbstractCoordinatorTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/cluster/coordination/AbstractCoordinatorTestCase.java @@ -971,9 +971,7 @@ public final class ClusterNode { private AckedFakeThreadPoolMasterService masterService; private DisruptableClusterApplierService clusterApplierService; private ClusterService clusterService; - private FeatureService featureService; TransportService transportService; - private MasterHistoryService masterHistoryService; CoordinationDiagnosticsService coordinationDiagnosticsService; StableMasterHealthIndicatorService stableMasterHealthIndicatorService; private DisruptableMockTransport mockTransport; @@ -1134,8 +1132,7 @@ public RecyclerBytesStreamOutput newNetworkBytesStream() { threadPool ); clusterService = new ClusterService(settings, clusterSettings, masterService, clusterApplierService); - featureService = new FeatureService(List.of()); - masterHistoryService = new MasterHistoryService(transportService, threadPool, clusterService); + MasterHistoryService masterHistoryService = new MasterHistoryService(transportService, threadPool, clusterService); clusterService.setNodeConnectionsService( new NodeConnectionsService(clusterService.getSettings(), threadPool, transportService) ); @@ -1173,7 +1170,7 @@ public RecyclerBytesStreamOutput newNetworkBytesStream() { coordinationServices.getLeaderHeartbeatService(), coordinationServices.getPreVoteCollectorFactory(), CompatibilityVersionsUtils.staticCurrent(), - featureService + new FeatureService(List.of()) ); coordinationDiagnosticsService = new CoordinationDiagnosticsService( clusterService, diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/TransportEsqlStatsAction.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/TransportEsqlStatsAction.java index 4067fc5a4e065..4e67bb4f7de55 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/TransportEsqlStatsAction.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/TransportEsqlStatsAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.injection.guice.Inject; import org.elasticsearch.tasks.Task; import org.elasticsearch.threadpool.ThreadPool; @@ -34,14 +33,12 @@ public class TransportEsqlStatsAction extends TransportNodesAction< Void> { // the plan executor holds the metrics - private final FeatureService featureService; private final PlanExecutor planExecutor; @Inject public TransportEsqlStatsAction( TransportService transportService, ClusterService clusterService, - FeatureService featureService, ThreadPool threadPool, ActionFilters actionFilters, PlanExecutor planExecutor @@ -54,7 +51,6 @@ public TransportEsqlStatsAction( EsqlStatsRequest.NodeStatsRequest::new, threadPool.executor(ThreadPool.Names.MANAGEMENT) ); - this.featureService = featureService; this.planExecutor = planExecutor; } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java index 794dd443dfc42..5cdd466e7bf00 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java @@ -65,7 +65,6 @@ import org.elasticsearch.core.Releasable; import org.elasticsearch.core.TimeValue; import org.elasticsearch.env.Environment; -import org.elasticsearch.env.NodeMetadata; import org.elasticsearch.features.FeatureService; import org.elasticsearch.features.NodeFeature; import org.elasticsearch.http.HttpPreRequest; @@ -754,7 +753,6 @@ public Collection createComponents(PluginServices services) { services.scriptService(), services.xContentRegistry(), services.environment(), - services.nodeEnvironment().nodeMetadata(), services.indexNameExpressionResolver(), services.telemetryProvider(), new PersistentTasksService(services.clusterService(), services.threadPool(), services.client()) @@ -774,7 +772,6 @@ Collection createComponents( ScriptService scriptService, NamedXContentRegistry xContentRegistry, Environment environment, - NodeMetadata nodeMetadata, IndexNameExpressionResolver expressionResolver, TelemetryProvider telemetryProvider, PersistentTasksService persistentTasksService @@ -980,7 +977,6 @@ Collection createComponents( getLicenseState(), systemIndices.getMainIndexManager(), clusterService, - featureService, reservedRoleNameChecker, xContentRegistry ); diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java index dc20b1e28ba78..6d139aee76b39 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java @@ -37,7 +37,6 @@ import org.elasticsearch.common.util.Maps; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.core.Nullable; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.license.LicenseUtils; @@ -141,8 +140,6 @@ public class NativeRolesStore implements BiConsumer, ActionListener< private final ClusterService clusterService; - private final FeatureService featureService; - private final ReservedRoleNameChecker reservedRoleNameChecker; private final NamedXContentRegistry xContentRegistry; @@ -153,7 +150,6 @@ public NativeRolesStore( XPackLicenseState licenseState, SecurityIndexManager securityIndex, ClusterService clusterService, - FeatureService featureService, ReservedRoleNameChecker reservedRoleNameChecker, NamedXContentRegistry xContentRegistry ) { @@ -162,7 +158,6 @@ public NativeRolesStore( this.licenseState = licenseState; this.securityIndex = securityIndex; this.clusterService = clusterService; - this.featureService = featureService; this.reservedRoleNameChecker = reservedRoleNameChecker; this.xContentRegistry = xContentRegistry; this.enabled = settings.getAsBoolean(NATIVE_ROLES_ENABLED, true); diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java index 3ff8f16165547..2b4b979fbaaa3 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java @@ -32,14 +32,11 @@ import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.core.TimeValue; -import org.elasticsearch.env.BuildVersion; import org.elasticsearch.env.Environment; -import org.elasticsearch.env.NodeMetadata; import org.elasticsearch.env.TestEnvironment; import org.elasticsearch.features.FeatureService; import org.elasticsearch.index.IndexModule; import org.elasticsearch.index.IndexSettings; -import org.elasticsearch.index.IndexVersion; import org.elasticsearch.index.IndexVersions; import org.elasticsearch.index.SlowLogFieldProvider; import org.elasticsearch.index.analysis.AnalysisRegistry; @@ -203,7 +200,6 @@ protected SSLService getSslService() { private Collection createComponentsUtil(Settings settings) throws Exception { Environment env = TestEnvironment.newEnvironment(settings); - NodeMetadata nodeMetadata = new NodeMetadata(randomAlphaOfLength(8), BuildVersion.current(), IndexVersion.current()); ThreadPool threadPool = mock(ThreadPool.class); ClusterService clusterService = mock(ClusterService.class); settings = Security.additionalSettings(settings, true); @@ -227,7 +223,6 @@ private Collection createComponentsUtil(Settings settings) throws Except mock(ScriptService.class), xContentRegistry(), env, - nodeMetadata, TestIndexNameExpressionResolver.newInstance(threadContext), TelemetryProvider.NOOP, mock(PersistentTasksService.class) diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStoreTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStoreTests.java index 89f32e59f6bad..4228563852a53 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStoreTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStoreTests.java @@ -148,7 +148,6 @@ private NativeRolesStore createRoleStoreForTest(Settings settings) { TestUtils.newTestLicenseState(), securityIndex, clusterService, - mock(FeatureService.class), new ReservedRoleNameChecker.Default(), mock(NamedXContentRegistry.class) ); @@ -404,7 +403,6 @@ public void testPutOfRoleWithFlsDlsUnlicensed() throws IOException { licenseState, securityIndex, clusterService, - mock(FeatureService.class), mock(ReservedRoleNameChecker.class), mock(NamedXContentRegistry.class) ); diff --git a/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycle.java b/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycle.java index 3c7e9310744cb..934db77e73df3 100644 --- a/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycle.java +++ b/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycle.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.core.IOUtils; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.features.NodeFeature; import org.elasticsearch.health.HealthIndicatorService; import org.elasticsearch.license.XPackLicenseState; @@ -93,7 +92,6 @@ public class SnapshotLifecycle extends Plugin implements ActionPlugin, HealthPlu private final SetOnce snapshotRetentionService = new SetOnce<>(); private final SetOnce snapshotHistoryStore = new SetOnce<>(); private final SetOnce slmHealthIndicatorService = new SetOnce<>(); - private final SetOnce featureService = new SetOnce<>(); private final Settings settings; public SnapshotLifecycle(Settings settings) { @@ -126,7 +124,6 @@ public Collection createComponents(PluginServices services) { ClusterService clusterService = services.clusterService(); ThreadPool threadPool = services.threadPool(); final List components = new ArrayList<>(); - featureService.set(services.featureService()); SnapshotLifecycleTemplateRegistry templateRegistry = new SnapshotLifecycleTemplateRegistry( settings, clusterService,