Michael Blow has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/3311
Change subject: [NO ISSUE] Fix logging for ncservice-based tests
......................................................................
[NO ISSUE] Fix logging for ncservice-based tests
Change-Id: Id264aede0f62558ad6e34355047c623a1d594692
---
M
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/HDFSCluster.java
M
asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/AbstractExecutionIT.java
M
asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/NCServiceExecutionIT.java
M
asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/NcLifecycleIT.java
M
asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/RecoveryIT.java
M
asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/ReplicationIT.java
M asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
M
asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/ncservice1.conf
M
asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/ncservice2.conf
M asterixdb/asterix-server/src/test/resources/NcLifecycleIT/cc.conf
M asterixdb/asterix-server/src/test/resources/NcLifecycleIT/ncservice1.conf
M asterixdb/asterix-server/src/test/resources/NcLifecycleIT/ncservice2.conf
M asterixdb/asterix-server/src/test/resources/ReplicationIT/cc.conf
M asterixdb/asterix-server/src/test/resources/ReplicationIT/ncservice1.conf
M asterixdb/asterix-server/src/test/resources/ReplicationIT/ncservice2.conf
M asterixdb/pom.xml
M
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/CCLogConfigurationFactory.java
M
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/NodeControllerData.java
M
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NodeRegistration.java
R
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/resources/log4j2.xml
M
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCLogConfigurationFactory.java
M
hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/NCServiceIT.java
M
hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksCCProcess.java
M
hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksNCServiceProcess.java
M
hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksServerProcess.java
M
hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksVirtualCluster.java
M
hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/cc.conf
M
hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/nc-blue.conf
M
hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/nc-red.conf
M
hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/PidHelper.java
M
hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Event.java
M
hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Tracer.java
32 files changed, 242 insertions(+), 190 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/11/3311/1
diff --git
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/HDFSCluster.java
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/HDFSCluster.java
index a89304a..c0b4841 100644
---
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/HDFSCluster.java
+++
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/HDFSCluster.java
@@ -59,17 +59,18 @@
/**
* Instantiates the (Mini) DFS Cluster with the configured number of
datanodes.
- * Post instantiation, data is laoded to HDFS.
+ * Post instantiation, data is loaded to HDFS.
* Called prior to running the Runtime test suite.
*/
public void setup() throws Exception {
- setup("");
+ setup(new File("."));
}
- public void setup(String basePath) throws Exception {
- conf.addResource(new Path(basePath + PATH_TO_HADOOP_CONF +
"/core-site.xml"));
- conf.addResource(new Path(basePath + PATH_TO_HADOOP_CONF +
"/mapred-site.xml"));
- conf.addResource(new Path(basePath + PATH_TO_HADOOP_CONF +
"/hdfs-site.xml"));
+ public void setup(File basePath) throws Exception {
+ File hadoopConfDir = new File(basePath, PATH_TO_HADOOP_CONF);
+ conf.addResource(new Path(new File(hadoopConfDir,
"core-site.xml").getPath()));
+ conf.addResource(new Path(new File(hadoopConfDir,
"mapred-site.xml").getPath()));
+ conf.addResource(new Path(new File(hadoopConfDir,
"hdfs-site.xml").getPath()));
cleanupLocal();
conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, MINIDFS_BASEDIR);
MiniDFSCluster.Builder build = new MiniDFSCluster.Builder(conf);
@@ -81,10 +82,10 @@
loadData(basePath);
}
- private void loadData(String localDataRoot) throws IOException {
+ private void loadData(File localDataRoot) throws IOException {
Path destDir = new Path(HDFS_PATH);
dfs.mkdirs(destDir);
- File srcDir = new File(localDataRoot + DATA_PATH);
+ File srcDir = new File(localDataRoot, DATA_PATH);
if (srcDir.exists()) {
File[] listOfFiles = srcDir.listFiles();
for (File srcFile : listOfFiles) {
diff --git
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/AbstractExecutionIT.java
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/AbstractExecutionIT.java
index 1a2f9ba..35bf7e4 100644
---
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/AbstractExecutionIT.java
+++
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/AbstractExecutionIT.java
@@ -14,12 +14,15 @@
*/
package org.apache.asterix.test.server;
+import static org.apache.asterix.test.server.NCServiceExecutionIT.APP_HOME;
+import static
org.apache.asterix.test.server.NCServiceExecutionIT.ASTERIX_APP_DIR;
import static org.apache.hyracks.util.file.FileUtil.joinPath;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.external.util.ExternalDataConstants;
import org.apache.asterix.external.util.IdentitiyResolverFactory;
@@ -29,7 +32,6 @@
import org.apache.asterix.testframework.context.TestFileContext;
import org.apache.asterix.testframework.xml.TestCase.CompilationUnit;
import org.apache.asterix.testframework.xml.TestGroup;
-import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.codehaus.plexus.util.FileUtils;
@@ -75,20 +77,18 @@
File outdir = new File(PATH_ACTUAL);
outdir.mkdirs();
- File externalTestsJar =
- new File(StringUtils.join(new String[] { "..",
"asterix-external-data", "target" }, File.separator))
- .listFiles((dir, name) ->
name.matches("asterix-external-data-.*-tests.jar"))[0];
+ File externalTestsJar = Objects.requireNonNull(new File(joinPath("..",
"asterix-external-data", "target"))
+ .listFiles((dir, name) ->
name.matches("asterix-external-data-.*-tests.jar")))[0];
- FileUtils.copyFile(externalTestsJar,
- new File(NCServiceExecutionIT.APP_HOME + "/repo",
externalTestsJar.getName()));
+ FileUtils.copyFile(externalTestsJar, new File(APP_HOME,
joinPath("repo", externalTestsJar.getName())));
NCServiceExecutionIT.setUp();
FileUtils.copyDirectoryStructure(new File(joinPath("..",
"asterix-app", "data")),
- new File(NCServiceExecutionIT.ASTERIX_APP_DIR +
"/clusters/local/working_dir/data"));
+ new File(ASTERIX_APP_DIR, joinPath("clusters", "local",
"working_dir", "data")));
FileUtils.copyDirectoryStructure(new File(joinPath("..",
"asterix-app", "target", "data")),
- new File(NCServiceExecutionIT.ASTERIX_APP_DIR +
"/clusters/local/working_dir/target/data"));
+ new File(ASTERIX_APP_DIR, joinPath("clusters", "local",
"working_dir", "target", "data")));
// Set the node resolver to be the identity resolver that expects node
names
// to be node controller ids; a valid assumption in test environment.
diff --git
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/NCServiceExecutionIT.java
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/NCServiceExecutionIT.java
index 64506f5..492e2b1 100644
---
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/NCServiceExecutionIT.java
+++
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/NCServiceExecutionIT.java
@@ -18,6 +18,8 @@
*/
package org.apache.asterix.test.server;
+import static org.apache.hyracks.util.file.FileUtil.joinPath;
+
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
@@ -30,7 +32,6 @@
import org.apache.asterix.testframework.context.TestCaseContext;
import org.apache.asterix.testframework.xml.TestGroup;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
import org.apache.hyracks.test.server.process.HyracksCCProcess;
import org.apache.hyracks.test.server.process.HyracksNCServiceProcess;
import org.apache.hyracks.test.server.process.HyracksVirtualCluster;
@@ -55,42 +56,41 @@
// Important paths and files for this test.
// The "target" subdirectory of asterix-server. All outputs go here.
- public static final String TARGET_DIR =
- StringUtils.join(new String[] { "../asterix-server/target" },
File.separator);
+ public static final String TARGET_DIR = joinPath("..", "asterix-server",
"target");
// Directory where the NCs create and store all data, as configured by
// src/test/resources/NCServiceExecutionIT/cc.conf.
- public static final String INSTANCE_DIR = StringUtils.join(new String[] {
TARGET_DIR, "tmp" }, File.separator);
+ public static final String INSTANCE_DIR = joinPath(TARGET_DIR, "tmp");
// The log directory, where all CC, NCService, and NC logs are written. CC
and
// NCService logs are configured on the HyracksVirtualCluster below. NC
logs
// are configured in
src/test/resources/NCServiceExecutionIT/ncservice*.conf.
- public static final String LOG_DIR =
- StringUtils.join(new String[] { TARGET_DIR, "failsafe-reports" },
File.separator);
+ public static final String LOG_DIR = joinPath(TARGET_DIR,
"failsafe-reports");
// Directory where *.conf files are located.
- public static final String CONF_DIR =
- StringUtils.join(new String[] { TARGET_DIR, "test-classes",
"NCServiceExecutionIT" }, File.separator);
+ public static final String CONF_DIR = joinPath(TARGET_DIR, "test-classes",
"NCServiceExecutionIT");
// The app.home specified for HyracksVirtualCluster. The NCService expects
// to find the NC startup script in ${app.home}/bin.
- public static final String APP_HOME = StringUtils.join(new String[] {
TARGET_DIR, "appassembler" }, File.separator);
+ public static final File APP_HOME = new File(TARGET_DIR, "appassembler");
// Path to the asterix-app directory. This is used as the current working
// directory for the CC and NCService processes, which allows relative file
// paths in "load" statements in test queries to find the right data. It is
// also used for HDFSCluster.
- public static final String ASTERIX_APP_DIR = StringUtils.join(new String[]
{ "..", "asterix-app" }, File.separator);
+ public static final File ASTERIX_APP_DIR = new File(joinPath("..",
"asterix-app"));
// Path to the actual AQL test files, which we borrow from asterix-app.
This is
// passed to TestExecutor.
- protected static final String TESTS_DIR =
- StringUtils.join(new String[] { ASTERIX_APP_DIR, "src", "test",
"resources", "runtimets" }, File.separator);
+ protected static final File TESTS_DIR =
+ new File(ASTERIX_APP_DIR, joinPath("src", "test", "resources",
"runtimets"));
// Path that actual results are written to. We create and clean this
directory
// here, and also pass it to TestExecutor which writes the test output
there.
- public static final String ACTUAL_RESULTS_DIR =
- StringUtils.join(new String[] { TARGET_DIR, "ittest" },
File.separator);
+ public static final File ACTUAL_RESULTS_DIR = new File(TARGET_DIR,
"ittest");
+
+ public static final File LOG4J_TEST_FILE =
+ new File(ASTERIX_APP_DIR, joinPath("src", "test", "resources",
"log4j2-asterixdb-test.xml"));
private static final Logger LOGGER = LogManager.getLogger();
private static boolean startHdfs;
@@ -126,8 +126,7 @@
public static void setUp(boolean startHdfs) throws Exception {
NCServiceExecutionIT.startHdfs = startHdfs;
// Create actual-results output directory.
- File outDir = new File(ACTUAL_RESULTS_DIR);
- outDir.mkdirs();
+ ACTUAL_RESULTS_DIR.mkdirs();
// Remove any instance data from previous runs.
File instanceDir = new File(INSTANCE_DIR);
@@ -136,17 +135,16 @@
}
if (startHdfs) {
- // HDFSCluster requires the input directory to end with a file
separator.
- HDFSCluster.getInstance().setup(ASTERIX_APP_DIR + File.separator);
+ HDFSCluster.getInstance().setup(ASTERIX_APP_DIR);
}
- cluster = new HyracksVirtualCluster(new File(APP_HOME), new
File(ASTERIX_APP_DIR));
- nc1 = cluster.addNCService(new File(CONF_DIR, "ncservice1.conf"), new
File(LOG_DIR, "ncservice1.log"));
+ cluster = new HyracksVirtualCluster(APP_HOME, ASTERIX_APP_DIR);
+ nc1 = cluster.addNCService(new File(CONF_DIR, "ncservice1.conf"),
null);
- nc2 = cluster.addNCService(new File(CONF_DIR, "ncservice2.conf"), new
File(LOG_DIR, "ncservice2.log"));
+ nc2 = cluster.addNCService(new File(CONF_DIR, "ncservice2.conf"),
null);
// Start CC
- cc = cluster.start(new File(CONF_DIR, "cc.conf"), new File(LOG_DIR,
"asterixcc.out.log"));
+ cc = cluster.start(new File(CONF_DIR, "cc.conf"), null);
testExecutor.waitForClusterActive(30, TimeUnit.SECONDS);
clusterActive = true;
@@ -154,10 +152,9 @@
@AfterClass
public static void tearDown() throws Exception {
- File outdir = new File(ACTUAL_RESULTS_DIR);
- File[] files = outdir.listFiles();
+ File[] files = ACTUAL_RESULTS_DIR.listFiles();
if (files == null || files.length == 0) {
- outdir.delete();
+ ACTUAL_RESULTS_DIR.delete();
}
cluster.stop();
if (startHdfs) {
@@ -176,7 +173,7 @@
Collection<Object[]> testArgs = new ArrayList<>();
Random random = getRandom();
TestCaseContext.Builder b = new TestCaseContext.Builder();
- for (TestCaseContext ctx : b.build(new File(TESTS_DIR))) {
+ for (TestCaseContext ctx : b.build(TESTS_DIR)) {
if (!skip(ctx)) {
testArgs.add(new Object[] { ctx, ctx, null });
}
@@ -234,7 +231,7 @@
@Test
public void test() throws Exception {
if (tcCtx != null) {
- testExecutor.executeTest(ACTUAL_RESULTS_DIR, tcCtx, null, false);
+ testExecutor.executeTest(ACTUAL_RESULTS_DIR.getPath(), tcCtx,
null, false);
testExecutor.cleanup(tcCtx.toString(), badTestCases);
} else {
switch (killType) {
diff --git
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/NcLifecycleIT.java
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/NcLifecycleIT.java
index 4ae9d96..2151adc 100644
---
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/NcLifecycleIT.java
+++
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/NcLifecycleIT.java
@@ -18,11 +18,8 @@
*/
package org.apache.asterix.test.server;
-import static org.apache.asterix.test.server.NCServiceExecutionIT.APP_HOME;
-import static
org.apache.asterix.test.server.NCServiceExecutionIT.ASTERIX_APP_DIR;
-import static org.apache.asterix.test.server.NCServiceExecutionIT.INSTANCE_DIR;
-import static org.apache.asterix.test.server.NCServiceExecutionIT.LOG_DIR;
-import static org.apache.asterix.test.server.NCServiceExecutionIT.TARGET_DIR;
+import static org.apache.asterix.test.server.NCServiceExecutionIT.*;
+import static org.apache.hyracks.util.file.FileUtil.joinPath;
import java.io.File;
import java.util.ArrayList;
@@ -33,9 +30,7 @@
import org.apache.asterix.test.common.TestExecutor;
import org.apache.asterix.testframework.context.TestCaseContext;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
import org.apache.hyracks.test.server.process.HyracksVirtualCluster;
-import org.apache.hyracks.util.file.FileUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.After;
@@ -49,13 +44,11 @@
@RunWith(Parameterized.class)
public class NcLifecycleIT {
- private static final String PATH_BASE =
- FileUtil.joinPath("src", "test", "resources", "integrationts",
"NcLifecycle");
- private static final String CONF_DIR =
- StringUtils.join(new String[] { TARGET_DIR, "test-classes",
"NcLifecycleIT" }, File.separator);
- private static final String PATH_ACTUAL = FileUtil.joinPath("target",
"ittest");
+ private static final String PATH_BASE = joinPath("src", "test",
"resources", "integrationts", "NcLifecycle");
+ private static final String CONF_DIR = joinPath(TARGET_DIR,
"test-classes", "NcLifecycleIT");
+ private static final String PATH_ACTUAL = joinPath("target", "ittest");
private static final Logger LOGGER = LogManager.getLogger();
- private static String reportPath = new File(FileUtil.joinPath("target",
"failsafe-reports")).getAbsolutePath();
+ private static final File reportPath = new File("target",
"failsafe-reports");
private static final TestExecutor testExecutor = new TestExecutor();
private static HyracksVirtualCluster cluster;
@@ -66,7 +59,7 @@
}
@Rule
- public TestRule retainLogs = new
RetainLogsRule(NCServiceExecutionIT.ASTERIX_APP_DIR, reportPath, this);
+ public TestRule retainLogs = new RetainLogsRule(ASTERIX_APP_DIR,
reportPath, this);
@Before
public void before() throws Exception {
@@ -76,12 +69,12 @@
FileUtils.deleteDirectory(instanceDir);
}
- cluster = new HyracksVirtualCluster(new File(APP_HOME), new
File(ASTERIX_APP_DIR));
- cluster.addNCService(new File(CONF_DIR, "ncservice1.conf"), new
File(LOG_DIR, "ncservice1.log"));
- cluster.addNCService(new File(CONF_DIR, "ncservice2.conf"), new
File(LOG_DIR, "ncservice2.log"));
+ cluster = new HyracksVirtualCluster(APP_HOME, ASTERIX_APP_DIR);
+ cluster.addNCService(new File(CONF_DIR, "ncservice1.conf"), null);
+ cluster.addNCService(new File(CONF_DIR, "ncservice2.conf"), null);
// Start CC
- cluster.start(new File(CONF_DIR, "cc.conf"), new File(LOG_DIR,
"cc.log"));
+ cluster.start(new File(CONF_DIR, "cc.conf"), null);
LOGGER.info("Instance created.");
testExecutor.waitForClusterActive(30, TimeUnit.SECONDS);
LOGGER.info("Instance is in ACTIVE state.");
diff --git
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/RecoveryIT.java
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/RecoveryIT.java
index 9123a5d..214eb5a 100644
---
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/RecoveryIT.java
+++
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/RecoveryIT.java
@@ -18,17 +18,19 @@
*/
package org.apache.asterix.test.server;
+import static org.apache.hyracks.util.file.FileUtil.joinPath;
+
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
+import java.util.Objects;
import org.apache.asterix.test.base.RetainLogsRule;
import org.apache.asterix.test.common.TestExecutor;
import org.apache.asterix.test.runtime.HDFSCluster;
import org.apache.asterix.testframework.context.TestCaseContext;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.AfterClass;
@@ -44,9 +46,9 @@
public class RecoveryIT {
private static final Logger LOGGER = LogManager.getLogger();
- private static final String PATH_ACTUAL = "target" + File.separator +
"rttest" + File.separator;
+ private static final String PATH_ACTUAL = joinPath("target", "rttest");
private static final String PATH_BASE =
"src/test/resources/transactionts/";
- private static final String HDFS_BASE = "../asterix-app/";
+ private static final File HDFS_BASE = new File("..", "asterix-app");
private TestCaseContext tcCtx;
private static File asterixInstallerPath;
private static File installerTargetPath;
@@ -68,17 +70,17 @@
File outdir = new File(PATH_ACTUAL);
outdir.mkdirs();
- File externalTestsJar =
- new File(StringUtils.join(new String[] { "..",
"asterix-external-data", "target" }, File.separator))
- .listFiles((dir, name) ->
name.matches("asterix-external-data-.*-tests.jar"))[0];
+ File externalTestsJar = Objects.requireNonNull(new File(joinPath("..",
"asterix-external-data", "target"))
+ .listFiles((dir, name) ->
name.matches("asterix-external-data-.*-tests.jar")))[0];
asterixInstallerPath = new File(System.getProperty("user.dir"));
installerTargetPath = new File(new
File(asterixInstallerPath.getParentFile(), "asterix-server"), "target");
reportPath = new File(installerTargetPath,
"failsafe-reports").getAbsolutePath();
- ncServiceSubDirName =
- installerTargetPath.list((dir, name) ->
name.matches("asterix-server.*binary-assembly"))[0];
+ ncServiceSubDirName = Objects.requireNonNull(
+ installerTargetPath.list((dir, name) ->
name.matches("asterix-server.*binary-assembly")))[0];
ncServiceSubPath = new File(installerTargetPath,
ncServiceSubDirName).getAbsolutePath();
- ncServiceHomeDirName = new File(ncServiceSubPath).list(((dir, name) ->
name.matches("apache-asterixdb.*")))[0];
+ ncServiceHomeDirName = Objects.requireNonNull(
+ new File(ncServiceSubPath).list(((dir, name) ->
name.matches("apache-asterixdb.*"))))[0];
ncServiceHomePath = new File(ncServiceSubPath,
ncServiceHomeDirName).getAbsolutePath();
LOGGER.info("NCSERVICE_HOME=" + ncServiceHomePath);
@@ -89,14 +91,12 @@
env = pb.environment();
env.put("NCSERVICE_HOME", ncServiceHomePath);
env.put("JAVA_HOME", System.getProperty("java.home"));
- scriptHomePath = asterixInstallerPath + File.separator + "src" +
File.separator + "test" + File.separator
- + "resources" + File.separator + "transactionts" +
File.separator + "scripts";
+ scriptHomePath =
+ joinPath(asterixInstallerPath.getPath(), "src", "test",
"resources", "transactionts", "scripts");
env.put("SCRIPT_HOME", scriptHomePath);
- TestExecutor.executeScript(pb,
- scriptHomePath + File.separator + "setup_teardown" +
File.separator + "configure_and_validate.sh");
- TestExecutor.executeScript(pb,
- scriptHomePath + File.separator + "setup_teardown" +
File.separator + "stop_and_delete.sh");
+ TestExecutor.executeScript(pb, joinPath(scriptHomePath,
"setup_teardown", "configure_and_validate.sh"));
+ TestExecutor.executeScript(pb, joinPath(scriptHomePath,
"setup_teardown", "stop_and_delete.sh"));
HDFSCluster.getInstance().setup(HDFS_BASE);
}
@@ -104,11 +104,9 @@
public static void tearDown() throws Exception {
File outdir = new File(PATH_ACTUAL);
FileUtils.deleteDirectory(outdir);
- File dataCopyDir =
- new File(ncServiceHomePath + File.separator + ".." +
File.separator + ".." + File.separator + "data");
+ File dataCopyDir = new File(joinPath(ncServiceHomePath, "..", "..",
"data"));
FileUtils.deleteDirectory(dataCopyDir);
- TestExecutor.executeScript(pb,
- scriptHomePath + File.separator + "setup_teardown" +
File.separator + "stop_and_delete.sh");
+ TestExecutor.executeScript(pb, joinPath(scriptHomePath,
"setup_teardown", "stop_and_delete.sh"));
HDFSCluster.getInstance().cleanup();
}
diff --git
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/ReplicationIT.java
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/ReplicationIT.java
index 0f058bc..025e501 100644
---
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/ReplicationIT.java
+++
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/test/server/ReplicationIT.java
@@ -18,11 +18,8 @@
*/
package org.apache.asterix.test.server;
-import static org.apache.asterix.test.server.NCServiceExecutionIT.APP_HOME;
-import static
org.apache.asterix.test.server.NCServiceExecutionIT.ASTERIX_APP_DIR;
-import static org.apache.asterix.test.server.NCServiceExecutionIT.INSTANCE_DIR;
-import static org.apache.asterix.test.server.NCServiceExecutionIT.LOG_DIR;
-import static org.apache.asterix.test.server.NCServiceExecutionIT.TARGET_DIR;
+import static org.apache.asterix.test.server.NCServiceExecutionIT.*;
+import static org.apache.hyracks.util.file.FileUtil.joinPath;
import java.io.File;
import java.net.InetAddress;
@@ -37,9 +34,7 @@
import org.apache.asterix.test.common.TestExecutor;
import org.apache.asterix.testframework.context.TestCaseContext;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
import org.apache.hyracks.test.server.process.HyracksVirtualCluster;
-import org.apache.hyracks.util.file.FileUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.After;
@@ -53,13 +48,11 @@
@RunWith(Parameterized.class)
public class ReplicationIT {
- private static final String PATH_BASE =
- FileUtil.joinPath("src", "test", "resources", "integrationts",
"replication");
- private static final String CONF_DIR =
- StringUtils.join(new String[] { TARGET_DIR, "test-classes",
"ReplicationIT" }, File.separator);
- private static final String PATH_ACTUAL = FileUtil.joinPath("target",
"ittest");
+ private static final String PATH_BASE = joinPath("src", "test",
"resources", "integrationts", "replication");
+ private static final String CONF_DIR = joinPath(TARGET_DIR,
"test-classes", "ReplicationIT");
+ private static final String PATH_ACTUAL = joinPath("target", "ittest");
private static final Logger LOGGER = LogManager.getLogger();
- private static String reportPath = new File(FileUtil.joinPath("target",
"failsafe-reports")).getAbsolutePath();
+ private static File reportPath = new File("target", "failsafe-reports");
private static final TestExecutor testExecutor = new TestExecutor();
private static HyracksVirtualCluster cluster;
@@ -82,7 +75,7 @@
}
@Rule
- public TestRule retainLogs = new
RetainLogsRule(NCServiceExecutionIT.ASTERIX_APP_DIR, reportPath, this);
+ public TestRule retainLogs = new RetainLogsRule(ASTERIX_APP_DIR,
reportPath, this);
@Before
public void before() throws Exception {
@@ -92,12 +85,12 @@
FileUtils.deleteDirectory(instanceDir);
}
- cluster = new HyracksVirtualCluster(new File(APP_HOME), new
File(ASTERIX_APP_DIR));
- cluster.addNCService(new File(CONF_DIR, "ncservice1.conf"), new
File(LOG_DIR, "ncservice1.log"));
- cluster.addNCService(new File(CONF_DIR, "ncservice2.conf"), new
File(LOG_DIR, "ncservice2.log"));
+ cluster = new HyracksVirtualCluster(APP_HOME, ASTERIX_APP_DIR);
+ cluster.addNCService(new File(CONF_DIR, "ncservice1.conf"), null);
+ cluster.addNCService(new File(CONF_DIR, "ncservice2.conf"), null);
// Start CC
- cluster.start(new File(CONF_DIR, "cc.conf"), new File(LOG_DIR,
"cc.log"));
+ cluster.start(new File(CONF_DIR, "cc.conf"), null);
LOGGER.info("Instance created.");
testExecutor.waitForClusterActive(30, TimeUnit.SECONDS);
LOGGER.info("Instance is in ACTIVE state.");
diff --git
a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
b/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
index 2a92c5d..d67fefe 100644
--- a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
+++ b/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
@@ -46,5 +46,5 @@
heartbeat.max.misses=25
[common]
-log.dir = ../asterix-server/target/failsafe-reports/
+log.dir = ../asterix-server/target/NCServiceExecutionIT/
log.level = INFO
\ No newline at end of file
diff --git
a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/ncservice1.conf
b/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/ncservice1.conf
index ba10142..e178cfa 100644
---
a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/ncservice1.conf
+++
b/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/ncservice1.conf
@@ -16,5 +16,4 @@
; under the License.
[ncservice]
-logdir=../asterix-server/target/failsafe-reports
-
+logdir=-
diff --git
a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/ncservice2.conf
b/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/ncservice2.conf
index 2036584..43aecf0 100644
---
a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/ncservice2.conf
+++
b/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/ncservice2.conf
@@ -16,6 +16,5 @@
; under the License.
[ncservice]
-logdir=../asterix-server/target/failsafe-reports
+logdir=-
port=9091
-
diff --git a/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/cc.conf
b/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/cc.conf
index dc80e56..396c4d8 100644
--- a/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/cc.conf
+++ b/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/cc.conf
@@ -46,3 +46,4 @@
[common]
log.level = INFO
+log.dir=../asterix-server/target/NcLifecyleIT
diff --git
a/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/ncservice1.conf
b/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/ncservice1.conf
index ba10142..e178cfa 100644
--- a/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/ncservice1.conf
+++ b/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/ncservice1.conf
@@ -16,5 +16,4 @@
; under the License.
[ncservice]
-logdir=../asterix-server/target/failsafe-reports
-
+logdir=-
diff --git
a/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/ncservice2.conf
b/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/ncservice2.conf
index 2036584..43aecf0 100644
--- a/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/ncservice2.conf
+++ b/asterixdb/asterix-server/src/test/resources/NcLifecycleIT/ncservice2.conf
@@ -16,6 +16,5 @@
; under the License.
[ncservice]
-logdir=../asterix-server/target/failsafe-reports
+logdir=-
port=9091
-
diff --git a/asterixdb/asterix-server/src/test/resources/ReplicationIT/cc.conf
b/asterixdb/asterix-server/src/test/resources/ReplicationIT/cc.conf
index 19e951f..b88cbd4 100644
--- a/asterixdb/asterix-server/src/test/resources/ReplicationIT/cc.conf
+++ b/asterixdb/asterix-server/src/test/resources/ReplicationIT/cc.conf
@@ -47,6 +47,7 @@
[common]
log.level = INFO
+log.dir=../asterix-server/target/ReplicationIT
replication.enabled=true
replication.strategy=all
replication.factor=2
diff --git
a/asterixdb/asterix-server/src/test/resources/ReplicationIT/ncservice1.conf
b/asterixdb/asterix-server/src/test/resources/ReplicationIT/ncservice1.conf
index ba10142..e178cfa 100644
--- a/asterixdb/asterix-server/src/test/resources/ReplicationIT/ncservice1.conf
+++ b/asterixdb/asterix-server/src/test/resources/ReplicationIT/ncservice1.conf
@@ -16,5 +16,4 @@
; under the License.
[ncservice]
-logdir=../asterix-server/target/failsafe-reports
-
+logdir=-
diff --git
a/asterixdb/asterix-server/src/test/resources/ReplicationIT/ncservice2.conf
b/asterixdb/asterix-server/src/test/resources/ReplicationIT/ncservice2.conf
index 2036584..43aecf0 100644
--- a/asterixdb/asterix-server/src/test/resources/ReplicationIT/ncservice2.conf
+++ b/asterixdb/asterix-server/src/test/resources/ReplicationIT/ncservice2.conf
@@ -16,6 +16,5 @@
; under the License.
[ncservice]
-logdir=../asterix-server/target/failsafe-reports
+logdir=-
port=9091
-
diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml
index 0e6e80d..a5f1117 100644
--- a/asterixdb/pom.xml
+++ b/asterixdb/pom.xml
@@ -925,6 +925,12 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-common</artifactId>
<version>${hadoop.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
@@ -940,6 +946,12 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>${hadoop.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
@@ -966,6 +978,18 @@
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -978,6 +1002,12 @@
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
<classifier>tests</classifier>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
@@ -987,6 +1017,14 @@
<exclusion>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -999,6 +1037,20 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-minicluster</artifactId>
<version>${hadoop.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
@@ -1010,6 +1062,10 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -1020,6 +1076,14 @@
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -1047,6 +1111,18 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -1057,6 +1133,18 @@
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -1243,6 +1331,12 @@
<artifactId>hyracks-hdfs</artifactId>
<version>${hyracks.version}</version>
<type>test-jar</type>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.hyracks</groupId>
@@ -1259,6 +1353,12 @@
<groupId>com.rometools</groupId>
<artifactId>rome</artifactId>
<version>1.7.4</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>log4j</groupId>
diff --git
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/CCLogConfigurationFactory.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/CCLogConfigurationFactory.java
index 98e0245..83cacd1 100644
---
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/CCLogConfigurationFactory.java
+++
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/CCLogConfigurationFactory.java
@@ -23,6 +23,8 @@
import org.apache.hyracks.control.common.controllers.CCConfig;
import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
@@ -34,6 +36,7 @@
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
public class CCLogConfigurationFactory extends ConfigurationFactory {
+ private static final Logger LOGGER = LogManager.getLogger();
private CCConfig config;
public CCLogConfigurationFactory(CCConfig config) {
@@ -42,6 +45,8 @@
public Configuration
createConfiguration(ConfigurationBuilder<BuiltConfiguration> builder) {
File logDir = new File(config.getLogDir());
+ File ccLog = new File(logDir, "cc.log");
+ LOGGER.warn("logs are being redirected to: {}",
ccLog::getAbsolutePath);
builder.setStatusLevel(Level.WARN);
builder.setConfigurationName("RollingBuilder");
// create a rolling file appender
@@ -50,10 +55,9 @@
ComponentBuilder triggeringPolicy = builder.newComponent("Policies")
.addComponent(builder.newComponent("CronTriggeringPolicy").addAttribute("schedule",
"0 0 0 * * ?"))
.addComponent(builder.newComponent("SizeBasedTriggeringPolicy").addAttribute("size",
"50M"));
- AppenderComponentBuilder defaultRoll =
- builder.newAppender("default",
"RollingFile").addAttribute("fileName", new File(logDir, "cc.log"))
- .addAttribute("filePattern", new File(logDir,
"cc-%d{MM-dd-yy}.log.gz")).add(defaultLayout)
- .addComponent(triggeringPolicy);
+ AppenderComponentBuilder defaultRoll = builder.newAppender("default",
"RollingFile")
+ .addAttribute("fileName", ccLog).addAttribute("filePattern",
new File(logDir, "cc-%d{MM-dd-yy}.log.gz"))
+ .add(defaultLayout).addComponent(triggeringPolicy);
builder.add(defaultRoll);
// create the new logger
@@ -71,9 +75,9 @@
LayoutComponentBuilder traceLayout =
builder.newLayout("PatternLayout").addAttribute("pattern", "%m,%n")
.addAttribute("header", "[").addAttribute("footer", "]");
AppenderComponentBuilder traceRoll =
- builder.newAppender("trace",
"RollingFile").addAttribute("fileName", logDir + "trace-cc.log")
- .addAttribute("filePattern", logDir +
"trace-cc-%d{MM-dd-yy-ss}.log.gz").add(traceLayout)
- .addComponent(triggeringPolicy);
+ builder.newAppender("trace",
"RollingFile").addAttribute("fileName", new File(logDir, "trace-cc.log"))
+ .addAttribute("filePattern", new File(logDir,
"trace-cc-%d{MM-dd-yy-ss}.log.gz"))
+ .add(traceLayout).addComponent(triggeringPolicy);
builder.add(traceRoll);
builder.add(builder.newLogger("org.apache.hyracks.util.trace.Tracer.Traces",
Level.forName("TRACER", 570))
.add(builder.newAppenderRef("trace")).addAttribute("additivity", false));
diff --git
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/NodeControllerData.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/NodeControllerData.java
index c37acab..24a3e57 100644
---
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/NodeControllerData.java
+++
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/NodeControllerData.java
@@ -79,7 +79,7 @@
private final Map<String, String> systemProperties;
- private final int pid;
+ private final long pid;
private final HeartbeatSchema hbSchema;
diff --git
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NodeRegistration.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NodeRegistration.java
index 437b001..474bc0a 100644
---
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NodeRegistration.java
+++
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NodeRegistration.java
@@ -75,7 +75,7 @@
private final NetworkAddress messagingPort;
- private final int pid;
+ private final long pid;
private final NodeCapacity capacity;
@@ -190,7 +190,7 @@
return messagingPort;
}
- public int getPid() {
+ public long getPid() {
return pid;
}
}
diff --git a/asterixdb/asterix-app/src/main/resources/log4j2.xml
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/resources/log4j2.xml
similarity index 100%
rename from asterixdb/asterix-app/src/main/resources/log4j2.xml
rename to
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/resources/log4j2.xml
diff --git
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCLogConfigurationFactory.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCLogConfigurationFactory.java
index a657d6b..fad6b3e 100644
---
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCLogConfigurationFactory.java
+++
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCLogConfigurationFactory.java
@@ -23,6 +23,8 @@
import org.apache.hyracks.control.common.controllers.NCConfig;
import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
@@ -34,6 +36,7 @@
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
public class NCLogConfigurationFactory extends ConfigurationFactory {
+ private static final Logger LOGGER = LogManager.getLogger();
private NCConfig config;
public NCLogConfigurationFactory(NCConfig config) {
@@ -43,6 +46,8 @@
public Configuration
createConfiguration(ConfigurationBuilder<BuiltConfiguration> builder) {
String nodeId = config.getNodeId();
File logDir = new File(config.getLogDir());
+ File ncLog = new File(logDir, "nc-" + nodeId + ".log");
+ LOGGER.warn("logs are being redirected to: {}",
ncLog::getAbsolutePath);
builder.setStatusLevel(Level.WARN);
builder.setConfigurationName("RollingBuilder");
// create a rolling file appender
@@ -51,11 +56,11 @@
ComponentBuilder triggeringPolicy = builder.newComponent("Policies")
.addComponent(builder.newComponent("CronTriggeringPolicy").addAttribute("schedule",
"0 0 0 * * ?"))
.addComponent(builder.newComponent("SizeBasedTriggeringPolicy").addAttribute("size",
"50M"));
- AppenderComponentBuilder defaultRoll = builder.newAppender("default",
"RollingFile")
- .addAttribute("fileName", new File(logDir, "nc-" + nodeId +
".log").getAbsolutePath())
- .addAttribute("filePattern",
- new File(logDir, "nc-" + nodeId +
"-%d{MM-dd-yy-ss}.log.gz").getAbsolutePath())
- .add(defaultLayout).addComponent(triggeringPolicy);
+ AppenderComponentBuilder defaultRoll =
+ builder.newAppender("default",
"RollingFile").addAttribute("fileName", ncLog.getAbsolutePath())
+ .addAttribute("filePattern",
+ new File(logDir, "nc-" + nodeId +
"-%d{MM-dd-yy-ss}.log.gz").getAbsolutePath())
+ .add(defaultLayout).addComponent(triggeringPolicy);
builder.add(defaultRoll);
// create the new logger
@@ -74,9 +79,9 @@
LayoutComponentBuilder traceLayout =
builder.newLayout("PatternLayout").addAttribute("pattern", "%m,%n")
.addAttribute("header", "[").addAttribute("footer", "]");
AppenderComponentBuilder traceRoll = builder.newAppender("trace",
"RollingFile")
- .addAttribute("fileName", logDir + "trace-" + nodeId + ".log")
- .addAttribute("filePattern", logDir + "trace-" + nodeId +
"-%d{MM-dd-yy-ss}.log.gz").add(traceLayout)
- .addComponent(triggeringPolicy);
+ .addAttribute("fileName", new File(logDir, "trace-" + nodeId +
".log"))
+ .addAttribute("filePattern", new File(logDir, "trace-" +
nodeId + "-%d{MM-dd-yy-ss}.log.gz"))
+ .add(traceLayout).addComponent(triggeringPolicy);
builder.add(traceRoll);
builder.add(builder.newLogger("org.apache.hyracks.util.trace.Tracer.Traces",
Level.forName("TRACER", 570))
.add(builder.newAppenderRef("trace")).addAttribute("additivity", false));
diff --git
a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/NCServiceIT.java
b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/NCServiceIT.java
index 5cbc5b4..cd0359f 100644
---
a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/NCServiceIT.java
+++
b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/NCServiceIT.java
@@ -21,11 +21,8 @@
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
-import java.nio.file.Files;
-import java.nio.file.StandardOpenOption;
import java.util.Iterator;
-import org.apache.commons.io.FileUtils;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
@@ -58,13 +55,9 @@
@BeforeClass
public static void setUp() throws Exception {
cluster = new HyracksVirtualCluster(new File(APP_HOME), null);
- File tempConf = new File(TARGET_DIR, "cc.conf");
- FileUtils.copyFile(new File(RESOURCE_DIR, "cc.conf"), tempConf);
- Files.write(tempConf.toPath(), ("log.dir: " + LOG_DIR).getBytes(),
StandardOpenOption.APPEND);
- File log4jPath = new File(FileUtil.joinPath("..", "..", "src", "test",
"resources", "log4j2-hyracks-test.xml"));
- cluster.addNCService(new File(RESOURCE_DIR, "nc-red.conf"), new
File(LOG_DIR, "nc-red.log"), log4jPath);
- cluster.addNCService(new File(RESOURCE_DIR, "nc-blue.conf"), new
File(LOG_DIR, "nc-blue.log"), log4jPath);
+ cluster.addNCService(new File(RESOURCE_DIR, "nc-red.conf"), null);
+ cluster.addNCService(new File(RESOURCE_DIR, "nc-blue.conf"), null);
try {
Thread.sleep(2000);
@@ -72,7 +65,7 @@
}
// Start CC
- cluster.start(tempConf, new File(LOG_DIR, "cc.log"), log4jPath);
+ cluster.start(new File(RESOURCE_DIR, "cc.conf"), null);
try {
Thread.sleep(10000);
diff --git
a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksCCProcess.java
b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksCCProcess.java
index a79d033..8c84032 100644
---
a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksCCProcess.java
+++
b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksCCProcess.java
@@ -25,16 +25,11 @@
public class HyracksCCProcess extends HyracksServerProcess {
- public HyracksCCProcess(File configFile, File logFile, File appHome, File
workingDir) {
+ HyracksCCProcess(File configFile, File logFile, File appHome, File
workingDir) {
this.configFile = configFile;
this.logFile = logFile;
this.appHome = appHome;
this.workingDir = workingDir;
- }
-
- public HyracksCCProcess(File configFile, File logFile, File appHome, File
workingDir, File log4jPath) {
- this(configFile, logFile, appHome, workingDir);
- args.add("-Dlog4j.configurationFile=file://" +
log4jPath.getAbsolutePath());
}
@Override
diff --git
a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksNCServiceProcess.java
b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksNCServiceProcess.java
index d0e0244..43a1c53 100644
---
a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksNCServiceProcess.java
+++
b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksNCServiceProcess.java
@@ -25,16 +25,11 @@
public class HyracksNCServiceProcess extends HyracksServerProcess {
- public HyracksNCServiceProcess(File configFile, File logFile, File
appHome, File workingDir) {
+ HyracksNCServiceProcess(File configFile, File logFile, File appHome, File
workingDir) {
this.configFile = configFile;
this.logFile = logFile;
this.appHome = appHome;
this.workingDir = workingDir;
- }
-
- public HyracksNCServiceProcess(File configFile, File logFile, File
appHome, File workingDir, File log4jPath) {
- this(configFile, logFile, appHome, workingDir);
- args.add("-Dlog4j.configurationFile=file://" +
log4jPath.getAbsolutePath());
}
@Override
diff --git
a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksServerProcess.java
b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksServerProcess.java
index a8c363b..6011540 100644
---
a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksServerProcess.java
+++
b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksServerProcess.java
@@ -60,6 +60,7 @@
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Logfile not set, subprocess will output to
stdout");
}
+ pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
}
pb.directory(workingDir);
process = pb.start();
diff --git
a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksVirtualCluster.java
b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksVirtualCluster.java
index 6c77628..062d429 100644
---
a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksVirtualCluster.java
+++
b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksVirtualCluster.java
@@ -65,22 +65,6 @@
}
/**
- * Creates and starts an NCService.
- *
- * @param configFile
- * - full path to an ncservice.conf. May be null to accept all
defaults.
- * @throws IOException
- * - if there are errors starting the process.
- */
- public HyracksNCServiceProcess addNCService(File configFile, File logFile,
File log4jConfig) throws IOException {
- HyracksNCServiceProcess proc =
- new HyracksNCServiceProcess(configFile, logFile, appHome,
workingDir, log4jConfig);
- proc.start();
- ncProcs.add(proc);
- return proc;
- }
-
- /**
* Starts the CC, initializing the cluster. Expects that any NCs referenced
* in the cluster configuration have already been started with
addNCService().
*
@@ -92,22 +76,6 @@
*/
public HyracksCCProcess start(File ccConfigFile, File logFile) throws
IOException {
ccProc = new HyracksCCProcess(ccConfigFile, logFile, appHome,
workingDir);
- ccProc.start();
- return ccProc;
- }
-
- /**
- * Starts the CC, initializing the cluster. Expects that any NCs referenced
- * in the cluster configuration have already been started with
addNCService().
- *
- * @param ccConfigFile
- * - full path to a cluster conf file. May be null to accept all
- * defaults, although this is seldom useful since there are no
NCs.
- * @throws IOException
- * - if there are errors starting the process.
- */
- public HyracksCCProcess start(File ccConfigFile, File logFile, File
log4jConfig) throws IOException {
- ccProc = new HyracksCCProcess(ccConfigFile, logFile, appHome,
workingDir, log4jConfig);
ccProc.start();
return ccProc;
}
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 9c80c7d..9b1a1cd 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
@@ -30,3 +30,4 @@
console.listen.port = 12345
[common]
+log.dir=target/NCServiceIT
diff --git
a/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/nc-blue.conf
b/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/nc-blue.conf
index 6eb38dd..baccd46 100644
---
a/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/nc-blue.conf
+++
b/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/nc-blue.conf
@@ -18,3 +18,4 @@
[ncservice]
address=127.0.0.1
port=9091
+logdir=-
\ No newline at end of file
diff --git
a/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/nc-red.conf
b/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/nc-red.conf
index 286bd32..7616b37 100644
---
a/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/nc-red.conf
+++
b/hyracks-fullstack/hyracks/hyracks-server/src/test/resources/NCServiceIT/nc-red.conf
@@ -18,3 +18,4 @@
[ncservice]
address=127.0.0.1
port=9090
+logdir=-
\ No newline at end of file
diff --git
a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/PidHelper.java
b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/PidHelper.java
index 5a8edbd..46e77e3 100644
---
a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/PidHelper.java
+++
b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/PidHelper.java
@@ -21,6 +21,7 @@
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.logging.log4j.Level;
@@ -34,11 +35,20 @@
private PidHelper() {
}
- public static int getPid() {
+ public static long getPid() {
return getPid(ManagementFactory.getRuntimeMXBean());
}
- public static int getPid(RuntimeMXBean runtimeMXBean) {
+ public static long getPid(RuntimeMXBean runtimeMXBean) {
+ // TODO: replace with direct invoke of getPid() once compatibility is
at JDK 10 or higher
+ try {
+ Method getPidMethod = runtimeMXBean.getClass().getMethod("getPid");
+ return (Long) getPidMethod.invoke(runtimeMXBean);
+ } catch (NoSuchMethodException e) {
+ LOGGER.debug("ignoring exception trying to find getPid() (expected
pre-JDK 10)", e);
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ LOGGER.debug("ignoring exception trying to execute getPid()", e);
+ }
try {
Field jvmField = runtimeMXBean.getClass().getDeclaredField("jvm");
jvmField.setAccessible(true);
diff --git
a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Event.java
b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Event.java
index b5fe3d3..b744198 100644
---
a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Event.java
+++
b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Event.java
@@ -28,14 +28,14 @@
public final long cat;
public final ITracer.Phase ph;
public final long ts;
- public final int pid;
+ public final long pid;
public final long tid;
public final ITracer.Scope scope;
public final String args;
public final TraceCategoryRegistry registry;
- private Event(String name, long cat, ITracer.Phase ph, long ts, int pid,
long tid, ITracer.Scope scope, String args,
- TraceCategoryRegistry registry) {
+ private Event(String name, long cat, ITracer.Phase ph, long ts, long pid,
long tid, ITracer.Scope scope,
+ String args, TraceCategoryRegistry registry) {
this.name = name;
this.cat = cat;
this.ph = ph;
@@ -51,7 +51,7 @@
return (System.nanoTime() - NANOTIME_DELTA_TO_EPOCH) / 1000;
}
- public static Event create(String name, long cat, ITracer.Phase ph, int
pid, long tid, ITracer.Scope scope,
+ public static Event create(String name, long cat, ITracer.Phase ph, long
pid, long tid, ITracer.Scope scope,
String args, TraceCategoryRegistry registry) {
return new Event(name, cat, ph, timestamp(), pid, tid, scope, args,
registry);
}
diff --git
a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Tracer.java
b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Tracer.java
index 9019fdf..c1c38cf 100644
---
a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Tracer.java
+++
b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Tracer.java
@@ -44,7 +44,7 @@
private long categories;
private final TraceCategoryRegistry registry;
- private static final int pid = PidHelper.getPid();
+ private static final long pid = PidHelper.getPid();
public Tracer(String name, long categories, TraceCategoryRegistry
registry) {
final String traceLoggerName = Tracer.class.getName() + ".Traces." +
name;
--
To view, visit https://asterix-gerrit.ics.uci.edu/3311
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id264aede0f62558ad6e34355047c623a1d594692
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <[email protected]>