[ML] Disable ml in case a node is a tribe node and

in case of tribe node client do not even bother to check for native process version, because it isn't running.

Original commit: elastic/x-pack-elasticsearch@e6fdd5e82a
This commit is contained in:
Martijn van Groningen 2017-02-28 21:31:09 +01:00
parent 6783f823a8
commit 9d6c344520
2 changed files with 10 additions and 6 deletions

View File

@ -160,6 +160,8 @@ public class MachineLearning extends Plugin implements ActionPlugin {
private final Environment env;
private boolean enabled;
private boolean transportClientMode;
private final boolean tribeNode;
private final boolean tribeNodeClient;
public MachineLearning(Settings settings) {
this(settings, new Environment(settings));
@ -170,6 +172,8 @@ public class MachineLearning extends Plugin implements ActionPlugin {
this.settings = settings;
this.env = env;
this.transportClientMode = XPackPlugin.transportClientMode(settings);
this.tribeNode = XPackPlugin.isTribeNode(settings);
this.tribeNodeClient = XPackPlugin.isTribeClientNode(settings);
}
@Override
@ -187,7 +191,7 @@ public class MachineLearning extends Plugin implements ActionPlugin {
@Override
public Settings additionalSettings() {
if (enabled == false || this.transportClientMode) {
if (enabled == false || this.transportClientMode || this.tribeNode || this.tribeNodeClient) {
return super.additionalSettings();
}
@ -248,7 +252,7 @@ public class MachineLearning extends Plugin implements ActionPlugin {
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
NamedXContentRegistry xContentRegistry) {
if (this.transportClientMode) {
if (this.transportClientMode || this.tribeNodeClient) {
return emptyList();
}
@ -257,7 +261,7 @@ public class MachineLearning extends Plugin implements ActionPlugin {
// Even when ML is disabled the native controller will be running if it's installed, and it
// prevents graceful shutdown on Windows unless we tell it to stop. Hence when disabled we
// still return a lifecycle service that will tell the native controller to stop.
if (false == enabled) {
if (false == enabled || this.tribeNode) {
return Collections.singletonList(mlLifeCycleService);
}
@ -330,7 +334,7 @@ public class MachineLearning extends Plugin implements ActionPlugin {
IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
IndexNameExpressionResolver indexNameExpressionResolver,
Supplier<DiscoveryNodes> nodesInCluster) {
if (false == enabled) {
if (false == enabled || tribeNodeClient) {
return emptyList();
}
return Arrays.asList(
@ -415,7 +419,7 @@ public class MachineLearning extends Plugin implements ActionPlugin {
@Override
public List<ExecutorBuilder<?>> getExecutorBuilders(Settings settings) {
if (false == enabled) {
if (false == enabled || tribeNode || tribeNodeClient) {
return emptyList();
}
int maxNumberOfJobs = AutodetectProcessManager.MAX_RUNNING_JOBS_PER_NODE.get(settings);

View File

@ -34,7 +34,7 @@ public class MachineLearningFeatureSet implements XPackFeatureSet {
this.licenseState = licenseState;
Map<String, Object> nativeCodeInfo = NativeController.UNKNOWN_NATIVE_CODE_INFO;
// Don't try to get the native code version in the transport client - the controller process won't be running
if (XPackPlugin.transportClientMode(settings) == false) {
if (XPackPlugin.transportClientMode(settings) == false && XPackPlugin.isTribeClientNode(settings) == false) {
try {
NativeController nativeController = NativeControllerHolder.getNativeController(settings);
if (nativeController != null) {