1) fixed issue 506 (BetaBlocker) 2) configurable CC ports 3) cosmetic changes for indented output of describe -admin command
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java
index d623ae5..5ffd9a2 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java
@@ -19,6 +19,7 @@
import edu.uci.ics.asterix.common.configuration.Coredump;
import edu.uci.ics.asterix.common.configuration.Property;
import edu.uci.ics.asterix.common.configuration.Store;
+import edu.uci.ics.asterix.common.configuration.TransactionLogDir;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
public class AsterixPropertiesAccessor {
@@ -29,6 +30,7 @@
private final Map<String, String[]> stores;
private final Map<String, String> coredumpConfig;
private final Map<String, Property> asterixConfigurationParams;
+ private final Map<String, String> transactionLogDirs;
public AsterixPropertiesAccessor() throws AsterixException {
String fileName = System.getProperty(GlobalConfig.CONFIG_FILE_PROPERTY);
@@ -70,6 +72,10 @@
for (Coredump cd : asterixConfiguration.getCoredump()) {
coredumpConfig.put(cd.getNcId(), cd.getCoredumpPath());
}
+ transactionLogDirs = new HashMap<String, String>();
+ for (TransactionLogDir txnLogDir : asterixConfiguration.getTransactionLogDir()) {
+ transactionLogDirs.put(txnLogDir.getNcId(), txnLogDir.getTxnLogDirPath());
+ }
}
@@ -93,6 +99,10 @@
return coredumpConfig.get(nodeId);
}
+ public String getTransactionLogDir(String nodeId) {
+ return transactionLogDirs.get(nodeId);
+ }
+
public <T> T getProperty(String property, T defaultValue, IPropertyInterpreter<T> interpreter) {
Property p = asterixConfigurationParams.get(property);
if (p == null) {
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixTransactionProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixTransactionProperties.java
index 0b6ea85..b3b5725 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixTransactionProperties.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixTransactionProperties.java
@@ -1,9 +1,7 @@
package edu.uci.ics.asterix.common.config;
public class AsterixTransactionProperties extends AbstractAsterixProperties {
- private static final String TXN_LOG_DIRECTORY_KEY = "txn.log.directory";
- private static final String TXN_LOG_DIRECTORY_DEFAULT = "asterix_logs/";
-
+
private static final String TXN_LOG_BUFFER_NUMPAGES_KEY = "txn.log.buffer.numpages";
private static int TXN_LOG_BUFFER_NUMPAGES_DEFAULT = 8;
@@ -12,7 +10,7 @@
private static final String TXN_LOG_PARTITIONSIZE_KEY = "txn.log.partitionsize";
private static final long TXN_LOG_PARTITIONSIZE_DEFAULT = (2 << 30); // 2GB
-
+
private static final String TXN_LOG_DISKSECTORSIZE_KEY = "txn.log.disksectorsize";
private static final int TXN_LOG_DISKSECTORSIZE_DEFAULT = 4096;
@@ -24,7 +22,7 @@
private static final String TXN_LOG_CHECKPOINT_POLLFREQUENCY_KEY = "txn.log.checkpoint.pollfrequency";
private static int TXN_LOG_CHECKPOINT_POLLFREQUENCY_DEFAULT = 120; // 120s
-
+
private static final String TXN_LOG_CHECKPOINT_HISTORY_KEY = "txn.log.checkpoint.history";
private static int TXN_LOG_CHECKPOINT_HISTORY_DEFAULT = 0;
@@ -33,24 +31,19 @@
private static final String TXN_LOCK_SHRINKTIMER_KEY = "txn.lock.shrinktimer";
private static int TXN_LOCK_SHRINKTIMER_DEFAULT = 5000; // 5s
-
+
private static final String TXN_LOCK_TIMEOUT_WAITTHRESHOLD_KEY = "txn.lock.timeout.waitthreshold";
private static final int TXN_LOCK_TIMEOUT_WAITTHRESHOLD_DEFAULT = 60000; // 60s
-
+
private static final String TXN_LOCK_TIMEOUT_SWEEPTHRESHOLD_KEY = "txn.lock.timeout.sweepthreshold";
private static final int TXN_LOCK_TIMEOUT_SWEEPTHRESHOLD_DEFAULT = 10000; // 10s
public AsterixTransactionProperties(AsterixPropertiesAccessor accessor) {
super(accessor);
}
-
- public String getLogDirectory() {
- String logDirectory = accessor.getProperty(TXN_LOG_DIRECTORY_KEY, TXN_LOG_DIRECTORY_DEFAULT,
- PropertyInterpreters.getStringPropertyInterpreter());
- if (!logDirectory.endsWith("/")) {
- logDirectory += "/";
- }
- return logDirectory;
+
+ public String getLogDirectory(String nodeId) {
+ return accessor.getTransactionLogDir(nodeId);
}
public int getLogBufferNumPages() {
@@ -67,7 +60,7 @@
return accessor.getProperty(TXN_LOG_PARTITIONSIZE_KEY, TXN_LOG_PARTITIONSIZE_DEFAULT,
PropertyInterpreters.getLongPropertyInterpreter());
}
-
+
public int getLogDiskSectorSize() {
return accessor.getProperty(TXN_LOG_DISKSECTORSIZE_KEY, TXN_LOG_DISKSECTORSIZE_DEFAULT,
PropertyInterpreters.getIntegerPropertyInterpreter());
@@ -92,7 +85,7 @@
return accessor.getProperty(TXN_LOG_CHECKPOINT_HISTORY_KEY, TXN_LOG_CHECKPOINT_HISTORY_DEFAULT,
PropertyInterpreters.getIntegerPropertyInterpreter());
}
-
+
public int getEntityToDatasetLockEscalationThreshold() {
return accessor.getProperty(TXN_LOCK_ESCALATIONTHRESHOLD_KEY, TXN_LOCK_ESCALATIONTHRESHOLD_DEFAULT,
PropertyInterpreters.getIntegerPropertyInterpreter());
@@ -102,12 +95,12 @@
return accessor.getProperty(TXN_LOCK_SHRINKTIMER_KEY, TXN_LOCK_SHRINKTIMER_DEFAULT,
PropertyInterpreters.getIntegerPropertyInterpreter());
}
-
+
public int getTimeoutWaitThreshold() {
return accessor.getProperty(TXN_LOCK_TIMEOUT_WAITTHRESHOLD_KEY, TXN_LOCK_TIMEOUT_WAITTHRESHOLD_DEFAULT,
PropertyInterpreters.getIntegerPropertyInterpreter());
}
-
+
public int getTimeoutSweepThreshold() {
return accessor.getProperty(TXN_LOCK_TIMEOUT_SWEEPTHRESHOLD_KEY, TXN_LOCK_TIMEOUT_SWEEPTHRESHOLD_DEFAULT,
PropertyInterpreters.getIntegerPropertyInterpreter());
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogManagerProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogManagerProperties.java
index 9387687..3e6ad99 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogManagerProperties.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogManagerProperties.java
@@ -49,7 +49,7 @@
this.logPageSize = txnProperties.getLogBufferPageSize();
this.numLogPages = txnProperties.getLogBufferNumPages();
long logPartitionSize = txnProperties.getLogPartitionSize();
- this.logDir = txnProperties.getLogDirectory() + nodeId;
+ this.logDir = txnProperties.getLogDirectory(nodeId);
this.logFilePrefix = DEFAULT_LOG_FILE_PREFIX;
this.groupCommitWaitPeriod = txnProperties.getGroupCommitInterval();
diff --git a/asterix-common/src/main/resources/schema/asterix-conf.xsd b/asterix-common/src/main/resources/schema/asterix-conf.xsd
index 5aefdbd..f461723 100644
--- a/asterix-common/src/main/resources/schema/asterix-conf.xsd
+++ b/asterix-common/src/main/resources/schema/asterix-conf.xsd
@@ -13,6 +13,8 @@
<xs:element name="name" type="xs:string" />
<xs:element name="value" type="xs:string" />
<xs:element name="description" type="xs:string" />
+ <xs:element name="txnLogDirPath" type="xs:string" />
+
<!-- definition of complex elements -->
<xs:element name="store">
@@ -32,6 +34,15 @@
</xs:sequence>
</xs:complexType>
</xs:element>
+
+ <xs:element name="transactionLogDir">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="mg:ncId" />
+ <xs:element ref="mg:txnLogDirPath" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
<xs:element name="property">
<xs:complexType>
@@ -50,6 +61,7 @@
<xs:element ref="mg:metadataNode" minOccurs="0"/>
<xs:element ref="mg:store" maxOccurs="unbounded" />
<xs:element ref="mg:coredump" maxOccurs="unbounded" />
+ <xs:element ref="mg:transactionLogDir" maxOccurs="unbounded"/>
<xs:element ref="mg:property" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
diff --git a/asterix-events/src/main/resources/schema/cluster.xsd b/asterix-events/src/main/resources/schema/cluster.xsd
index c0cd309..f0d5bd9 100644
--- a/asterix-events/src/main/resources/schema/cluster.xsd
+++ b/asterix-events/src/main/resources/schema/cluster.xsd
@@ -18,9 +18,9 @@
<xs:element name="java_home" type="xs:string" />
<xs:element name="username" type="xs:string" />
<xs:element name="web_port" type="xs:string" />
- <xs:element name="client_port" type="xs:string" />
- <xs:element name="cluster_port" type="xs:string" />
- <xs:element name="http_port" type="xs:string" />
+ <xs:element name="client_port" type="xs:integer" />
+ <xs:element name="cluster_port" type="xs:integer" />
+ <xs:element name="http_port" type="xs:integer" />
<!-- definition of complex elements -->
<xs:element name="working_dir">
@@ -40,6 +40,9 @@
<xs:element ref="cl:cluster_ip" />
<xs:element ref="cl:java_home" minOccurs="0" />
<xs:element ref="cl:log_dir" minOccurs="0" />
+ <xs:element ref="cl:client_port" />
+ <xs:element ref="cl:cluster_port" />
+ <xs:element ref="cl:http_port" />
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -53,17 +56,6 @@
</xs:complexType>
</xs:element>
- <xs:element name="ports">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="cl:web_port" />
- <xs:element ref="cl:client_port" />
- <xs:element ref="cl:cluster_port" />
- <xs:element ref="cl:http_port" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
<xs:element name="env">
<xs:complexType>
<xs:sequence>
@@ -97,7 +89,6 @@
<xs:element ref="cl:txn_log_dir" minOccurs="0" />
<xs:element ref="cl:store" minOccurs="0" />
<xs:element ref="cl:iodevices" minOccurs="0" />
- <xs:element ref="cl:ports" />
<xs:element ref="cl:working_dir" />
<xs:element ref="cl:master_node" />
<xs:element ref="cl:node" maxOccurs="unbounded" />
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
index 38be234..1fd0739 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
@@ -48,11 +48,12 @@
import org.apache.commons.io.IOUtils;
import edu.uci.ics.asterix.common.configuration.AsterixConfiguration;
-import edu.uci.ics.asterix.common.configuration.Store;
import edu.uci.ics.asterix.common.configuration.Coredump;
+import edu.uci.ics.asterix.common.configuration.Store;
+import edu.uci.ics.asterix.common.configuration.TransactionLogDir;
import edu.uci.ics.asterix.event.driver.EventDriver;
-import edu.uci.ics.asterix.event.management.EventrixClient;
import edu.uci.ics.asterix.event.management.EventUtil;
+import edu.uci.ics.asterix.event.management.EventrixClient;
import edu.uci.ics.asterix.event.schema.cluster.Cluster;
import edu.uci.ics.asterix.event.schema.cluster.Env;
import edu.uci.ics.asterix.event.schema.cluster.Node;
@@ -116,12 +117,13 @@
clusterProperties.add(new Property("CLIENT_NET_IP", cluster.getMasterNode().getClientIp()));
clusterProperties.add(new Property("CLUSTER_NET_IP", cluster.getMasterNode().getClusterIp()));
- int clusterNetPort = cluster.getPorts() != null && cluster.getPorts().getClusterPort() != null ? Integer
- .parseInt(cluster.getPorts().getClusterPort()) : CLUSTER_NET_PORT_DEFAULT;
- int clientNetPort = cluster.getPorts() != null && cluster.getPorts().getClientPort() != null ? Integer
- .parseInt(cluster.getPorts().getClientPort()) : CLIENT_NET_PORT_DEFAULT;
- int httpPort = cluster.getPorts() != null && cluster.getPorts().getHttpPort() != null ? Integer
- .parseInt(cluster.getPorts().getHttpPort()) : HTTP_PORT_DEFAULT;
+ int clusterNetPort = cluster.getMasterNode().getClusterPort() != null ? cluster.getMasterNode()
+ .getClusterPort().intValue() : CLUSTER_NET_PORT_DEFAULT;
+ int clientNetPort = cluster.getMasterNode().getClientPort() != null ? cluster.getMasterNode().getClientPort()
+ .intValue() : CLIENT_NET_PORT_DEFAULT;
+ int httpPort = cluster.getMasterNode().getHttpPort() != null ? cluster.getMasterNode().getHttpPort().intValue()
+ : HTTP_PORT_DEFAULT;
+
clusterProperties.add(new Property("CLIENT_NET_PORT", "" + clientNetPort));
clusterProperties.add(new Property("CLUSTER_NET_PORT", "" + clusterNetPort));
clusterProperties.add(new Property("HTTP_PORT", "" + httpPort));
@@ -241,11 +243,17 @@
List<Coredump> coredump = new ArrayList<Coredump>();
String coredumpDir = null;
+ List<TransactionLogDir> txnLogDirs = new ArrayList<TransactionLogDir>();
+ String txnLogDir = null;
for (Node node : cluster.getNode()) {
coredumpDir = node.getLogDir() == null ? cluster.getLogDir() : node.getLogDir();
coredump.add(new Coredump(asterixInstanceName + "_" + node.getId(), coredumpDir));
+
+ txnLogDir = node.getTxnLogDir() == null ? cluster.getTxnLogDir() : node.getTxnLogDir();
+ txnLogDirs.add(new TransactionLogDir(asterixInstanceName + "_" + node.getId(), txnLogDir));
}
configuration.setCoredump(coredump);
+ configuration.setTransactionLogDir(txnLogDirs);
File asterixConfDir = new File(InstallerDriver.getAsterixDir() + File.separator + asterixInstanceName);
asterixConfDir.mkdirs();
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
index e074fad..1c01fe5 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
@@ -45,7 +45,6 @@
private final String metadataNodeId;
private final String asterixVersion;
private final List<BackupInfo> backupInfo;
- private final String webInterfaceUrl;
private AsterixRuntimeState runtimeState;
private State previousState;
@@ -60,13 +59,7 @@
this.asterixVersion = asterixVersion;
this.createdTimestamp = new Date();
this.backupInfo = new ArrayList<BackupInfo>();
- int webPort = 19001;
- for (Property p : asterixConfiguration.getProperty()) {
- if (p.getName().equalsIgnoreCase("web.port")) {
- webPort = Integer.parseInt(p.getValue());
- }
- }
- this.webInterfaceUrl = "http://" + cluster.getMasterNode().getClientIp() + ":" + webPort;
+
}
public Date getModifiedTimestamp() {
@@ -118,7 +111,8 @@
StringBuffer buffer = new StringBuffer();
buffer.append("Name:" + name + "\n");
buffer.append("Created:" + createdTimestamp + "\n");
- buffer.append("Web-Url:" + webInterfaceUrl + "\n");
+
+ buffer.append("Web-Url:" + getWebInterfaceUrl() + "\n");
buffer.append("State:" + state);
if (!state.equals(State.UNUSABLE) && stateChangeTimestamp != null) {
buffer.append(" (" + stateChangeTimestamp + ")" + "\n");
@@ -143,6 +137,13 @@
}
public String getWebInterfaceUrl() {
+ int webPort = 19001;
+ for (Property p : asterixConfiguration.getProperty()) {
+ if (p.getName().equalsIgnoreCase("web.port")) {
+ webPort = Integer.parseInt(p.getValue());
+ }
+ }
+ String webInterfaceUrl = "http://" + cluster.getMasterNode().getClientIp() + ":" + webPort;
return webInterfaceUrl;
}
@@ -176,12 +177,29 @@
buffer.append("\n");
buffer.append("Asterix Configuration\n");
+ int lenMax = 0;
for (Property property : asterixConfiguration.getProperty()) {
- buffer.append(property.getName() + ":" + property.getValue() + "\n");
+ int nextLen = property.getName().length();
+ if (nextLen > lenMax) {
+ lenMax = nextLen;
+ }
+ }
+ for (Property property : asterixConfiguration.getProperty()) {
+ buffer.append(property.getName() + getIndentation(property.getName(), lenMax) + ":" + property.getValue()
+ + "\n");
}
}
+ private String getIndentation(String name, int lenMax) {
+ int len = name.length();
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < lenMax - len; i++) {
+ buf.append(" ");
+ }
+ return buf.toString();
+ }
+
public State getPreviousState() {
return previousState;
}
diff --git a/asterix-installer/src/main/resources/clusters/local/local.xml b/asterix-installer/src/main/resources/clusters/local/local.xml
index 3f739de..58d0f97 100644
--- a/asterix-installer/src/main/resources/clusters/local/local.xml
+++ b/asterix-installer/src/main/resources/clusters/local/local.xml
@@ -6,11 +6,6 @@
</working_dir>
<log_dir>/tmp/asterix/logs</log_dir>
<txn_log_dir>/tmp/asterix/logs</txn_log_dir>
- <ports>
- <cluster_port>1099</cluster_port>
- <client_port>1098</client_port>
- <http_port>8888</http_port>
- </ports>
<iodevices>/tmp</iodevices>
<store>asterix/storage</store>
<java_home></java_home>
@@ -18,6 +13,9 @@
<id>master</id>
<client_ip>127.0.0.1</client_ip>
<cluster_ip>127.0.0.1</cluster_ip>
+ <cluster_port>1099</cluster_port>
+ <client_port>1098</client_port>
+ <http_port>8888</http_port>
</master_node>
<node>
<id>node1</id>
diff --git a/asterix-installer/src/main/resources/conf/asterix-configuration.xml b/asterix-installer/src/main/resources/conf/asterix-configuration.xml
index 8394a96..c9907e3 100644
--- a/asterix-installer/src/main/resources/conf/asterix-configuration.xml
+++ b/asterix-installer/src/main/resources/conf/asterix-configuration.xml
@@ -80,14 +80,6 @@
</property>
<property>
- <name>txn.log.directory</name>
- <value>asterix_logs/</value>
- <description>The directory location for transaction logs. (Default =
- "asterix_logs/")
- </description>
- </property>
-
- <property>
<name>txn.log.buffer.numpages</name>
<value>8</value>
<description>The number of in-memory log buffer pages. (Default = "8")