You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by ce...@apache.org on 2016/05/23 23:09:07 UTC

incubator-asterixdb git commit: Fixes and tweaks for running Asterix atop new config-management framework.

Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master f04ba06f2 -> 09d4f9f40


Fixes and tweaks for running Asterix atop new config-management framework.

Change-Id: Ie3027c8c839f25ea858790bd3340187f4b11f213
Reviewed-on: https://asterix-gerrit.ics.uci.edu/874
Reviewed-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
Reviewed-by: Michael Blow <mi...@couchbase.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/09d4f9f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/09d4f9f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/09d4f9f4

Branch: refs/heads/master
Commit: 09d4f9f404d043a073096179b889e8870590b9a8
Parents: f04ba06
Author: Chris Hillery <ch...@lambda.nu>
Authored: Fri May 20 14:55:59 2016 -0700
Committer: Chris Hillery <ce...@lambda.nu>
Committed: Mon May 23 16:08:30 2016 -0700

----------------------------------------------------------------------
 .../common/config/AsterixPropertiesAccessor.java     | 15 ++++++++++++---
 .../resource/PersistentLocalResourceRepository.java  | 12 ++++++------
 .../hyracks/control/nc/service/NCServiceConfig.java  | 14 +++++++++-----
 3 files changed, 27 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/09d4f9f4/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
index 62bdbf5..45e3b06 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
@@ -136,12 +136,13 @@ public class AsterixPropertiesAccessor {
         this.cfg = cfg;
         instanceName = cfg.getString("asterix", "instance", "DEFAULT_INSTANCE");
         String mdNode = null;
+        nodePartitionsMap = new HashMap<>();
+        int uniquePartitionId = 0;
         for (String section : cfg.getSections()) {
             if (!section.startsWith("nc/")) {
                 continue;
             }
             String ncId = section.substring(3);
-            nodeNames.add(ncId);
 
             if (mdNode == null) {
                 // Default is first node == metadata node
@@ -156,15 +157,23 @@ public class AsterixPropertiesAccessor {
             // be a default.ini? They can't be inserted by TriggerNCWork except
             // possibly for hyracks-specified values. Certainly wherever they are,
             // they should be platform-dependent.
-            stores.put(ncId, cfg.getString(section, "iodevices", "/var/lib/asterixdb/data").split(","));
             coredumpConfig.put(ncId, cfg.getString(section, "coredumpdir", "/var/lib/asterixdb/coredump"));
             transactionLogDirs.put(ncId, cfg.getString(section, "txnlogdir", "/var/lib/asterixdb/txn-log"));
+            String[] storeDirs = cfg.getString(section, "storagedir", "storage").trim().split(",");
+            ClusterPartition[] nodePartitions = new ClusterPartition[storeDirs.length];
+            for (int i = 0; i < nodePartitions.length; i++) {
+                ClusterPartition partition = new ClusterPartition(uniquePartitionId++, ncId, i);
+                clusterPartitions.put(partition.getPartitionId(), partition);
+                nodePartitions[i] = partition;
+            }
+            stores.put(ncId, storeDirs);
+            nodePartitionsMap.put(ncId, nodePartitions);
+            nodeNames.add(ncId);
         }
 
         metadataNodeName = mdNode;
         asterixConfigurationParams = null;
         asterixBuildProperties = null;
-        nodePartitionsMap = null;
     }
 
     public String getMetadataNodeName() {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/09d4f9f4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
index 561b144..fc79ae0 100644
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
+++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
@@ -86,9 +86,9 @@ public class PersistentLocalResourceRepository implements ILocalResourceReposito
                 throw new HyracksDataException(mountPointDir.getAbsolutePath() + " doesn't exist.");
             }
             if (!mountPoint.endsWith(System.getProperty("file.separator"))) {
-                mountPoints[i] = new String(mountPoint + System.getProperty("file.separator"));
+                mountPoints[i] = mountPoint + System.getProperty("file.separator");
             } else {
-                mountPoints[i] = new String(mountPoint);
+                mountPoints[i] = mountPoint;
             }
         }
         resourceCache = CacheBuilder.newBuilder().maximumSize(MAX_CACHED_RESOURCES).build();
@@ -136,10 +136,10 @@ public class PersistentLocalResourceRepository implements ILocalResourceReposito
 
             String storageRootDirPath;
             if (storageRootDirName.startsWith(System.getProperty("file.separator"))) {
-                storageRootDirPath = new String(
-                        mountPoints[i] + storageRootDirName.substring(System.getProperty("file.separator").length()));
+                storageRootDirPath = mountPoints[i] +
+                        storageRootDirName.substring(System.getProperty("file.separator").length());
             } else {
-                storageRootDirPath = new String(mountPoints[i] + storageRootDirName);
+                storageRootDirPath = mountPoints[i] + storageRootDirName;
             }
 
             LocalResource rootLocalResource = new LocalResource(STORAGE_LOCAL_RESOURCE_ID,
@@ -301,7 +301,7 @@ public class PersistentLocalResourceRepository implements ILocalResourceReposito
             if (!baseDir.endsWith(System.getProperty("file.separator"))) {
                 baseDir += System.getProperty("file.separator");
             }
-            return new String(baseDir + METADATA_FILE_NAME);
+            return baseDir + METADATA_FILE_NAME;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/09d4f9f4/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCServiceConfig.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCServiceConfig.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCServiceConfig.java
index af80b33..bc982f3 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCServiceConfig.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCServiceConfig.java
@@ -35,16 +35,20 @@ public class NCServiceConfig {
      * If an option is specified both in the config file and on the command line, the config file
      * version will take precedence.
      */
-    @Option(name = "-config-file", usage = "Local NC configuration file (default: none)", required = false)
+    @Option(name = "-config-file", required = false,
+            usage = "Local NC configuration file (default: none)")
     public String configFile = null;
 
-    @Option(name = "-address", usage = "Address to listen on for connections from CC (default: localhost)", required = false)
-    public String address = InetAddress.getLoopbackAddress().getHostAddress();
+    @Option(name = "-address", required = false,
+            usage = "Address to listen on for connections from CC (default: all addresses)")
+    public String address = null;
 
-    @Option(name = "-port", usage = "Port to listen on for connections from CC (default: 9090)", required = false)
+    @Option(name = "-port", required = false,
+            usage = "Port to listen on for connections from CC (default: 9090)")
     public int port = 9090;
 
-    @Option(name = "-command", usage = "NC command to run (default: 'hyracksnc' on PATH)", required = false)
+    @Option(name = "-command", required = false,
+            usage = "NC command to run (default: 'hyracksnc' on PATH)")
     public String command = "hyracksnc";
 
     private Ini ini = null;