浏览代码

Disable ML on Darwin aarch64 (#68068)

Until we have ML binaries available for darwin/aarch64, make sure ML is
disabled and stays disabled.
Rory Hunter 4 年之前
父节点
当前提交
e0ff6e3c46
共有 1 个文件被更改,包括 15 次插入2 次删除
  1. 15 2
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java

+ 15 - 2
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java

@@ -32,6 +32,12 @@ import static org.elasticsearch.xpack.core.security.SecurityField.USER_SETTING;
  * A container for xpack setting constants.
  */
 public class XPackSettings {
+    private static final boolean IS_DARWIN_AARCH64;
+    static {
+        final String name = System.getProperty("os.name");
+        final String arch = System.getProperty("os.arch");
+        IS_DARWIN_AARCH64 = "aarch64".equals(arch) && name.startsWith("Mac OS X");
+    }
 
     private XPackSettings() {
         throw new IllegalStateException("Utility class should not be instantiated");
@@ -52,8 +58,15 @@ public class XPackSettings {
     public static final Setting<Boolean> GRAPH_ENABLED = Setting.boolSetting("xpack.graph.enabled", true, Setting.Property.NodeScope);
 
     /** Setting for enabling or disabling machine learning. Defaults to true. */
-    public static final Setting<Boolean> MACHINE_LEARNING_ENABLED = Setting.boolSetting("xpack.ml.enabled", true,
-            Setting.Property.NodeScope);
+    public static final Setting<Boolean> MACHINE_LEARNING_ENABLED = Setting.boolSetting(
+        "xpack.ml.enabled",
+        IS_DARWIN_AARCH64 == false,
+        value -> {
+            if (value && IS_DARWIN_AARCH64) {
+                throw new IllegalArgumentException("[xpack.ml.enabled] can not be set to [true] on [Mac OS X/aarch64]");
+            }
+        },
+        Setting.Property.NodeScope);
 
     /** Setting for enabling or disabling auditing. Defaults to false. */
     public static final Setting<Boolean> AUDIT_ENABLED = Setting.boolSetting("xpack.security.audit.enabled", false,