Chris Hillery has uploaded a new change for review.

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

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
---
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, 19 insertions(+), 11 deletions(-)


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

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..399be3d 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,9 @@
 
             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 +300,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..f44a291 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
@@ -38,8 +38,8 @@
     @Option(name = "-config-file", usage = "Local NC configuration file 
(default: none)", required = false)
     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", usage = "Address to listen on for connections 
from CC (default: all addresses)", required = false)
+    public String address = null;
 
     @Option(name = "-port", usage = "Port to listen on for connections from CC 
(default: 9090)", required = false)
     public int port = 9090;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3027c8c839f25ea858790bd3340187f4b11f213
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Chris Hillery <[email protected]>

Reply via email to