asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abdullah alamoudi (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Change IO directory for integration util to be a directory i...
Date Mon, 29 May 2017 09:00:24 GMT
abdullah alamoudi has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1789

Change subject: Change IO directory for integration util to be a directory in target
......................................................................

Change IO directory for integration util to be a directory in target

Change-Id: I3dfb74dd4228725fb624eb1d21f621b7855f3d37
---
M asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java
2 files changed, 22 insertions(+), 13 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/89/1789/1

diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
index 8d60ec6..57ae55b 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -61,7 +61,6 @@
         }
     }
 
-    protected static final String IO_DIR_KEY = "java.io.tmpdir";
     public static final int DEFAULT_HYRACKS_CC_CLIENT_PORT = 1098;
     public static final int DEFAULT_HYRACKS_CC_CLUSTER_PORT = 1099;
 
@@ -79,8 +78,7 @@
         final CCConfig ccConfig = createCCConfig(configManager);
         cc = new ClusterControllerService(ccConfig, ccApplication);
 
-
-            nodeNames = ccConfig.getConfigManager().getNodeNames();
+        nodeNames = ccConfig.getConfigManager().getNodeNames();
         if (deleteOldInstanceData) {
             deleteTransactionLogs();
             removeTestStorageFiles();
@@ -133,7 +131,9 @@
         ccConfig.setClusterListenPort(DEFAULT_HYRACKS_CC_CLUSTER_PORT);
         ccConfig.setResultTTL(120000L);
         ccConfig.setResultSweepThreshold(1000L);
-        configManager.set(ControllerConfig.Option.DEFAULT_DIR, joinPath(System.getProperty(IO_DIR_KEY),
"asterixdb"));
+        String ioDir = System.getProperty(ControllerConfig.KEY_IO_DIR, joinPath("target",
"asterixdb", "io", "dir"));
+        System.setProperty(ControllerConfig.KEY_IO_DIR, ioDir);
+        configManager.set(ControllerConfig.Option.DEFAULT_DIR, ioDir);
         return ccConfig;
     }
 
@@ -152,8 +152,9 @@
         ncConfig.setResultTTL(120000L);
         ncConfig.setResultSweepThreshold(1000L);
         ncConfig.setVirtualNC(true);
-        configManager.set(ControllerConfig.Option.DEFAULT_DIR,
-                joinPath(System.getProperty(IO_DIR_KEY), "asterixdb", ncName));
+        String ioDir = System.getProperty(ControllerConfig.KEY_IO_DIR, joinPath("target",
"asterixdb", "io", "dir"));
+        System.setProperty(ControllerConfig.KEY_IO_DIR, ioDir);
+        configManager.set(ControllerConfig.Option.DEFAULT_DIR, joinPath(ioDir, ncName));
         return ncConfig;
     }
 
@@ -170,11 +171,13 @@
         if (nodeStores == null) {
             throw new IllegalStateException("Couldn't find stores for NC: " + ncConfig.getNodeId());
         }
-        String tempDirPath = System.getProperty(IO_DIR_KEY);
-        LOGGER.info("Using the temp path: " + tempDirPath);
+        String ioDir = System.getProperty(ControllerConfig.KEY_IO_DIR, joinPath("target",
"asterixdb", "io", "dir"));
+        System.setProperty(ControllerConfig.KEY_IO_DIR, ioDir);
+        LOGGER.info("Using the path: " + ioDir);
+
         for (int i = 0; i < nodeStores.length; i++) {
             // create IO devices based on stores
-            nodeStores[i] = joinPath(tempDirPath, ncConfig.getNodeId(), nodeStores[i]);
+            nodeStores[i] = joinPath(ioDir, ncConfig.getNodeId(), nodeStores[i]);
         }
         ncConfig.getConfigManager().set(ncConfig.getNodeId(), NCConfig.Option.IODEVICES,
nodeStores);
         return ncConfig;
@@ -227,7 +230,9 @@
     }
 
     public void removeTestStorageFiles() {
-        File dir = new File(System.getProperty(IO_DIR_KEY));
+        String ioDir = System.getProperty(ControllerConfig.KEY_IO_DIR, joinPath("target",
"asterixdb", "io", "dir"));
+        System.setProperty(ControllerConfig.KEY_IO_DIR, ioDir);
+        File dir = new File(ioDir);
         for (String ncName : nodeNames) {
             File ncDir = new File(dir, ncName);
             FileUtils.deleteQuietly(ncDir);
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java
index a9b3f97..0fac159 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java
@@ -31,12 +31,16 @@
 
 public class ControllerConfig implements Serializable {
 
+    private static final long serialVersionUID = 1L;
+    public static final String KEY_IO_DIR = "storage.dir";
+
     public enum Option implements IOption {
         CONFIG_FILE(OptionTypes.STRING, "Specify path to master configuration file", null),
         CONFIG_FILE_URL(OptionTypes.URL, "Specify URL to master configuration file", null),
-        DEFAULT_DIR(OptionTypes.STRING, "Directory where files are written to by default",
-                FileUtil.joinPath(System.getProperty("java.io.tmpdir"), "hyracks")),
-        ;
+        DEFAULT_DIR(
+                OptionTypes.STRING,
+                "Directory where files are written to by default",
+                FileUtil.joinPath(System.getProperty(KEY_IO_DIR, System.getProperty("java.io.tmpdir")),
"hyracks")),;
 
         private final IOptionType type;
         private final String description;

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1789
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3dfb74dd4228725fb624eb1d21f621b7855f3d37
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message