mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 09:28:27 +00:00
Add RepositoriesService to createComponents() args (#54814)
Today we pass the `RepositoriesService` to the searchable snapshots plugin during the initialization of the `RepositoryModule`, forcing the plugin to be a `RepositoryPlugin` even though it does not implement any repositories. After discussion we decided it best for now to pass this in via `Plugin#createComponents` instead, pending some future work in which plugins can depend on services more dynamically.
This commit is contained in:
parent
327d268673
commit
7941f4a47e
@ -137,6 +137,7 @@ import org.elasticsearch.indices.analysis.PreBuiltCacheFactory.CachingStrategy;
|
||||
import org.elasticsearch.plugins.AnalysisPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.ScriptPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.script.ScriptContext;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
@ -150,6 +151,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.plugins.AnalysisPlugin.requiresAnalysisSettings;
|
||||
|
||||
@ -164,7 +166,8 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
this.scriptService.set(scriptService);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class PredicateTokenScriptFilterTests extends ESTokenStreamTestCase {
|
||||
};
|
||||
|
||||
CommonAnalysisPlugin plugin = new CommonAnalysisPlugin();
|
||||
plugin.createComponents(null, null, null, null, scriptService, null, null, null, null, null);
|
||||
plugin.createComponents(null, null, null, null, scriptService, null, null, null, null, null, null);
|
||||
AnalysisModule module
|
||||
= new AnalysisModule(TestEnvironment.newEnvironment(settings), Collections.singletonList(plugin));
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class ScriptedConditionTokenFilterTests extends ESTokenStreamTestCase {
|
||||
};
|
||||
|
||||
CommonAnalysisPlugin plugin = new CommonAnalysisPlugin();
|
||||
plugin.createComponents(null, null, null, null, scriptService, null, null, null, null, null);
|
||||
plugin.createComponents(null, null, null, null, scriptService, null, null, null, null, null, null);
|
||||
AnalysisModule module
|
||||
= new AnalysisModule(TestEnvironment.newEnvironment(settings), Collections.singletonList(plugin));
|
||||
|
||||
|
@ -36,6 +36,7 @@ import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -85,7 +86,8 @@ public class ReindexPlugin extends Plugin implements ActionPlugin {
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
return Collections.singletonList(new ReindexSslConfig(environment.settings(), environment, resourceWatcherService));
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@ import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.http.HttpInfo;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestHeaderDefinition;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -60,6 +61,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.singletonList;
|
||||
@ -154,7 +156,8 @@ public class ReindexFromRemoteWithAuthTests extends ESSingleNodeTestCase {
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
testFilter.set(new ReindexFromRemoteWithAuthTests.TestFilter(threadPool));
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.plugins.ClusterPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.threadpool.Scheduler;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
@ -39,6 +40,7 @@ import org.elasticsearch.watcher.ResourceWatcherService;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class SystemdPlugin extends Plugin implements ClusterPlugin {
|
||||
|
||||
@ -90,7 +92,8 @@ public class SystemdPlugin extends Plugin implements ClusterPlugin {
|
||||
final Environment environment,
|
||||
final NodeEnvironment nodeEnvironment,
|
||||
final NamedWriteableRegistry namedWriteableRegistry,
|
||||
final IndexNameExpressionResolver expressionResolver) {
|
||||
final IndexNameExpressionResolver expressionResolver,
|
||||
final Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
if (enabled) {
|
||||
/*
|
||||
* Since we have set the service type to notify, by default systemd will wait up to sixty seconds for the process to send the
|
||||
|
@ -61,28 +61,28 @@ public class SystemdPluginTests extends ESTestCase {
|
||||
|
||||
public void testIsEnabled() {
|
||||
final SystemdPlugin plugin = new SystemdPlugin(false, randomPackageBuildType, Boolean.TRUE.toString());
|
||||
plugin.createComponents(null, null, threadPool, null, null, null, null, null, null, null);
|
||||
plugin.createComponents(null, null, threadPool, null, null, null, null, null, null, null, null);
|
||||
assertTrue(plugin.isEnabled());
|
||||
assertNotNull(plugin.extender);
|
||||
}
|
||||
|
||||
public void testIsNotPackageDistribution() {
|
||||
final SystemdPlugin plugin = new SystemdPlugin(false, randomNonPackageBuildType, Boolean.TRUE.toString());
|
||||
plugin.createComponents(null, null, threadPool, null, null, null, null, null, null, null);
|
||||
plugin.createComponents(null, null, threadPool, null, null, null, null, null, null, null, null);
|
||||
assertFalse(plugin.isEnabled());
|
||||
assertNull(plugin.extender);
|
||||
}
|
||||
|
||||
public void testIsImplicitlyNotEnabled() {
|
||||
final SystemdPlugin plugin = new SystemdPlugin(false, randomPackageBuildType, null);
|
||||
plugin.createComponents(null, null, threadPool, null, null, null, null, null, null, null);
|
||||
plugin.createComponents(null, null, threadPool, null, null, null, null, null, null, null, null);
|
||||
assertFalse(plugin.isEnabled());
|
||||
assertNull(plugin.extender);
|
||||
}
|
||||
|
||||
public void testIsExplicitlyNotEnabled() {
|
||||
final SystemdPlugin plugin = new SystemdPlugin(false, randomPackageBuildType, Boolean.FALSE.toString());
|
||||
plugin.createComponents(null, null, threadPool, null, null, null, null, null, null, null);
|
||||
plugin.createComponents(null, null, threadPool, null, null, null, null, null, null, null, null);
|
||||
assertFalse(plugin.isEnabled());
|
||||
assertNull(plugin.extender);
|
||||
}
|
||||
@ -181,7 +181,7 @@ public class SystemdPluginTests extends ESTestCase {
|
||||
}
|
||||
|
||||
};
|
||||
plugin.createComponents(null, null, threadPool, null, null, null, null, null, null, null);
|
||||
plugin.createComponents(null, null, threadPool, null, null, null, null, null, null, null, null);
|
||||
if (Boolean.TRUE.toString().equals(esSDNotify)) {
|
||||
assertNotNull(plugin.extender);
|
||||
} else {
|
||||
|
@ -51,6 +51,7 @@ import org.elasticsearch.index.query.TermsQueryBuilder;
|
||||
import org.elasticsearch.indices.TermsLookup;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestHeaderDefinition;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
@ -67,6 +68,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
@ -301,7 +303,8 @@ public class ContextAndHeaderTransportIT extends HttpSmokeTestCase {
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
loggingFilter.set(new LoggingFilter(threadPool));
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -477,10 +477,12 @@ public class Node implements Closeable {
|
||||
systemIndexDescriptors,
|
||||
forbidPrivateIndexSettings);
|
||||
|
||||
final SetOnce<RepositoriesService> repositoriesServiceReference = new SetOnce<>();
|
||||
Collection<Object> pluginComponents = pluginsService.filterPlugins(Plugin.class).stream()
|
||||
.flatMap(p -> p.createComponents(client, clusterService, threadPool, resourceWatcherService,
|
||||
scriptService, xContentRegistry, environment, nodeEnvironment,
|
||||
namedWriteableRegistry, clusterModule.getIndexNameExpressionResolver()).stream())
|
||||
namedWriteableRegistry, clusterModule.getIndexNameExpressionResolver(),
|
||||
repositoriesServiceReference::get).stream())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
ActionModule actionModule = new ActionModule(false, settings, clusterModule.getIndexNameExpressionResolver(),
|
||||
@ -517,6 +519,7 @@ public class Node implements Closeable {
|
||||
RepositoriesModule repositoriesModule = new RepositoriesModule(this.environment,
|
||||
pluginsService.filterPlugins(RepositoryPlugin.class), transportService, clusterService, threadPool, xContentRegistry);
|
||||
RepositoriesService repositoryService = repositoriesModule.getRepositoryService();
|
||||
repositoriesServiceReference.set(repositoryService);
|
||||
SnapshotsService snapshotsService = new SnapshotsService(settings, clusterService,
|
||||
clusterModule.getIndexNameExpressionResolver(), repositoryService, threadPool);
|
||||
SnapshotShardsService snapshotShardsService = new SnapshotShardsService(settings, clusterService, repositoryService,
|
||||
|
@ -39,6 +39,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.index.IndexModule;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.threadpool.ExecutorBuilder;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
@ -52,6 +53,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
/**
|
||||
@ -116,12 +118,15 @@ public abstract class Plugin implements Closeable {
|
||||
* @param nodeEnvironment the node environment used coordinate access to the data paths
|
||||
* @param namedWriteableRegistry the registry for {@link NamedWriteable} object parsing
|
||||
* @param indexNameExpressionResolver A service that resolves expression to index and alias names
|
||||
* @param repositoriesServiceSupplier A supplier for the service that manages snapshot repositories; will return null when this method
|
||||
* is called, but will return the repositories service once the node is initialized.
|
||||
*/
|
||||
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
@ -19,15 +19,14 @@
|
||||
|
||||
package org.elasticsearch.plugins;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.repositories.RepositoriesModule;
|
||||
import org.elasticsearch.repositories.Repository;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An extension point for {@link Plugin} implementations to add custom snapshot repositories.
|
||||
*/
|
||||
@ -60,12 +59,4 @@ public interface RepositoryPlugin {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes down the current {@link RepositoriesModule} to repository plugins.
|
||||
*
|
||||
* @param module the current {@link RepositoriesModule}
|
||||
*/
|
||||
default void onRepositoriesModule(RepositoriesModule module) {
|
||||
// NORELEASE
|
||||
}
|
||||
}
|
||||
|
@ -73,8 +73,6 @@ public final class RepositoriesModule {
|
||||
Map<String, Repository.Factory> internalRepositoryTypes = Collections.unmodifiableMap(internalFactories);
|
||||
repositoriesService = new RepositoriesService(settings, clusterService, transportService, repositoryTypes,
|
||||
internalRepositoryTypes, threadPool);
|
||||
|
||||
repoPlugins.forEach(rp -> rp.onRepositoriesModule(this));
|
||||
}
|
||||
|
||||
public RepositoriesService getRepositoryService() {
|
||||
|
@ -38,6 +38,7 @@ import org.elasticsearch.ingest.IngestDocument;
|
||||
import org.elasticsearch.ingest.Processor;
|
||||
import org.elasticsearch.plugins.IngestPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
@ -48,6 +49,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
@ -102,7 +104,8 @@ public class AsyncIngestProcessorIT extends ESSingleNodeTestCase {
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
this.threadPool = threadPool;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
@ -56,6 +57,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.gateway.GatewayService.STATE_NOT_RECOVERED_BLOCK;
|
||||
import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST;
|
||||
@ -224,7 +226,8 @@ public class ClusterStateIT extends ESIntegTestCase {
|
||||
final Environment environment,
|
||||
final NodeEnvironment nodeEnvironment,
|
||||
final NamedWriteableRegistry namedWriteableRegistry,
|
||||
final IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
final IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
final Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
clusterService.addListener(event -> {
|
||||
final ClusterState state = event.state();
|
||||
if (state.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK)) {
|
||||
|
@ -49,6 +49,7 @@ import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.plugins.ClusterPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.hamcrest.CollectionAssertions;
|
||||
@ -62,6 +63,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.gateway.GatewayService.STATE_NOT_RECOVERED_BLOCK;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
@ -383,7 +385,8 @@ public class SimpleClusterStateIT extends ESIntegTestCase {
|
||||
final Environment environment,
|
||||
final NodeEnvironment nodeEnvironment,
|
||||
final NamedWriteableRegistry namedWriteableRegistry,
|
||||
final IndexNameExpressionResolver expressionResolver) {
|
||||
final IndexNameExpressionResolver expressionResolver,
|
||||
final Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
clusterService.addListener(event -> {
|
||||
final ClusterState state = event.state();
|
||||
if (state.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK)) {
|
||||
|
@ -30,6 +30,7 @@ import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
@ -40,6 +41,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
@ -71,12 +73,13 @@ public class TemplateUpgradeServiceIT extends ESIntegTestCase {
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
clusterService.getClusterSettings().addSettingsUpdateConsumer(UPDATE_TEMPLATE_DUMMY_SETTING, integer -> {
|
||||
logger.debug("the template dummy setting was updated to {}", integer);
|
||||
});
|
||||
return super.createComponents(client, clusterService, threadPool, resourceWatcherService, scriptService, xContentRegistry,
|
||||
environment, nodeEnvironment, namedWriteableRegistry, expressionResolver);
|
||||
environment, nodeEnvironment, namedWriteableRegistry, expressionResolver, repositoriesServiceSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,6 +45,7 @@ import org.elasticsearch.ingest.PipelineConfiguration;
|
||||
import org.elasticsearch.ingest.Processor;
|
||||
import org.elasticsearch.plugins.IngestPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
@ -57,6 +58,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
@ -245,7 +247,8 @@ public class FinalPipelineIT extends ESIntegTestCase {
|
||||
final Environment environment,
|
||||
final NodeEnvironment nodeEnvironment,
|
||||
final NamedWriteableRegistry namedWriteableRegistry,
|
||||
final IndexNameExpressionResolver expressionResolver) {
|
||||
final IndexNameExpressionResolver expressionResolver,
|
||||
final Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.MapperPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.SearchPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.watcher.ResourceWatcherService;
|
||||
@ -54,6 +55,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
@ -137,7 +139,7 @@ public class AnalyticsPlugin extends Plugin implements SearchPlugin, ActionPlugi
|
||||
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService, NamedXContentRegistry xContentRegistry,
|
||||
Environment environment, NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
IndexNameExpressionResolver indexNameExpressionResolver, Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
return singletonList(usage);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -76,7 +77,8 @@ public final class AsyncSearch extends Plugin implements ActionPlugin {
|
||||
Environment environment,
|
||||
NodeEnvironment nodeEnvironment,
|
||||
NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
if (DiscoveryNode.isDataNode(environment.settings())) {
|
||||
// only data nodes should be eligible to run the maintenance service.
|
||||
AsyncSearchIndexService indexService =
|
||||
|
@ -40,6 +40,7 @@ import org.elasticsearch.plugins.EnginePlugin;
|
||||
import org.elasticsearch.plugins.PersistentTaskPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.RepositoryPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.repositories.Repository;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
@ -176,7 +177,8 @@ public class Ccr extends Plugin implements ActionPlugin, PersistentTaskPlugin, E
|
||||
final Environment environment,
|
||||
final NodeEnvironment nodeEnvironment,
|
||||
final NamedWriteableRegistry namedWriteableRegistry,
|
||||
final IndexNameExpressionResolver expressionResolver) {
|
||||
final IndexNameExpressionResolver expressionResolver,
|
||||
final Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
this.client = client;
|
||||
if (enabled == false) {
|
||||
return emptyList();
|
||||
|
@ -47,6 +47,7 @@ import org.elasticsearch.persistent.PersistentTaskParams;
|
||||
import org.elasticsearch.plugins.EnginePlugin;
|
||||
import org.elasticsearch.plugins.ExtensiblePlugin;
|
||||
import org.elasticsearch.plugins.RepositoryPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.repositories.Repository;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
@ -254,7 +255,8 @@ public class XPackPlugin extends XPackClientPlugin implements ExtensiblePlugin,
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
List<Object> components = new ArrayList<>();
|
||||
|
||||
final SSLService sslService = new SSLService(environment);
|
||||
|
@ -60,6 +60,7 @@ import org.elasticsearch.plugins.PersistentTaskPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.RepositoryPlugin;
|
||||
import org.elasticsearch.plugins.ScriptPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.repositories.Repository;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
@ -152,14 +153,15 @@ public class LocalStateCompositeXPackPlugin extends XPackPlugin implements Scrip
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
List<Object> components = new ArrayList<>();
|
||||
components.addAll(super.createComponents(client, clusterService, threadPool, resourceWatcherService, scriptService,
|
||||
xContentRegistry, environment, nodeEnvironment, namedWriteableRegistry, expressionResolver));
|
||||
xContentRegistry, environment, nodeEnvironment, namedWriteableRegistry, expressionResolver, repositoriesServiceSupplier));
|
||||
|
||||
filterPlugins(Plugin.class).stream().forEach(p ->
|
||||
components.addAll(p.createComponents(client, clusterService, threadPool, resourceWatcherService, scriptService,
|
||||
xContentRegistry, environment, nodeEnvironment, namedWriteableRegistry, expressionResolver))
|
||||
xContentRegistry, environment, nodeEnvironment, namedWriteableRegistry, expressionResolver, null))
|
||||
);
|
||||
return components;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import org.elasticsearch.license.XPackLicenseState;
|
||||
import org.elasticsearch.plugins.IngestPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.SystemIndexPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -199,7 +200,8 @@ public class EnrichPlugin extends Plugin implements SystemIndexPlugin, IngestPlu
|
||||
Environment environment,
|
||||
NodeEnvironment nodeEnvironment,
|
||||
NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier
|
||||
) {
|
||||
if (enabled == false || transportClientMode) {
|
||||
return emptyList();
|
||||
|
@ -25,6 +25,7 @@ import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.license.XPackLicenseState;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -80,7 +81,7 @@ public class EqlPlugin extends Plugin implements ActionPlugin {
|
||||
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService, NamedXContentRegistry xContentRegistry,
|
||||
Environment environment, NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver, Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
return createComponents(client, clusterService.getClusterName().value(), namedWriteableRegistry);
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.license.XPackLicenseState;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -86,7 +87,8 @@ public class IdentityProviderPlugin extends Plugin implements ActionPlugin {
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
settings = environment.settings();
|
||||
enabled = ENABLED_SETTING.get(settings);
|
||||
if (enabled == false) {
|
||||
|
@ -31,6 +31,7 @@ import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.index.IndexModule;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -190,7 +191,8 @@ public class IndexLifecycle extends Plugin implements ActionPlugin {
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
if (transportClientMode) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.index.IndexModule;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
@ -35,6 +36,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.xpack.ilm.UpdateSettingsStepTests.SettingsTestingService.INVALID_VALUE;
|
||||
@ -61,7 +63,8 @@ public class UpdateSettingsStepTests extends ESSingleNodeTestCase {
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
return Collections.singletonList(service);
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ import org.elasticsearch.plugins.IngestPlugin;
|
||||
import org.elasticsearch.plugins.PersistentTaskPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.SystemIndexPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -518,7 +519,8 @@ public class MachineLearning extends Plugin implements SystemIndexPlugin, Analys
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
if (enabled == false || transportClientMode) {
|
||||
// special holder for @link(MachineLearningFeatureSetUsage) which needs access to job manager, empty if ML is disabled
|
||||
return singletonList(new JobManagerHolder());
|
||||
|
@ -27,6 +27,7 @@ import org.elasticsearch.license.XPackLicenseState;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.ReloadablePlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -126,7 +127,8 @@ public class Monitoring extends Plugin implements ActionPlugin, ReloadablePlugin
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
if (enabled == false) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import org.elasticsearch.persistent.PersistentTasksExecutor;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.PersistentTaskPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -110,7 +111,8 @@ public class Rollup extends Plugin implements ActionPlugin, PersistentTaskPlugin
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
return emptyList();
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,6 @@ import org.elasticsearch.plugins.ClusterPlugin;
|
||||
import org.elasticsearch.plugins.EnginePlugin;
|
||||
import org.elasticsearch.plugins.IndexStorePlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.RepositoryPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesModule;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
@ -75,7 +73,7 @@ import static org.elasticsearch.index.IndexModule.INDEX_STORE_TYPE_SETTING;
|
||||
/**
|
||||
* Plugin for Searchable Snapshots feature
|
||||
*/
|
||||
public class SearchableSnapshots extends Plugin implements IndexStorePlugin, RepositoryPlugin, EnginePlugin, ActionPlugin, ClusterPlugin {
|
||||
public class SearchableSnapshots extends Plugin implements IndexStorePlugin, EnginePlugin, ActionPlugin, ClusterPlugin {
|
||||
|
||||
private static final boolean SEARCHABLE_SNAPSHOTS_FEATURE_ENABLED;
|
||||
|
||||
@ -136,13 +134,11 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
|
||||
|
||||
public static final String SNAPSHOT_DIRECTORY_FACTORY_KEY = "snapshot";
|
||||
|
||||
private final SetOnce<RepositoriesService> repositoriesService;
|
||||
private final SetOnce<CacheService> cacheService;
|
||||
private volatile Supplier<RepositoriesService> repositoriesServiceSupplier;
|
||||
private final SetOnce<CacheService> cacheService = new SetOnce<>();
|
||||
private final Settings settings;
|
||||
|
||||
public SearchableSnapshots(final Settings settings) {
|
||||
this.repositoriesService = new SetOnce<>();
|
||||
this.cacheService = new SetOnce<>();
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@ -182,23 +178,23 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
|
||||
final Environment environment,
|
||||
final NodeEnvironment nodeEnvironment,
|
||||
final NamedWriteableRegistry registry,
|
||||
final IndexNameExpressionResolver resolver
|
||||
final IndexNameExpressionResolver resolver,
|
||||
final Supplier<RepositoriesService> repositoriesServiceSupplier
|
||||
) {
|
||||
if (SEARCHABLE_SNAPSHOTS_FEATURE_ENABLED) {
|
||||
final CacheService cacheService = new CacheService(settings);
|
||||
this.cacheService.set(cacheService);
|
||||
this.repositoriesServiceSupplier = repositoriesServiceSupplier;
|
||||
return org.elasticsearch.common.collect.List.of(cacheService);
|
||||
} else {
|
||||
this.repositoriesServiceSupplier = () -> {
|
||||
assert false : "searchable snapshots are disabled";
|
||||
return null;
|
||||
};
|
||||
return org.elasticsearch.common.collect.List.of();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRepositoriesModule(RepositoriesModule repositoriesModule) {
|
||||
// TODO NORELEASE should we use some SPI mechanism? The only reason we are a RepositoriesPlugin is because of this :/
|
||||
repositoriesService.set(repositoriesModule.getRepositoryService());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIndexModule(IndexModule indexModule) {
|
||||
if (SEARCHABLE_SNAPSHOTS_FEATURE_ENABLED && isSearchableSnapshotStore(indexModule.getSettings())) {
|
||||
@ -210,7 +206,7 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
|
||||
public Map<String, DirectoryFactory> getDirectoryFactories() {
|
||||
if (SEARCHABLE_SNAPSHOTS_FEATURE_ENABLED) {
|
||||
return org.elasticsearch.common.collect.Map.of(SNAPSHOT_DIRECTORY_FACTORY_KEY, (indexSettings, shardPath) -> {
|
||||
final RepositoriesService repositories = repositoriesService.get();
|
||||
final RepositoriesService repositories = repositoriesServiceSupplier.get();
|
||||
assert repositories != null;
|
||||
final CacheService cache = cacheService.get();
|
||||
assert cache != null;
|
||||
|
@ -58,6 +58,7 @@ import org.elasticsearch.plugins.MapperPlugin;
|
||||
import org.elasticsearch.plugins.NetworkPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.SystemIndexPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.rest.RestHeaderDefinition;
|
||||
@ -380,7 +381,8 @@ public class Security extends Plugin implements SystemIndexPlugin, IngestPlugin,
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
try {
|
||||
return createComponents(client, threadPool, clusterService, resourceWatcherService, scriptService, xContentRegistry,
|
||||
environment, expressionResolver);
|
||||
|
@ -24,6 +24,7 @@ import org.elasticsearch.license.LicenseUtils;
|
||||
import org.elasticsearch.license.XPackLicenseState;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -89,7 +90,8 @@ public class SqlPlugin extends Plugin implements ActionPlugin {
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
|
||||
return createComponents(client, clusterService.getClusterName().value(), namedWriteableRegistry);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ import org.elasticsearch.persistent.PersistentTasksExecutor;
|
||||
import org.elasticsearch.plugins.PersistentTaskPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.SystemIndexPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -285,7 +286,8 @@ public class Transform extends Plugin implements SystemIndexPlugin, PersistentTa
|
||||
Environment environment,
|
||||
NodeEnvironment nodeEnvironment,
|
||||
NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier
|
||||
) {
|
||||
if (enabled == false || transportClientMode) {
|
||||
return emptyList();
|
||||
|
@ -29,6 +29,7 @@ import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.DiscoveryPlugin;
|
||||
import org.elasticsearch.plugins.NetworkPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.Transport;
|
||||
@ -104,7 +105,8 @@ public class VotingOnlyNodePlugin extends Plugin implements DiscoveryPlugin, Net
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
this.threadPool.set(threadPool);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.ReloadablePlugin;
|
||||
import org.elasticsearch.plugins.ScriptPlugin;
|
||||
import org.elasticsearch.plugins.SystemIndexPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.script.ScriptContext;
|
||||
@ -254,7 +255,8 @@ public class Watcher extends Plugin implements SystemIndexPlugin, ScriptPlugin,
|
||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
|
||||
IndexNameExpressionResolver expressionResolver) {
|
||||
IndexNameExpressionResolver expressionResolver,
|
||||
Supplier<RepositoriesService> repositoriesServiceSupplier) {
|
||||
if (enabled == false) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class WatcherPluginTests extends ESTestCase {
|
||||
watcher.onIndexModule(indexModule);
|
||||
|
||||
// also no component creation if not enabled
|
||||
assertThat(watcher.createComponents(null, null, null, null, null, null, null, null, null, null), hasSize(0));
|
||||
assertThat(watcher.createComponents(null, null, null, null, null, null, null, null, null, null, null), hasSize(0));
|
||||
|
||||
watcher.close();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user