diff options
-rw-r--r-- | .cirrus.yml | 1 | ||||
-rw-r--r-- | build.gradle | 1 | ||||
-rw-r--r-- | server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java | 6 | ||||
-rw-r--r-- | server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java | 9 |
4 files changed, 17 insertions, 0 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index 726e599d14a..add219db648 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -151,6 +151,7 @@ qa_task: QA_CATEGORY: License QA_CATEGORY: Branch QA_CATEGORY: Upgrade + QA_CATEGORY: HA gradle_cache: folder: ~/.gradle/caches script: diff --git a/build.gradle b/build.gradle index 4ec096cfad8..5b706509e54 100644 --- a/build.gradle +++ b/build.gradle @@ -160,6 +160,7 @@ subprojects { dependency 'junit:junit:4.12' dependency 'mysql:mysql-connector-java:5.1.46' dependency 'net.jpountz.lz4:lz4:1.3.0' + dependency 'org.awaitility:awaitility:3.1.6' dependency 'org.apache.commons:commons-csv:1.4' dependency 'org.apache.commons:commons-email:1.5' dependency 'org.apache.commons:commons-dbcp2:2.5.0' diff --git a/server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java b/server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java index 8f68f21b661..dfd86373c63 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java +++ b/server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java @@ -45,6 +45,7 @@ public class EsSettings { private static final Logger LOGGER = LoggerFactory.getLogger(EsSettings.class); private static final String STANDALONE_NODE_NAME = "sonarqube"; private static final String SECCOMP_PROPERTY = "bootstrap.system_call_filter"; + private static final String ALLOW_MMAP = "node.store.allow_mmapfs"; private final Props props; private final EsInstallation fileSystem; @@ -151,5 +152,10 @@ public class EsSettings { if (props.value("sonar.search.javaAdditionalOpts", "").contains("-D" + SECCOMP_PROPERTY + "=false")) { builder.put(SECCOMP_PROPERTY, "false"); } + + // to be used with HA QA, where we can't easily set mmap size when running with docker. + if (props.value("sonar.search.javaAdditionalOpts", "").contains("-D" + ALLOW_MMAP + "=false")) { + builder.put(ALLOW_MMAP, "false"); + } } } diff --git a/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java index b859dfd9881..ff579a32d45 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java @@ -330,6 +330,15 @@ public class EsSettingsTest { assertThat(settings.get("bootstrap.system_call_filter")).isEqualTo("false"); } + @Test + public void disable_mmap_if_configured_in_search_additional_props() throws Exception { + Props props = minProps(CLUSTER_DISABLED); + props.set("sonar.search.javaAdditionalOpts", "-Dnode.store.allow_mmapfs=false"); + Map<String, String> settings = new EsSettings(props, new EsInstallation(props), System2.INSTANCE).build(); + + assertThat(settings.get("node.store.allow_mmapfs")).isEqualTo("false"); + } + private Props minProps(boolean cluster) throws IOException { File homeDir = temp.newFolder(); Props props = new Props(new Properties()); |