Chris Hillery has submitted this change and it was merged.

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


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 <[email protected]>
Tested-by: Jenkins <[email protected]>
Reviewed-by: Till Westmann <[email protected]>
Reviewed-by: Michael Blow <[email protected]>
---
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
M 
asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
M 
hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCServiceConfig.java
3 files changed, 27 insertions(+), 14 deletions(-)

Approvals:
  Michael Blow: Looks good to me, approved
  Till Westmann: Looks good to me, approved
  Jenkins: Looks good to me, but someone else must approve; Verified



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 @@
         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 @@
             // 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() {
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 @@
                 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 @@
 
             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 @@
             if (!baseDir.endsWith(System.getProperty("file.separator"))) {
                 baseDir += System.getProperty("file.separator");
             }
-            return new String(baseDir + METADATA_FILE_NAME);
+            return baseDir + METADATA_FILE_NAME;
         }
     }
 
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 @@
      * 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;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie3027c8c839f25ea858790bd3340187f4b11f213
Gerrit-PatchSet: 4
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Chris Hillery <[email protected]>
Gerrit-Reviewer: Chris Hillery <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-Reviewer: Till Westmann <[email protected]>

Reply via email to