You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2017/12/11 03:29:47 UTC
asterixdb git commit: [NO ISSUE] Fix duplicate -Xmx args being passed
Repository: asterixdb
Updated Branches:
refs/heads/master dd1289c72 -> ab36948a6
[NO ISSUE] Fix duplicate -Xmx args being passed
The -Xmx override was looking for " -Xmx" instead of "-Xmx".
Added a test to stop regression.
Change-Id: I7e59be72fcc9aea3c315c2cee5339c1c7573ef51
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2206
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mb...@apache.org>
Tested-by: Michael Blow <mb...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/ab36948a
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/ab36948a
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/ab36948a
Branch: refs/heads/master
Commit: ab36948a69037b8f9732da6c2b11bc43a1aa7703
Parents: dd1289c
Author: Ian Maxon <im...@apache.org>
Authored: Sun Dec 10 18:15:15 2017 -0800
Committer: Michael Blow <mb...@apache.org>
Committed: Sun Dec 10 19:29:31 2017 -0800
----------------------------------------------------------------------
.../test/resources/NCServiceExecutionIT/cc.conf | 2 +-
.../hyracks/control/nc/service/NCService.java | 4 +-
.../hyracks/hyracks-server/pom.xml | 9 +--
.../apache/hyracks/server/test/NCServiceIT.java | 63 +++++++++++---------
.../src/test/resources/NCServiceIT/cc.conf | 1 +
5 files changed, 43 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ab36948a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf b/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
index a6cb064..fd7e268 100644
--- a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
+++ b/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
@@ -34,7 +34,7 @@ nc.api.port=19005
address=127.0.0.1
command=asterixnc
app.class=org.apache.asterix.hyracks.bootstrap.NCApplication
-jvm.args=-Xmx4096m -Dnode.Resolver="org.apache.asterix.external.util.IdentitiyResolverFactory"
+jvm.args=-Xmx4g -Dnode.Resolver="org.apache.asterix.external.util.IdentitiyResolverFactory"
storage.subdir=test_storage
storage.memorycomponent.globalbudget = 1073741824
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ab36948a/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java
index 9da3502..c0e5678 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java
@@ -131,15 +131,15 @@ public class NCService {
}
// Sets up memory parameter if it is not specified.
- if (!jvmargs.contains(" -Xmx")) {
+ if (!jvmargs.contains("-Xmx")) {
long ramSize = ((com.sun.management.OperatingSystemMXBean) osMXBean).getTotalPhysicalMemorySize();
int proportionalRamSize = (int) Math.ceil(0.6 * ramSize / (1024 * 1024));
//if under 32bit JVM, use less than 1GB heap by default. otherwise use proportional ramsize.
int heapSize = "32".equals(System.getProperty("sun.arch.data.model"))
? (proportionalRamSize <= 1024 ? proportionalRamSize : 1024) : proportionalRamSize;
jvmargs = jvmargs + " -Xmx" + heapSize + "m";
- env.put("JAVA_OPTS", jvmargs.trim());
}
+ env.put("JAVA_OPTS", jvmargs.trim());
LOGGER.info("Setting JAVA_OPTS to " + jvmargs);
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ab36948a/hyracks-fullstack/hyracks/hyracks-server/pom.xml
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-server/pom.xml b/hyracks-fullstack/hyracks/hyracks-server/pom.xml
index 68639ae..8ad94e3 100644
--- a/hyracks-fullstack/hyracks/hyracks-server/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-server/pom.xml
@@ -150,6 +150,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.hyracks</groupId>
+ <artifactId>hyracks-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
@@ -163,10 +168,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.hyracks</groupId>
<artifactId>hyracks-control-nc</artifactId>
<version>${project.version}</version>
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ab36948a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java
index fda099e..c3bdb2a 100644
--- a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java
+++ b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java
@@ -21,10 +21,12 @@ package org.apache.hyracks.server.test;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
+import java.util.Iterator;
import java.util.logging.Logger;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
import junit.framework.Assert;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
@@ -34,20 +36,17 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.hyracks.server.process.HyracksVirtualCluster;
+import org.apache.hyracks.util.file.FileUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class NCServiceIT {
- private static final String TARGET_DIR = StringUtils
- .join(new String[] { ".", "target" }, File.separator);
- private static final String LOG_DIR = StringUtils
- .join(new String[] { TARGET_DIR, "failsafe-reports" }, File.separator);
- private static final String RESOURCE_DIR = StringUtils
- .join(new String[] { TARGET_DIR, "test-classes", "NCServiceIT" }, File.separator);
- private static final String APP_HOME = StringUtils
- .join(new String[] { TARGET_DIR, "appassembler" }, File.separator);
+ private static final String TARGET_DIR = FileUtil.joinPath(".", "target");
+ private static final String LOG_DIR = FileUtil.joinPath(TARGET_DIR, "failsafe-reports");
+ private static final String RESOURCE_DIR = FileUtil.joinPath(TARGET_DIR, "test-classes", "NCServiceIT");
+ private static final String APP_HOME = FileUtil.joinPath(TARGET_DIR, "appassembler");
private static final Logger LOGGER = Logger.getLogger(NCServiceIT.class.getName());
private static HyracksVirtualCluster cluster = null;
@@ -55,31 +54,20 @@ public class NCServiceIT {
@BeforeClass
public static void setUp() throws Exception {
cluster = new HyracksVirtualCluster(new File(APP_HOME), null);
- cluster.addNCService(
- new File(RESOURCE_DIR, "nc-red.conf"),
- new File(LOG_DIR, "nc-red.log")
- );
- cluster.addNCService(
- new File(RESOURCE_DIR, "nc-blue.conf"),
- new File(LOG_DIR, "nc-blue.log")
- );
+ cluster.addNCService(new File(RESOURCE_DIR, "nc-red.conf"), new File(LOG_DIR, "nc-red.log"));
+ cluster.addNCService(new File(RESOURCE_DIR, "nc-blue.conf"), new File(LOG_DIR, "nc-blue.log"));
try {
Thread.sleep(2000);
- }
- catch (InterruptedException ignored) {
+ } catch (InterruptedException ignored) {
}
// Start CC
- cluster.start(
- new File(RESOURCE_DIR, "cc.conf"),
- new File(LOG_DIR, "cc.log")
- );
+ cluster.start(new File(RESOURCE_DIR, "cc.conf"), new File(LOG_DIR, "cc.log"));
try {
Thread.sleep(10000);
- }
- catch (InterruptedException ignored) {
+ } catch (InterruptedException ignored) {
}
}
@@ -108,15 +96,20 @@ public class NCServiceIT {
}
}
- @Test
- public void IsNodelistCorrect() throws Exception {
- // Ping the nodelist HTTP API
-
+ private JsonNode getEndpoint(String endpoint) throws Exception {
ObjectMapper om = new ObjectMapper();
String localhost = InetAddress.getLoopbackAddress().getHostAddress();
- String response = getHttp("http://" + localhost + ":12345/rest/nodes");
+ String response = getHttp("http://" + localhost + ":12345" + endpoint);
JsonNode result = om.readTree(response);
JsonNode nodes = result.get("result");
+ return nodes;
+ }
+
+ @Test
+ public void IsNodelistCorrect() throws Exception {
+ // Ping the nodelist HTTP API
+
+ JsonNode nodes = getEndpoint("/rest/nodes");
int numNodes = nodes.size();
Assert.assertEquals("Wrong number of nodes!", 2, numNodes);
for (int i = 0; i < nodes.size(); i++) {
@@ -129,6 +122,18 @@ public class NCServiceIT {
}
}
+ @Test
+ public void isXmxOverrideCorrect() throws Exception {
+ ArrayNode inputArgs = (ArrayNode) getEndpoint("/rest/nodes/red").get("input-arguments");
+ for (Iterator<JsonNode> it = inputArgs.elements(); it.hasNext();) {
+ String s = it.next().asText();
+ if (s.startsWith("-Xmx") && s.endsWith("m")) {
+ String digits = s.substring(4, 8);
+ Assert.assertEquals("1234", digits);
+ }
+ }
+ }
+
public static void main(String[] args) throws Exception {
try {
setUp();
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ab36948a/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/cc.conf
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/cc.conf b/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/cc.conf
index 69676f7..419b8ca 100644
--- a/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/cc.conf
+++ b/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/cc.conf
@@ -18,6 +18,7 @@
[nc/red]
address = 127.0.0.1
#jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006
+jvm.args= -Xmx1234m
[nc/blue]
address = 127.0.0.1