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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
Reviewed-by: Michael Blow <michael.blow@couchbase.com>
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;