made the transaction log directory configurable
diff --git a/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java b/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java
index 9facf0a..b6a32e3 100644
--- a/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java
+++ b/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java
@@ -41,7 +41,7 @@
public class EventDriver {
public static final String CLIENT_NODE_ID = "client_node";
- public static final Node CLIENT_NODE = new Node(CLIENT_NODE_ID, "127.0.0.1", null, null, null, null);
+ public static final Node CLIENT_NODE = new Node(CLIENT_NODE_ID, "127.0.0.1", null, null, null, null, null);
private static String eventsDir;
private static Events events;
diff --git a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java
index 81fabac..7cbb515 100644
--- a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java
+++ b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java
@@ -191,12 +191,12 @@
}
if (nodeid.equals(cluster.getMasterNode().getId())) {
- String logDir = cluster.getMasterNode().getLogdir() == null ? cluster.getLogdir() : cluster.getMasterNode()
- .getLogdir();
+ String logDir = cluster.getMasterNode().getLogDir() == null ? cluster.getLogDir() : cluster.getMasterNode()
+ .getLogDir();
String javaHome = cluster.getMasterNode().getJavaHome() == null ? cluster.getJavaHome() : cluster
.getMasterNode().getJavaHome();
return new Node(cluster.getMasterNode().getId(), cluster.getMasterNode().getClusterIp(), javaHome, logDir,
- null, null);
+ null, null, null);
}
List<Node> nodeList = cluster.getNode();
diff --git a/asterix-events/src/main/resources/events/backup/backup.sh b/asterix-events/src/main/resources/events/backup/backup.sh
index 556ca39..fc6e3cc 100755
--- a/asterix-events/src/main/resources/events/backup/backup.sh
+++ b/asterix-events/src/main/resources/events/backup/backup.sh
@@ -3,7 +3,7 @@
ASTERIX_IODEVICES=$3
NODE_STORE=$4
ASTERIX_ROOT_METADATA_DIR=$5
-TXN_LOG_DIR_NAME=$6
+TXN_LOG_DIR=$6
BACKUP_ID=$7
BACKUP_DIR=$8
BACKUP_TYPE=$9
@@ -20,7 +20,6 @@
for nodeIODevice in $nodeIODevices
do
STORE_DIR=$nodeIODevice/$NODE_STORE
- TXN_LOG_DIR=$nodeIODevice/$TXN_LOG_DIR_NAME
NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/
# make the destination directory
@@ -46,7 +45,6 @@
for nodeIODevice in $nodeIODevices
do
STORE_DIR=$nodeIODevice/$NODE_STORE
- TXN_LOG_DIR=$nodeIODevice/$TXN_LOG_DIR_NAME
NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID
# create the backup directory, if it does not exists
diff --git a/asterix-events/src/main/resources/events/restore/restore.sh b/asterix-events/src/main/resources/events/restore/restore.sh
index 6396eec..88c5a6f 100755
--- a/asterix-events/src/main/resources/events/restore/restore.sh
+++ b/asterix-events/src/main/resources/events/restore/restore.sh
@@ -3,7 +3,7 @@
ASTERIX_IODEVICES=$3
NODE_STORE=$4
ASTERIX_ROOT_METADATA_DIR=$5
-TXN_LOG_DIR_NAME=$6
+TXN_LOG_DIR=$6
BACKUP_ID=$7
BACKUP_DIR=$8
BACKUP_TYPE=$9
@@ -33,8 +33,9 @@
rm -rf $DEST_STORE_DIR/$SOURCE_STORE_DIR
# remove the existing log directory
- DEST_LOG_DIR=$iodevice/$TXN_LOG_DIR_NAME/
- rm -rf $DEST_LOG_DIR
+ DEST_LOG_DIR=$TXN_LOG_DIR
+ rm -rf $DEST_LOG_DIR/*
+ TXN_LOG_DIR_NAME=${TXN_LOG_DIR%/*}
# remove the existing asterix metadata directory
rm -rf $iodevice/$ASTERIX_ROOT_METADATA_DIR
@@ -52,7 +53,7 @@
$HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/$ASTERIX_ROOT_METADATA_DIR $iodevice/
# copy transaction logs directory
- $HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/$TXN_LOG_DIR_NAME $iodevice/
+ $HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/$TXN_LOG_DIR_NAME $$TXN_LOG_DIR/
fi
else
@@ -67,7 +68,7 @@
cp -r $NODE_BACKUP_DIR/$ASTERIX_ROOT_METADATA_DIR $iodevice/
# copy transaction logs directory
- cp -r $NODE_BACKUP_DIR/$TXN_LOG_DIR_NAME $iodevice/
+ cp -r $NODE_BACKUP_DIR/$TXN_LOG_DIR_NAME $TXN_LOG_DIR/
fi
fi
diff --git a/asterix-events/src/main/resources/schema/cluster.xsd b/asterix-events/src/main/resources/schema/cluster.xsd
index 4292418..718d7b0 100644
--- a/asterix-events/src/main/resources/schema/cluster.xsd
+++ b/asterix-events/src/main/resources/schema/cluster.xsd
@@ -4,10 +4,11 @@
<!-- definition of simple types -->
<xs:element name="name" type="xs:string" />
- <xs:element name="logdir" type="xs:string" />
+ <xs:element name="log_dir" type="xs:string" />
+ <xs:element name="txn_log_dir" type="xs:string" />
<xs:element name="id" type="xs:string" />
- <xs:element name="client-ip" type="xs:string" />
- <xs:element name="cluster-ip" type="xs:string" />
+ <xs:element name="client_ip" type="xs:string" />
+ <xs:element name="cluster_ip" type="xs:string" />
<xs:element name="key" type="xs:string" />
<xs:element name="value" type="xs:string" />
<xs:element name="dir" type="xs:string" />
@@ -18,7 +19,7 @@
<xs:element name="username" type="xs:string" />
<!-- definition of complex elements -->
- <xs:element name="workingDir">
+ <xs:element name="working_dir">
<xs:complexType>
<xs:sequence>
<xs:element ref="cl:dir" />
@@ -27,14 +28,14 @@
</xs:complexType>
</xs:element>
- <xs:element name="master-node">
+ <xs:element name="master_node">
<xs:complexType>
<xs:sequence>
<xs:element ref="cl:id" />
- <xs:element ref="cl:client-ip" />
- <xs:element ref="cl:cluster-ip" />
+ <xs:element ref="cl:client_ip" />
+ <xs:element ref="cl:cluster_ip" />
<xs:element ref="cl:java_home" minOccurs="0" />
- <xs:element ref="cl:logdir" minOccurs="0" />
+ <xs:element ref="cl:log_dir" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -60,9 +61,10 @@
<xs:complexType>
<xs:sequence>
<xs:element ref="cl:id" />
- <xs:element ref="cl:cluster-ip" />
+ <xs:element ref="cl:cluster_ip" />
<xs:element ref="cl:java_home" minOccurs="0" />
- <xs:element ref="cl:logdir" minOccurs="0" />
+ <xs:element ref="cl:log_dir" minOccurs="0" />
+ <xs:element ref="cl:txn_log_dir" minOccurs="0" />
<xs:element ref="cl:store" minOccurs="0" />
<xs:element ref="cl:iodevices" minOccurs="0" />
</xs:sequence>
@@ -76,11 +78,12 @@
<xs:element ref="cl:username" />
<xs:element ref="cl:env" minOccurs="0" />
<xs:element ref="cl:java_home" minOccurs="0" />
- <xs:element ref="cl:logdir" minOccurs="0" />
+ <xs:element ref="cl:log_dir" minOccurs="0" />
+ <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:workingDir" />
- <xs:element ref="cl:master-node" />
+ <xs:element ref="cl:working_dir" />
+ <xs:element ref="cl:master_node" />
<xs:element ref="cl:node" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
index 129e416..43400ea 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
@@ -26,8 +26,9 @@
cluster.setWorkingDir(new WorkingDir(workingDir, true));
cluster.setIodevices(workingDir);
cluster.setStore("storage");
- cluster.setLogdir(workingDir + File.separator + "logs");
- cluster.setJavaHome(System.getenv("JAVA_HOME"));
+ cluster.setLogDir(workingDir + File.separator + "logs");
+ cluster.setTxnLogDir(workingDir + File.separator + "txnLogs");
+ cluster.setJavaHome(System.getProperty("java.home"));
JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
Marshaller marshaller = ctx.createMarshaller();
@@ -43,7 +44,7 @@
configuration.getZookeeper().setHomeDir(
InstallerDriver.getManagixHome() + File.separator + InstallerDriver.MANAGIX_INTERNAL_DIR
+ File.separator + "zookeeper_home");
- configuration.getZookeeper().getServers().setJavaHome(System.getenv("JAVA_HOME"));
+ configuration.getZookeeper().getServers().setJavaHome(System.getProperty("java.home"));
marshaller = ctx.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
index e5700e9..f469fe4 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
@@ -109,8 +109,8 @@
serverIds.add(cluster.getMasterNode().getId());
MasterNode masterNode = cluster.getMasterNode();
- Node master = new Node(masterNode.getId(), masterNode.getClusterIp(), masterNode.getJavaHome(), masterNode
- .getLogdir(), null, null);
+ Node master = new Node(masterNode.getId(), masterNode.getClusterIp(), masterNode.getJavaHome(),
+ masterNode.getLogDir(), null, null, null);
ipAddresses.add(masterNode.getClusterIp());
valid = valid & validateNodeConfiguration(master, cluster);
@@ -162,8 +162,8 @@
private void validateClusterProperties(Cluster cluster) {
List<String> tempDirs = new ArrayList<String>();
- if (cluster.getLogdir() != null && checkTemporaryPath(cluster.getLogdir())) {
- tempDirs.add("Log directory: " + cluster.getLogdir());
+ if (cluster.getLogDir() != null && checkTemporaryPath(cluster.getLogDir())) {
+ tempDirs.add("Log directory: " + cluster.getLogDir());
}
if (cluster.getIodevices() != null && checkTemporaryPath(cluster.getIodevices())) {
tempDirs.add("IO Device: " + cluster.getIodevices());
@@ -190,8 +190,8 @@
}
}
- if (node.getLogdir() == null || node.getLogdir().length() == 0) {
- if (cluster.getLogdir() == null || cluster.getLogdir().length() == 0) {
+ if (node.getLogDir() == null || node.getLogDir().length() == 0) {
+ if (cluster.getLogDir() == null || cluster.getLogDir().length() == 0) {
valid = false;
LOGGER.fatal("log_dir not defined at cluster/node level for node: " + node.getId() + ERROR);
}
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 af68614..c9395ca 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
@@ -81,7 +81,7 @@
}
public static void createAsterixZip(AsterixInstance asterixInstance) throws IOException, InterruptedException,
- JAXBException {
+ JAXBException, InstallerException {
String modifiedZipPath = injectAsterixPropertyFile(InstallerDriver.getAsterixZip(), asterixInstance);
injectAsterixLogPropertyFile(modifiedZipPath, asterixInstance);
@@ -106,7 +106,7 @@
+ "asterix"));
clusterProperties.add(new Property("CLUSTER_NET_IP", cluster.getMasterNode().getClusterIp()));
clusterProperties.add(new Property("CLIENT_NET_IP", cluster.getMasterNode().getClientIp()));
- clusterProperties.add(new Property("LOG_DIR", cluster.getLogdir()));
+ clusterProperties.add(new Property("LOG_DIR", cluster.getLogDir()));
clusterProperties.add(new Property("JAVA_HOME", cluster.getJavaHome()));
clusterProperties.add(new Property("WORKING_DIR", cluster.getWorkingDir().getDir()));
cluster.setEnv(new Env(clusterProperties));
@@ -129,7 +129,7 @@
}
private static String injectAsterixLogPropertyFile(String origZipFile, AsterixInstance asterixInstance)
- throws IOException {
+ throws IOException, InstallerException {
String asterixInstanceDir = InstallerDriver.getAsterixDir() + File.separator + asterixInstance.getName();
unzip(origZipFile, asterixInstanceDir);
File sourceJar1 = new File(asterixInstanceDir + File.separator + "lib" + File.separator + "asterix-app-"
@@ -141,7 +141,7 @@
txnLogProperties.load(in);
}
- writeAsterixLogConfigurationFile(asterixInstance.getName(), asterixInstance.getCluster(), txnLogProperties);
+ writeAsterixLogConfigurationFile(asterixInstance, txnLogProperties);
File sourceJar2 = new File(asterixInstanceDir + File.separator + "lib" + File.separator + "asterix-app-"
+ asterixInstance.getAsterixVersion() + ".jar");
@@ -232,19 +232,31 @@
+ ASTERIX_CONFIGURATION_FILE));
}
- private static void writeAsterixLogConfigurationFile(String asterixInstanceName, Cluster cluster,
- Properties logProperties) throws IOException {
+ private static void writeAsterixLogConfigurationFile(AsterixInstance asterixInstance, Properties logProperties)
+ throws IOException, InstallerException {
+ String asterixInstanceName = asterixInstance.getName();
+ Cluster cluster = asterixInstance.getCluster();
StringBuffer conf = new StringBuffer();
for (Map.Entry<Object, Object> p : logProperties.entrySet()) {
conf.append(p.getKey() + "=" + p.getValue() + "\n");
}
for (Node node : cluster.getNode()) {
- String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
- String txnLogDir = iodevices.split(",")[0].trim() + File.separator + InstallerUtil.TXN_LOG_DIR;
+ String txnLogDir = node.getTxnLogDir() == null ? cluster.getTxnLogDir() : node.getTxnLogDir();
+ if (txnLogDir == null) {
+ throw new InstallerException("Transaction log directory (txn_log_dir) not configured for node: "
+ + node.getId());
+ }
conf.append(asterixInstanceName + "_" + node.getId() + "." + TXN_LOG_DIR_KEY_SUFFIX + "=" + txnLogDir
+ "\n");
}
+ List<edu.uci.ics.asterix.common.configuration.Property> properties = asterixInstance.getAsterixConfiguration()
+ .getProperty();
+ for (edu.uci.ics.asterix.common.configuration.Property p : properties) {
+ if (p.getName().trim().toLowerCase().contains("log")) {
+ conf.append(p.getValue() + "=" + p.getValue());
+ }
+ }
dumpToFile(InstallerDriver.getAsterixDir() + File.separator + asterixInstanceName + File.separator
+ "log.properties", conf.toString());
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/events/PatternCreator.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/events/PatternCreator.java
index 0d50bbf..4216978 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/events/PatternCreator.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/events/PatternCreator.java
@@ -173,16 +173,18 @@
String workingDir = cluster.getWorkingDir().getDir();
String backupId = "" + instance.getBackupInfo().size();
String iodevices;
+ String txnLogDir;
String store;
String pargs;
List<Pattern> patternList = new ArrayList<Pattern>();
for (Node node : cluster.getNode()) {
Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
iodevices = node.getIodevices() == null ? instance.getCluster().getIodevices() : node.getIodevices();
+ txnLogDir = node.getTxnLogDir() == null ? instance.getCluster().getTxnLogDir() : node.getTxnLogDir();
store = node.getStore() == null ? cluster.getStore() : node.getStore();
pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + store + " "
- + BackupCommand.ASTERIX_ROOT_METADATA_DIR + " " + InstallerUtil.TXN_LOG_DIR + " " + backupId + " "
- + backupDir + " " + "local" + " " + node.getId();
+ + BackupCommand.ASTERIX_ROOT_METADATA_DIR + " " + txnLogDir + " " + backupId + " " + backupDir
+ + " " + "local" + " " + node.getId();
Event event = new Event("backup", nodeid, pargs);
patternList.add(new Pattern(null, 1, null, event));
}
@@ -407,7 +409,7 @@
private Patterns createRemoveAsterixLogDirPattern(AsterixInstance instance) throws Exception {
List<Pattern> patternList = new ArrayList<Pattern>();
Cluster cluster = instance.getCluster();
- String pargs = instance.getCluster().getLogdir();
+ String pargs = instance.getCluster().getLogDir();
Nodeid nodeid = new Nodeid(new Value(null, cluster.getMasterNode().getId()));
Event event = new Event("file_delete", nodeid, pargs);
patternList.add(new Pattern(null, 1, null, event));
diff --git a/asterix-installer/src/main/resources/clusters/local/local.xml b/asterix-installer/src/main/resources/clusters/local/local.xml
index d397bcd..ff5e2f4 100644
--- a/asterix-installer/src/main/resources/clusters/local/local.xml
+++ b/asterix-installer/src/main/resources/clusters/local/local.xml
@@ -1,21 +1,22 @@
<cluster xmlns="cluster">
<name>local</name>
- <workingDir>
+ <working_dir>
<dir>/tmp/asterix-installer</dir>
<NFS>true</NFS>
- </workingDir>
- <logdir>/tmp/asterix/logs</logdir>
+ </working_dir>
+ <log_dir>/tmp/asterix/logs</log_dir>
+ <txn_log_dir>/tmp/asterix/logs</txn_log_dir>
<iodevices>/tmp</iodevices>
<store>asterix/storage</store>
<java_home></java_home>
<java_opts>-Xmx1024m</java_opts>
- <master-node>
+ <master_node>
<id>master</id>
- <client-ip>127.0.0.1</client-ip>
- <cluster-ip>127.0.0.1</cluster-ip>
- </master-node>
+ <client_ip>127.0.0.1</client_ip>
+ <cluster_ip>127.0.0.1</cluster_ip>
+ </master_node>
<node>
<id>node1</id>
- <cluster-ip>127.0.0.1</cluster-ip>
+ <cluster_ip>127.0.0.1</cluster_ip>
</node>
</cluster>