Don't try to get the native code version in the transport client (elastic/x-pack-elasticsearch#600)

The native controller process won't be running

Original commit: elastic/x-pack-elasticsearch@d848e86cd5
This commit is contained in:
David Roberts 2017-02-20 10:56:20 +00:00 committed by GitHub
parent 4b1ed5b453
commit 5233ab9831
1 changed files with 13 additions and 10 deletions

View File

@ -33,16 +33,19 @@ public class MachineLearningFeatureSet implements XPackFeatureSet {
this.enabled = XPackSettings.MACHINE_LEARNING_ENABLED.get(settings); this.enabled = XPackSettings.MACHINE_LEARNING_ENABLED.get(settings);
this.licenseState = licenseState; this.licenseState = licenseState;
Map<String, Object> nativeCodeInfo = NativeController.UNKNOWN_NATIVE_CODE_INFO; Map<String, Object> nativeCodeInfo = NativeController.UNKNOWN_NATIVE_CODE_INFO;
try { // Don't try to get the native code version in the transport client - the controller process won't be running
NativeController nativeController = NativeControllerHolder.getNativeController(settings); if (XPackPlugin.transportClientMode(settings) == false) {
if (nativeController != null) { try {
nativeCodeInfo = nativeController.getNativeCodeInfo(); NativeController nativeController = NativeControllerHolder.getNativeController(settings);
} if (nativeController != null) {
} catch (IOException | TimeoutException e) { nativeCodeInfo = nativeController.getNativeCodeInfo();
Loggers.getLogger(MachineLearningFeatureSet.class).error("Cannot get native code info for Machine Learning", e); }
if (enabled) { } catch (IOException | TimeoutException e) {
throw new ElasticsearchException("Cannot communicate with Machine Learning native code " Loggers.getLogger(MachineLearningFeatureSet.class).error("Cannot get native code info for Machine Learning", e);
+ "- please check that you are running on a supported platform"); if (enabled) {
throw new ElasticsearchException("Cannot communicate with Machine Learning native code "
+ "- please check that you are running on a supported platform");
}
} }
} }
this.nativeCodeInfo = nativeCodeInfo; this.nativeCodeInfo = nativeCodeInfo;