1) fixes issue 298: Managix should backup/restore hidden files under asterix storage
2) changed zookeeper shutdown to user kill -15 instead of kill -9
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization_managix@1456 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-events/src/main/resources/events/backup/backup.sh b/asterix-events/src/main/resources/events/backup/backup.sh
index 601b81d..556ca39 100755
--- a/asterix-events/src/main/resources/events/backup/backup.sh
+++ b/asterix-events/src/main/resources/events/backup/backup.sh
@@ -1,32 +1,44 @@
-echo $@ >> ~/backup.log
WORKING_DIR=$1
ASTERIX_INSTANCE_NAME=$2
ASTERIX_IODEVICES=$3
NODE_STORE=$4
ASTERIX_ROOT_METADATA_DIR=$5
-BACKUP_ID=$6
-BACKUP_DIR=$7
-BACKUP_TYPE=$8
-NODE_ID=$9
+TXN_LOG_DIR_NAME=$6
+BACKUP_ID=$7
+BACKUP_DIR=$8
+BACKUP_TYPE=$9
+NODE_ID=${10}
nodeIODevices=$(echo $ASTERIX_IODEVICES | tr "," "\n")
if [ $BACKUP_TYPE == "hdfs" ];
then
- HDFS_URL=${10}
- HADOOP_VERSION=${11}
+ HDFS_URL=${11}
+ HADOOP_VERSION=${12}
export HADOOP_HOME=$WORKING_DIR/hadoop-$HADOOP_VERSION
index=1
for nodeIODevice in $nodeIODevices
do
STORE_DIR=$nodeIODevice/$NODE_STORE
- MANGLED_DIR_NAME=`echo $STORE_DIR | tr / _`
- NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_DIR_NAME
- $HADOOP_HOME/bin/hadoop fs -copyFromLocal $STORE_DIR/ $HDFS_URL/$NODE_BACKUP_DIR/
+ TXN_LOG_DIR=$nodeIODevice/$TXN_LOG_DIR_NAME
+ NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/
+
+ # make the destination directory
+ $HADOOP_HOME/bin/hadoop fs -mkdir $STORE_DIR $HDFS_URL/$NODE_BACKUP_DIR
+
+ # copy store directory
+ $HADOOP_HOME/bin/hadoop fs -copyFromLocal $STORE_DIR $HDFS_URL/$NODE_BACKUP_DIR/
+
+ # copy asterix root metadata directory and log directory from the primary(first) iodevice
if [ $index -eq 1 ];
then
- $HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeIODevice/$ASTERIX_ROOT_METADATA_DIR $HDFS_URL/$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/
+ # copy asterix root metadata directory
+ $HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeIODevice/$ASTERIX_ROOT_METADATA_DIR $HDFS_URL/$NODE_BACKUP_DIR/
+
+ # copy log directory
+ $HADOOP_HOME/bin/hadoop fs -copyFromLocal $TXN_LOG_DIR $HDFS_URL/$NODE_BACKUP_DIR/
fi
+
index=`expr $index + 1`
done
else
@@ -34,17 +46,27 @@
for nodeIODevice in $nodeIODevices
do
STORE_DIR=$nodeIODevice/$NODE_STORE
- MANGLED_DIR_NAME=`echo $STORE_DIR | tr / _`
- NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_DIR_NAME
+ 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
if [ ! -d $NODE_BACKUP_DIR ];
then
mkdir -p $NODE_BACKUP_DIR
fi
- cp -r $STORE_DIR/* $NODE_BACKUP_DIR/
+
+ # copy store directory
+ cp -r $STORE_DIR $NODE_BACKUP_DIR/
+
+ # copy asterix root metadata directory and log directory from the primary(first) iodevice
if [ $index -eq 1 ];
then
- cp -r $nodeIODevice/$ASTERIX_ROOT_METADATA_DIR $BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/
+ cp -r $nodeIODevice/$ASTERIX_ROOT_METADATA_DIR $NODE_BACKUP_DIR/
+
+ # copy log directory
+ cp -r $TXN_LOG_DIR $NODE_BACKUP_DIR/
fi
+
index=`expr $index + 1`
done
fi
diff --git a/asterix-events/src/main/resources/events/restore/restore.sh b/asterix-events/src/main/resources/events/restore/restore.sh
index 85e3eb3..6396eec 100755
--- a/asterix-events/src/main/resources/events/restore/restore.sh
+++ b/asterix-events/src/main/resources/events/restore/restore.sh
@@ -3,51 +3,73 @@
ASTERIX_IODEVICES=$3
NODE_STORE=$4
ASTERIX_ROOT_METADATA_DIR=$5
-BACKUP_ID=$6
-BACKUP_DIR=$7
-BACKUP_TYPE=$8
-NODE_ID=$9
-HDFS_URL=${10}
-HADOOP_VERSION=${11}
+TXN_LOG_DIR_NAME=$6
+BACKUP_ID=$7
+BACKUP_DIR=$8
+BACKUP_TYPE=$9
+NODE_ID=${10}
+HDFS_URL=${11}
+HADOOP_VERSION=${12}
+HADOOP_HOME=$WORKING_DIR/hadoop-$HADOOP_VERSION
-export HADOOP_HOME=$WORKING_DIR/hadoop-$HADOOP_VERSION
iodevices=$(echo $ASTERIX_IODEVICES | tr "," "\n")
index=1
for iodevice in $iodevices
do
- MANGLED_BACKUP_DIR=`echo $iodevice | tr / _`
- NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_BACKUP_DIR
- DEST_DIR=$iodevice/$NODE_STORE/
- if [ ! -d $DEST_DIR ]
- then
- mkdir -p $DEST_DIR
- else
- rm -rf $DEST_DIR
+ NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID
+
+ # remove the existing store directory
+ STORE_DIR=$iodevice/$NODE_STORE
+
+ # if STORE_DIR ends with a /, remove it
+ if [ ${STORE_DIR:${#STORE_DIR}-1} == "/" ];
+ then
+ STORE_DIR=${STORE_DIR:0:${#STORE_DIR}-1}
fi
- if [ ! -d $iodevice/$ASTERIX_ROOT_METADATA_DIR ]
- then
- mkdir -p $iodevice/$ASTERIX_ROOT_METADATA_DIR
- else
- rm -rf $iodevice/$ASTERIX_ROOT_METADATA_DIR
- fi
+ DEST_STORE_DIR=${STORE_DIR%/*}
+ SOURCE_STORE_DIR=${NODE_STORE##*/}
+ 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
+
+ # remove the existing asterix metadata directory
+ rm -rf $iodevice/$ASTERIX_ROOT_METADATA_DIR
if [ $BACKUP_TYPE == "hdfs" ];
then
- $HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/* $DEST_DIR/
- if [ $index -eq 1 ];
- then
- $HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$ASTERIX_ROOT_METADATA_DIR $iodevice/
- fi
+ # RESTORE FROM HDFS BACKUP
+
+ # copy store directory
+ $HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/$SOURCE_STORE_DIR $DEST_STORE_DIR/
+
+ # copy asterix metadata root directory and txn log directory
+ if [ $index -eq 1 ];
+ then
+ $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/
+ fi
+
else
- echo "cp -r $NODE_BACKUP_DIR/* $DEST_DIR/" >> ~/restore.log
- cp -r $NODE_BACKUP_DIR/* $DEST_DIR/
- if [ $index -eq 1 ];
- then
- echo "cp -r $BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$ASTERIX_ROOT_METADATA_DIR $iodevice/" >> ~/restore.log
- cp -r $BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$ASTERIX_ROOT_METADATA_DIR $iodevice/
- fi
+
+ # RESTORE FROM LOCAL BACKUP
+ # copy store directory
+ cp -r $NODE_BACKUP_DIR/$SOURCE_STORE_DIR $DEST_STORE_DIR/
+
+ # copy asterix metadata root directory and txn log directory
+ if [ $index -eq 1 ];
+ then
+ cp -r $NODE_BACKUP_DIR/$ASTERIX_ROOT_METADATA_DIR $iodevice/
+
+ # copy transaction logs directory
+ cp -r $NODE_BACKUP_DIR/$TXN_LOG_DIR_NAME $iodevice/
+ fi
+
fi
index=`expr $index + 1`
done
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 2f118c4..e2be142 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
@@ -54,6 +54,9 @@
public class InstallerUtil {
+ public static final String TXN_LOG_DIR = "txnLogs";
+ public static final String TXN_LOG_DIR_KEY_SUFFIX = "txnLogDir";
+
public static AsterixInstance createAsterixInstance(String asterixInstanceName, Cluster cluster)
throws FileNotFoundException, IOException {
Properties asterixConfProp = new Properties();
@@ -206,9 +209,9 @@
for (Node node : cluster.getNode()) {
String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
- String store = node.getStore() == null ? cluster.getStore() : node.getStore();
- String txnLogDir = iodevices.split(",")[0].trim() + File.separator + store;
- conf.append(asterixInstanceName + "_" + node.getId() + "." + "txnLogDir=" + txnLogDir + "\n");
+ String txnLogDir = iodevices.split(",")[0].trim() + File.separator + InstallerUtil.TXN_LOG_DIR;
+ conf.append(asterixInstanceName + "_" + node.getId() + "." + TXN_LOG_DIR_KEY_SUFFIX + "=" + txnLogDir
+ + "\n");
}
dumpToFile(InstallerDriver.getAsterixDir() + File.separator + asterixInstanceName + File.separator
+ "log.properties", conf.toString());
@@ -237,13 +240,13 @@
int count;
byte data[] = new byte[BUFFER_SIZE];
- //write the file to the disk
+ // write the file to the disk
FileOutputStream fos = new FileOutputStream(dst);
dest = new BufferedOutputStream(fos, BUFFER_SIZE);
while ((count = zis.read(data, 0, BUFFER_SIZE)) != -1) {
dest.write(data, 0, count);
}
- //close the output streams
+ // close the output streams
dest.flush();
dest.close();
}
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/error/VerificationUtil.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/error/VerificationUtil.java
index 05a92f2..9cb1b96e 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/error/VerificationUtil.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/error/VerificationUtil.java
@@ -48,7 +48,7 @@
args.add(node.getClusterIp());
args.add(instance.getName() + "_" + node.getId());
}
-
+ Thread.sleep(2000);
String output = InstallerUtil.executeLocalScript(VERIFY_SCRIPT_PATH,
args);
boolean ccRunning = true;
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 2184a63..f6aeafe 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
@@ -32,6 +32,7 @@
import edu.uci.ics.asterix.installer.command.BackupCommand;
import edu.uci.ics.asterix.installer.command.StopCommand;
import edu.uci.ics.asterix.installer.driver.InstallerDriver;
+import edu.uci.ics.asterix.installer.driver.InstallerUtil;
import edu.uci.ics.asterix.installer.error.VerificationUtil;
import edu.uci.ics.asterix.installer.model.AsterixInstance;
import edu.uci.ics.asterix.installer.model.BackupInfo;
@@ -42,485 +43,412 @@
public class PatternCreator {
- private ILookupService lookupService = ServiceProvider.INSTANCE
- .getLookupService();
+ private ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
- private void addInitialDelay(Pattern p, int delay, String unit) {
- Delay d = new Delay(new Value(null, "" + delay), unit);
- p.setDelay(d);
- }
+ private void addInitialDelay(Pattern p, int delay, String unit) {
+ Delay d = new Delay(new Value(null, "" + delay), unit);
+ p.setDelay(d);
+ }
- public Patterns getStartAsterixPattern(String asterixInstanceName,
- Cluster cluster) throws Exception {
- String ccLocationId = cluster.getMasterNode().getId();
- String ccLocationIp = cluster.getMasterNode().getClusterIp();
+ public Patterns getStartAsterixPattern(String asterixInstanceName, Cluster cluster) throws Exception {
+ String ccLocationId = cluster.getMasterNode().getId();
+ String ccLocationIp = cluster.getMasterNode().getClusterIp();
- String destDir = cluster.getWorkingDir().getDir() + File.separator
- + "asterix";
- List<Pattern> ps = new ArrayList<Pattern>();
+ String destDir = cluster.getWorkingDir().getDir() + File.separator + "asterix";
+ List<Pattern> ps = new ArrayList<Pattern>();
- Pattern copyHyracks = createCopyHyracksPattern(asterixInstanceName,
- cluster, ccLocationIp, destDir);
- ps.add(copyHyracks);
+ Pattern copyHyracks = createCopyHyracksPattern(asterixInstanceName, cluster, ccLocationIp, destDir);
+ ps.add(copyHyracks);
- Pattern createCC = createCCStartPattern(ccLocationId);
- addInitialDelay(createCC, 2, "sec");
- ps.add(createCC);
+ Pattern createCC = createCCStartPattern(ccLocationId);
+ addInitialDelay(createCC, 3, "sec");
+ ps.add(createCC);
- boolean copyHyracksToNC = !cluster.getWorkingDir().isNFS();
- for (Node node : cluster.getNode()) {
- if (copyHyracksToNC) {
- Pattern copyHyracksForNC = createCopyHyracksPattern(
- asterixInstanceName, cluster, node.getClusterIp(),
- destDir);
- ps.add(copyHyracksForNC);
- }
- String iodevices = node.getIodevices() == null ? cluster
- .getIodevices() : node.getIodevices();
- Pattern createNC = createNCStartPattern(cluster.getMasterNode()
- .getClusterIp(), node.getId(), asterixInstanceName + "_"
- + node.getId(), iodevices);
- addInitialDelay(createNC, 4, "sec");
- ps.add(createNC);
- }
+ boolean copyHyracksToNC = !cluster.getWorkingDir().isNFS();
+ for (Node node : cluster.getNode()) {
+ if (copyHyracksToNC) {
+ Pattern copyHyracksForNC = createCopyHyracksPattern(asterixInstanceName, cluster, node.getClusterIp(),
+ destDir);
+ ps.add(copyHyracksForNC);
+ }
+ String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
+ Pattern createNC = createNCStartPattern(cluster.getMasterNode().getClusterIp(), node.getId(),
+ asterixInstanceName + "_" + node.getId(), iodevices);
+ addInitialDelay(createNC, 5, "sec");
+ ps.add(createNC);
+ }
- Patterns patterns = new Patterns(ps);
- patterns.getPattern().addAll(
- createHadoopLibraryTransferPattern(cluster).getPattern());
- return patterns;
- }
+ Patterns patterns = new Patterns(ps);
+ patterns.getPattern().addAll(createHadoopLibraryTransferPattern(cluster).getPattern());
+ return patterns;
+ }
- public Patterns getStopCommandPattern(StopCommand stopCommand)
- throws Exception {
- List<Pattern> ps = new ArrayList<Pattern>();
- AsterixInstance asterixInstance = lookupService
- .getAsterixInstance(stopCommand.getAsterixInstanceName());
- Cluster cluster = asterixInstance.getCluster();
+ public Patterns getStopCommandPattern(StopCommand stopCommand) throws Exception {
+ List<Pattern> ps = new ArrayList<Pattern>();
+ AsterixInstance asterixInstance = lookupService.getAsterixInstance(stopCommand.getAsterixInstanceName());
+ Cluster cluster = asterixInstance.getCluster();
- String ccLocation = cluster.getMasterNode().getId();
- Pattern createCC = createCCStopPattern(ccLocation);
- addInitialDelay(createCC, 5, "sec");
- ps.add(createCC);
+ String ccLocation = cluster.getMasterNode().getId();
+ Pattern createCC = createCCStopPattern(ccLocation);
+ addInitialDelay(createCC, 5, "sec");
+ ps.add(createCC);
- String asterixInstanceName = stopCommand.getAsterixInstanceName();
- int nodeControllerIndex = 1;
- for (Node node : cluster.getNode()) {
- Pattern createNC = createNCStopPattern(node.getId(),
- asterixInstanceName + "_" + nodeControllerIndex);
- ps.add(createNC);
- nodeControllerIndex++;
- }
+ String asterixInstanceName = stopCommand.getAsterixInstanceName();
+ int nodeControllerIndex = 1;
+ for (Node node : cluster.getNode()) {
+ Pattern createNC = createNCStopPattern(node.getId(), asterixInstanceName + "_" + nodeControllerIndex);
+ ps.add(createNC);
+ nodeControllerIndex++;
+ }
- Patterns patterns = new Patterns(ps);
- return patterns;
- }
+ Patterns patterns = new Patterns(ps);
+ return patterns;
+ }
- public Patterns getBackUpAsterixPattern(AsterixInstance instance,
- Backup backupConf) throws Exception {
- BackupType backupType = BackupInfo.getBackupType(backupConf);
- Patterns patterns = null;
- switch (backupType) {
- case HDFS:
- patterns = getHDFSBackUpAsterixPattern(instance, backupConf);
- break;
- case LOCAL:
- patterns = getLocalBackUpAsterixPattern(instance, backupConf);
- break;
- }
- return patterns;
- }
+ public Patterns getBackUpAsterixPattern(AsterixInstance instance, Backup backupConf) throws Exception {
+ BackupType backupType = BackupInfo.getBackupType(backupConf);
+ Patterns patterns = null;
+ switch (backupType) {
+ case HDFS:
+ patterns = getHDFSBackUpAsterixPattern(instance, backupConf);
+ break;
+ case LOCAL:
+ patterns = getLocalBackUpAsterixPattern(instance, backupConf);
+ break;
+ }
+ return patterns;
+ }
- public Patterns getRestoreAsterixPattern(AsterixInstance instance,
- BackupInfo backupInfo) throws Exception {
- BackupType backupType = backupInfo.getBackupType();
- Patterns patterns = null;
- switch (backupType) {
- case HDFS:
- patterns = getHDFSRestoreAsterixPattern(instance, backupInfo);
- break;
- case LOCAL:
- patterns = getLocalRestoreAsterixPattern(instance, backupInfo);
- break;
- }
- return patterns;
- }
+ public Patterns getRestoreAsterixPattern(AsterixInstance instance, BackupInfo backupInfo) throws Exception {
+ BackupType backupType = backupInfo.getBackupType();
+ Patterns patterns = null;
+ switch (backupType) {
+ case HDFS:
+ patterns = getHDFSRestoreAsterixPattern(instance, backupInfo);
+ break;
+ case LOCAL:
+ patterns = getLocalRestoreAsterixPattern(instance, backupInfo);
+ break;
+ }
+ return patterns;
+ }
- private Patterns getHDFSBackUpAsterixPattern(AsterixInstance instance,
- Backup backupConf) throws Exception {
- Cluster cluster = instance.getCluster();
- String hdfsUrl = backupConf.getHdfs().getUrl();
- String hadoopVersion = backupConf.getHdfs().getVersion();
- String hdfsBackupDir = backupConf.getBackupDir();
- VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl,
- hadoopVersion, hdfsBackupDir);
- String workingDir = cluster.getWorkingDir().getDir();
- String backupId = "" + instance.getBackupInfo().size();
- String store;
- String pargs;
- String iodevices;
- 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();
- store = node.getStore() == null ? cluster.getStore() : node
- .getStore();
- pargs = workingDir + " " + instance.getName() + " " + iodevices
- + " " + store + " "
- + BackupCommand.ASTERIX_ROOT_METADATA_DIR + " " + backupId
- + " " + hdfsBackupDir + " " + "hdfs" + " " + node.getId()
- + " " + hdfsUrl + " " + hadoopVersion;
- Event event = new Event("backup", nodeid, pargs);
- patternList.add(new Pattern(null, 1, null, event));
- }
- return new Patterns(patternList);
- }
+ private Patterns getHDFSBackUpAsterixPattern(AsterixInstance instance, Backup backupConf) throws Exception {
+ Cluster cluster = instance.getCluster();
+ String hdfsUrl = backupConf.getHdfs().getUrl();
+ String hadoopVersion = backupConf.getHdfs().getVersion();
+ String hdfsBackupDir = backupConf.getBackupDir();
+ VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl, hadoopVersion, hdfsBackupDir);
+ String workingDir = cluster.getWorkingDir().getDir();
+ String backupId = "" + instance.getBackupInfo().size();
+ String store;
+ String pargs;
+ String iodevices;
+ 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();
+ store = node.getStore() == null ? cluster.getStore() : node.getStore();
+ pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + store + " "
+ + BackupCommand.ASTERIX_ROOT_METADATA_DIR + " " + InstallerUtil.TXN_LOG_DIR + " " + backupId + " "
+ + hdfsBackupDir + " " + "hdfs" + " " + node.getId() + " " + hdfsUrl + " " + hadoopVersion;
+ Event event = new Event("backup", nodeid, pargs);
+ patternList.add(new Pattern(null, 1, null, event));
+ }
+ return new Patterns(patternList);
+ }
- private Patterns getLocalBackUpAsterixPattern(AsterixInstance instance,
- Backup backupConf) throws Exception {
- Cluster cluster = instance.getCluster();
- String backupDir = backupConf.getBackupDir();
- String workingDir = cluster.getWorkingDir().getDir();
- String backupId = "" + instance.getBackupInfo().size();
- String iodevices;
- 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();
- store = node.getStore() == null ? cluster.getStore() : node
- .getStore();
- pargs = workingDir + " " + instance.getName() + " " + iodevices
- + " " + store + " "
- + BackupCommand.ASTERIX_ROOT_METADATA_DIR + " " + backupId
- + " " + backupDir + " " + "local" + " " + node.getId();
- Event event = new Event("backup", nodeid, pargs);
- patternList.add(new Pattern(null, 1, null, event));
- }
- return new Patterns(patternList);
- }
+ private Patterns getLocalBackUpAsterixPattern(AsterixInstance instance, Backup backupConf) throws Exception {
+ Cluster cluster = instance.getCluster();
+ String backupDir = backupConf.getBackupDir();
+ String workingDir = cluster.getWorkingDir().getDir();
+ String backupId = "" + instance.getBackupInfo().size();
+ String iodevices;
+ 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();
+ 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();
+ Event event = new Event("backup", nodeid, pargs);
+ patternList.add(new Pattern(null, 1, null, event));
+ }
+ return new Patterns(patternList);
+ }
- public Patterns getHDFSRestoreAsterixPattern(AsterixInstance instance,
- BackupInfo backupInfo) throws Exception {
- Cluster cluster = instance.getCluster();
- String clusterStore = instance.getCluster().getStore();
- String hdfsUrl = backupInfo.getBackupConf().getHdfs().getUrl();
- String hadoopVersion = backupInfo.getBackupConf().getHdfs()
- .getVersion();
- String hdfsBackupDir = backupInfo.getBackupConf().getBackupDir();
- VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl,
- hadoopVersion, hdfsBackupDir);
- String workingDir = cluster.getWorkingDir().getDir();
- int backupId = backupInfo.getId();
- String nodeStore;
- String pargs;
- List<Pattern> patternList = new ArrayList<Pattern>();
- for (Node node : cluster.getNode()) {
- Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
- String iodevices = node.getIodevices() == null ? cluster
- .getIodevices() : node.getIodevices();
- nodeStore = node.getStore() == null ? clusterStore : node
- .getStore();
- pargs = workingDir + " " + instance.getName() + " " + iodevices
- + " " + nodeStore + " "
- + BackupCommand.ASTERIX_ROOT_METADATA_DIR + " " + backupId
- + " " + " " + hdfsBackupDir + " " + "hdfs" + " "
- + node.getId() + " " + hdfsUrl + " " + hadoopVersion;
- Event event = new Event("restore", nodeid, pargs);
- patternList.add(new Pattern(null, 1, null, event));
- }
- return new Patterns(patternList);
- }
+ public Patterns getHDFSRestoreAsterixPattern(AsterixInstance instance, BackupInfo backupInfo) throws Exception {
+ Cluster cluster = instance.getCluster();
+ String clusterStore = instance.getCluster().getStore();
+ String hdfsUrl = backupInfo.getBackupConf().getHdfs().getUrl();
+ String hadoopVersion = backupInfo.getBackupConf().getHdfs().getVersion();
+ String hdfsBackupDir = backupInfo.getBackupConf().getBackupDir();
+ VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl, hadoopVersion, hdfsBackupDir);
+ String workingDir = cluster.getWorkingDir().getDir();
+ int backupId = backupInfo.getId();
+ String nodeStore;
+ String pargs;
+ List<Pattern> patternList = new ArrayList<Pattern>();
+ for (Node node : cluster.getNode()) {
+ Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
+ String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
+ nodeStore = node.getStore() == null ? clusterStore : node.getStore();
+ pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + nodeStore + " "
+ + BackupCommand.ASTERIX_ROOT_METADATA_DIR + " " + InstallerUtil.TXN_LOG_DIR + " " + backupId + " "
+ + " " + hdfsBackupDir + " " + "hdfs" + " " + node.getId() + " " + hdfsUrl + " " + hadoopVersion;
+ Event event = new Event("restore", nodeid, pargs);
+ patternList.add(new Pattern(null, 1, null, event));
+ }
+ return new Patterns(patternList);
+ }
- public Patterns getLocalRestoreAsterixPattern(AsterixInstance instance,
- BackupInfo backupInfo) throws Exception {
- Cluster cluster = instance.getCluster();
- String clusterStore = instance.getCluster().getStore();
- String backupDir = backupInfo.getBackupConf().getBackupDir();
- String workingDir = cluster.getWorkingDir().getDir();
- int backupId = backupInfo.getId();
- String nodeStore;
- String pargs;
- List<Pattern> patternList = new ArrayList<Pattern>();
- for (Node node : cluster.getNode()) {
- Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
- String iodevices = node.getIodevices() == null ? cluster
- .getIodevices() : node.getIodevices();
- nodeStore = node.getStore() == null ? clusterStore : node
- .getStore();
- pargs = workingDir + " " + instance.getName() + " " + iodevices
- + " " + nodeStore + " "
- + BackupCommand.ASTERIX_ROOT_METADATA_DIR + " " + backupId
- + " " + backupDir + " " + "local" + " " + node.getId();
- Event event = new Event("restore", nodeid, pargs);
- patternList.add(new Pattern(null, 1, null, event));
- }
- return new Patterns(patternList);
- }
+ public Patterns getLocalRestoreAsterixPattern(AsterixInstance instance, BackupInfo backupInfo) throws Exception {
+ Cluster cluster = instance.getCluster();
+ String clusterStore = instance.getCluster().getStore();
+ String backupDir = backupInfo.getBackupConf().getBackupDir();
+ String workingDir = cluster.getWorkingDir().getDir();
+ int backupId = backupInfo.getId();
+ String nodeStore;
+ String pargs;
+ List<Pattern> patternList = new ArrayList<Pattern>();
+ for (Node node : cluster.getNode()) {
+ Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
+ String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
+ nodeStore = node.getStore() == null ? clusterStore : node.getStore();
+ pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + nodeStore + " "
+ + BackupCommand.ASTERIX_ROOT_METADATA_DIR + " " + InstallerUtil.TXN_LOG_DIR + " " + backupId + " "
+ + backupDir + " " + "local" + " " + node.getId();
+ Event event = new Event("restore", nodeid, pargs);
+ patternList.add(new Pattern(null, 1, null, event));
+ }
+ return new Patterns(patternList);
+ }
- public Patterns createHadoopLibraryTransferPattern(Cluster cluster)
- throws Exception {
- List<Pattern> patternList = new ArrayList<Pattern>();
- String workingDir = cluster.getWorkingDir().getDir();
- String hadoopVersion = InstallerDriver.getConfiguration().getBackup()
- .getHdfs().getVersion();
- File hadoopDir = new File(InstallerDriver.getManagixHome()
- + File.separator + InstallerDriver.MANAGIX_INTERNAL_DIR
- + File.separator + "hadoop-" + hadoopVersion);
- if (!hadoopDir.exists()) {
- throw new IllegalStateException("Hadoop version :" + hadoopVersion
- + " not supported");
- }
+ public Patterns createHadoopLibraryTransferPattern(Cluster cluster) throws Exception {
+ List<Pattern> patternList = new ArrayList<Pattern>();
+ String workingDir = cluster.getWorkingDir().getDir();
+ String hadoopVersion = InstallerDriver.getConfiguration().getBackup().getHdfs().getVersion();
+ File hadoopDir = new File(InstallerDriver.getManagixHome() + File.separator
+ + InstallerDriver.MANAGIX_INTERNAL_DIR + File.separator + "hadoop-" + hadoopVersion);
+ if (!hadoopDir.exists()) {
+ throw new IllegalStateException("Hadoop version :" + hadoopVersion + " not supported");
+ }
- Nodeid nodeid = new Nodeid(new Value(null,
- EventDriver.CLIENT_NODE.getId()));
- String username = cluster.getUsername() != null ? cluster.getUsername()
- : System.getProperty("user.name");
- String pargs = username + " " + hadoopDir.getAbsolutePath() + " "
- + cluster.getMasterNode().getClusterIp() + " " + workingDir;
- Event event = new Event("directory_transfer", nodeid, pargs);
- Pattern p = new Pattern(null, 1, null, event);
- addInitialDelay(p, 2, "sec");
- patternList.add(p);
+ Nodeid nodeid = new Nodeid(new Value(null, EventDriver.CLIENT_NODE.getId()));
+ String username = cluster.getUsername() != null ? cluster.getUsername() : System.getProperty("user.name");
+ String pargs = username + " " + hadoopDir.getAbsolutePath() + " " + cluster.getMasterNode().getClusterIp()
+ + " " + workingDir;
+ Event event = new Event("directory_transfer", nodeid, pargs);
+ Pattern p = new Pattern(null, 1, null, event);
+ addInitialDelay(p, 2, "sec");
+ patternList.add(p);
- boolean copyToNC = !cluster.getWorkingDir().isNFS();
- if (copyToNC) {
- for (Node node : cluster.getNode()) {
- nodeid = new Nodeid(new Value(null, node.getId()));
- pargs = cluster.getUsername() + " "
- + hadoopDir.getAbsolutePath() + " "
- + node.getClusterIp() + " " + workingDir;
- event = new Event("directory_transfer", nodeid, pargs);
- p = new Pattern(null, 1, null, event);
- addInitialDelay(p, 2, "sec");
- patternList.add(p);
- }
- }
- Patterns patterns = new Patterns(patternList);
- return patterns;
- }
+ boolean copyToNC = !cluster.getWorkingDir().isNFS();
+ if (copyToNC) {
+ for (Node node : cluster.getNode()) {
+ nodeid = new Nodeid(new Value(null, node.getId()));
+ pargs = cluster.getUsername() + " " + hadoopDir.getAbsolutePath() + " " + node.getClusterIp() + " "
+ + workingDir;
+ event = new Event("directory_transfer", nodeid, pargs);
+ p = new Pattern(null, 1, null, event);
+ addInitialDelay(p, 2, "sec");
+ patternList.add(p);
+ }
+ }
+ Patterns patterns = new Patterns(patternList);
+ return patterns;
+ }
- public Patterns createDeleteInstancePattern(AsterixInstance instance)
- throws Exception {
- List<Pattern> patternList = new ArrayList<Pattern>();
- patternList.addAll(createRemoveAsterixStoragePattern(instance)
- .getPattern());
- if (instance.getBackupInfo() != null
- && instance.getBackupInfo().size() > 0) {
- List<BackupInfo> backups = instance.getBackupInfo();
- Set<String> removedBackupDirsHDFS = new HashSet<String>();
- Set<String> removedBackupDirsLocal = new HashSet<String>();
+ public Patterns createDeleteInstancePattern(AsterixInstance instance) throws Exception {
+ List<Pattern> patternList = new ArrayList<Pattern>();
+ patternList.addAll(createRemoveAsterixStoragePattern(instance).getPattern());
+ if (instance.getBackupInfo() != null && instance.getBackupInfo().size() > 0) {
+ List<BackupInfo> backups = instance.getBackupInfo();
+ Set<String> removedBackupDirsHDFS = new HashSet<String>();
+ Set<String> removedBackupDirsLocal = new HashSet<String>();
- String backupDir;
- for (BackupInfo binfo : backups) {
- backupDir = binfo.getBackupConf().getBackupDir();
- switch (binfo.getBackupType()) {
- case HDFS:
- if (removedBackupDirsHDFS.contains(backups)) {
- continue;
- }
- patternList.addAll(createRemoveHDFSBackupPattern(instance,
- backupDir).getPattern());
- removedBackupDirsHDFS.add(backupDir);
- break;
+ String backupDir;
+ for (BackupInfo binfo : backups) {
+ backupDir = binfo.getBackupConf().getBackupDir();
+ switch (binfo.getBackupType()) {
+ case HDFS:
+ if (removedBackupDirsHDFS.contains(backups)) {
+ continue;
+ }
+ patternList.addAll(createRemoveHDFSBackupPattern(instance, backupDir).getPattern());
+ removedBackupDirsHDFS.add(backupDir);
+ break;
- case LOCAL:
- if (removedBackupDirsLocal.contains(backups)) {
- continue;
- }
- patternList.addAll(createRemoveLocalBackupPattern(instance,
- backupDir).getPattern());
- removedBackupDirsLocal.add(backupDir);
- break;
- }
+ case LOCAL:
+ if (removedBackupDirsLocal.contains(backups)) {
+ continue;
+ }
+ patternList.addAll(createRemoveLocalBackupPattern(instance, backupDir).getPattern());
+ removedBackupDirsLocal.add(backupDir);
+ break;
+ }
- }
- }
- patternList.addAll(createRemoveAsterixLogDirPattern(instance)
- .getPattern());
- patternList.addAll(createRemoveAsterixRootMetadata(instance)
- .getPattern());
- Patterns patterns = new Patterns(patternList);
- return patterns;
- }
+ }
+ }
+ patternList.addAll(createRemoveAsterixLogDirPattern(instance).getPattern());
+ patternList.addAll(createRemoveAsterixRootMetadata(instance).getPattern());
+ Patterns patterns = new Patterns(patternList);
+ return patterns;
+ }
- private Patterns createRemoveHDFSBackupPattern(AsterixInstance instance,
- String hdfsBackupDir) throws Exception {
- List<Pattern> patternList = new ArrayList<Pattern>();
- Cluster cluster = instance.getCluster();
- String hdfsUrl = InstallerDriver.getConfiguration().getBackup()
- .getHdfs().getUrl();
- String hadoopVersion = InstallerDriver.getConfiguration().getBackup()
- .getHdfs().getVersion();
- String workingDir = cluster.getWorkingDir().getDir();
- Node launchingNode = cluster.getNode().get(0);
- Nodeid nodeid = new Nodeid(new Value(null, launchingNode.getId()));
- String pathToDelete = hdfsBackupDir + File.separator
- + instance.getName();
- String pargs = workingDir + " " + hadoopVersion + " " + hdfsUrl + " "
- + pathToDelete;
- Event event = new Event("hdfs_delete", nodeid, pargs);
- patternList.add(new Pattern(null, 1, null, event));
- Patterns patterns = new Patterns(patternList);
- return patterns;
- }
+ private Patterns createRemoveHDFSBackupPattern(AsterixInstance instance, String hdfsBackupDir) throws Exception {
+ List<Pattern> patternList = new ArrayList<Pattern>();
+ Cluster cluster = instance.getCluster();
+ String hdfsUrl = InstallerDriver.getConfiguration().getBackup().getHdfs().getUrl();
+ String hadoopVersion = InstallerDriver.getConfiguration().getBackup().getHdfs().getVersion();
+ String workingDir = cluster.getWorkingDir().getDir();
+ Node launchingNode = cluster.getNode().get(0);
+ Nodeid nodeid = new Nodeid(new Value(null, launchingNode.getId()));
+ String pathToDelete = hdfsBackupDir + File.separator + instance.getName();
+ String pargs = workingDir + " " + hadoopVersion + " " + hdfsUrl + " " + pathToDelete;
+ Event event = new Event("hdfs_delete", nodeid, pargs);
+ patternList.add(new Pattern(null, 1, null, event));
+ Patterns patterns = new Patterns(patternList);
+ return patterns;
+ }
- private Patterns createRemoveLocalBackupPattern(AsterixInstance instance,
- String localBackupDir) throws Exception {
- List<Pattern> patternList = new ArrayList<Pattern>();
- Cluster cluster = instance.getCluster();
+ private Patterns createRemoveLocalBackupPattern(AsterixInstance instance, String localBackupDir) throws Exception {
+ List<Pattern> patternList = new ArrayList<Pattern>();
+ Cluster cluster = instance.getCluster();
- String pathToDelete = localBackupDir + File.separator
- + instance.getName();
- String pargs = pathToDelete;
- List<String> removedBackupDirs = new ArrayList<String>();
- for (Node node : cluster.getNode()) {
- if (removedBackupDirs.contains(node.getClusterIp())) {
- continue;
- }
- Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
- Event event = new Event("file_delete", nodeid, pargs);
- patternList.add(new Pattern(null, 1, null, event));
- removedBackupDirs.add(node.getClusterIp());
- }
+ String pathToDelete = localBackupDir + File.separator + instance.getName();
+ String pargs = pathToDelete;
+ List<String> removedBackupDirs = new ArrayList<String>();
+ for (Node node : cluster.getNode()) {
+ if (removedBackupDirs.contains(node.getClusterIp())) {
+ continue;
+ }
+ Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
+ Event event = new Event("file_delete", nodeid, pargs);
+ patternList.add(new Pattern(null, 1, null, event));
+ removedBackupDirs.add(node.getClusterIp());
+ }
- Patterns patterns = new Patterns(patternList);
- return patterns;
- }
+ Patterns patterns = new Patterns(patternList);
+ return patterns;
+ }
- public Patterns createRemoveAsterixWorkingDirPattern(
- AsterixInstance instance) throws Exception {
- List<Pattern> patternList = new ArrayList<Pattern>();
- Cluster cluster = instance.getCluster();
- String workingDir = cluster.getWorkingDir().getDir();
- String pargs = workingDir;
- 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));
+ public Patterns createRemoveAsterixWorkingDirPattern(AsterixInstance instance) throws Exception {
+ List<Pattern> patternList = new ArrayList<Pattern>();
+ Cluster cluster = instance.getCluster();
+ String workingDir = cluster.getWorkingDir().getDir();
+ String pargs = workingDir;
+ 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));
- if (!cluster.getWorkingDir().isNFS()) {
- for (Node node : cluster.getNode()) {
- nodeid = new Nodeid(new Value(null, node.getId()));
- event = new Event("file_delete", nodeid, pargs);
- patternList.add(new Pattern(null, 1, null, event));
- }
- }
- Patterns patterns = new Patterns(patternList);
- return patterns;
- }
+ if (!cluster.getWorkingDir().isNFS()) {
+ for (Node node : cluster.getNode()) {
+ nodeid = new Nodeid(new Value(null, node.getId()));
+ event = new Event("file_delete", nodeid, pargs);
+ patternList.add(new Pattern(null, 1, null, event));
+ }
+ }
+ Patterns patterns = new Patterns(patternList);
+ return patterns;
+ }
- private Patterns createRemoveAsterixRootMetadata(AsterixInstance instance)
- throws Exception {
- List<Pattern> patternList = new ArrayList<Pattern>();
- Cluster cluster = instance.getCluster();
- Nodeid nodeid = null;
- String pargs = null;
- Event event = null;
- for (Node node : cluster.getNode()) {
- String iodevices = node.getIodevices() == null ? cluster
- .getIodevices() : node.getIodevices();
- String primaryIODevice = iodevices.split(",")[0].trim();
- pargs = primaryIODevice + File.separator
- + BackupCommand.ASTERIX_ROOT_METADATA_DIR;
- nodeid = new Nodeid(new Value(null, node.getId()));
- event = new Event("file_delete", nodeid, pargs);
- patternList.add(new Pattern(null, 1, null, event));
- }
+ private Patterns createRemoveAsterixRootMetadata(AsterixInstance instance) throws Exception {
+ List<Pattern> patternList = new ArrayList<Pattern>();
+ Cluster cluster = instance.getCluster();
+ Nodeid nodeid = null;
+ String pargs = null;
+ Event event = null;
+ for (Node node : cluster.getNode()) {
+ String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
+ String primaryIODevice = iodevices.split(",")[0].trim();
+ pargs = primaryIODevice + File.separator + BackupCommand.ASTERIX_ROOT_METADATA_DIR;
+ nodeid = new Nodeid(new Value(null, node.getId()));
+ event = new Event("file_delete", nodeid, pargs);
+ patternList.add(new Pattern(null, 1, null, event));
+ }
- Patterns patterns = new Patterns(patternList);
- return patterns;
- }
+ Patterns patterns = new Patterns(patternList);
+ return patterns;
+ }
- private Patterns createRemoveAsterixLogDirPattern(AsterixInstance instance)
- throws Exception {
- List<Pattern> patternList = new ArrayList<Pattern>();
- Cluster cluster = instance.getCluster();
- 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));
+ private Patterns createRemoveAsterixLogDirPattern(AsterixInstance instance) throws Exception {
+ List<Pattern> patternList = new ArrayList<Pattern>();
+ Cluster cluster = instance.getCluster();
+ 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));
- for (Node node : cluster.getNode()) {
- nodeid = new Nodeid(new Value(null, node.getId()));
- event = new Event("file_delete", nodeid, pargs);
- patternList.add(new Pattern(null, 1, null, event));
- }
+ for (Node node : cluster.getNode()) {
+ nodeid = new Nodeid(new Value(null, node.getId()));
+ event = new Event("file_delete", nodeid, pargs);
+ patternList.add(new Pattern(null, 1, null, event));
+ }
- Patterns patterns = new Patterns(patternList);
- return patterns;
- }
+ Patterns patterns = new Patterns(patternList);
+ return patterns;
+ }
- private Patterns createRemoveAsterixStoragePattern(AsterixInstance instance)
- throws Exception {
- List<Pattern> patternList = new ArrayList<Pattern>();
- Cluster cluster = instance.getCluster();
- String pargs = null;
+ private Patterns createRemoveAsterixStoragePattern(AsterixInstance instance) throws Exception {
+ List<Pattern> patternList = new ArrayList<Pattern>();
+ Cluster cluster = instance.getCluster();
+ String pargs = null;
- for (Node node : cluster.getNode()) {
- Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
- String[] nodeIODevices;
- String iodevices = node.getIodevices() == null ? cluster
- .getIodevices() : node.getIodevices();
- nodeIODevices = iodevices.trim().split(",");
- for (String nodeIODevice : nodeIODevices) {
- String nodeStore = node.getStore() == null ? cluster.getStore()
- : node.getStore();
- pargs = nodeIODevice.trim() + File.separator + nodeStore;
- Event event = new Event("file_delete", nodeid, pargs);
- patternList.add(new Pattern(null, 1, null, event));
- }
- }
- Patterns patterns = new Patterns(patternList);
- return patterns;
- }
+ for (Node node : cluster.getNode()) {
+ Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
+ String[] nodeIODevices;
+ String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
+ nodeIODevices = iodevices.trim().split(",");
+ for (String nodeIODevice : nodeIODevices) {
+ String nodeStore = node.getStore() == null ? cluster.getStore() : node.getStore();
+ pargs = nodeIODevice.trim() + File.separator + nodeStore;
+ Event event = new Event("file_delete", nodeid, pargs);
+ patternList.add(new Pattern(null, 1, null, event));
+ }
+ }
+ Patterns patterns = new Patterns(patternList);
+ return patterns;
+ }
- private Pattern createCopyHyracksPattern(String instanceName,
- Cluster cluster, String destinationIp, String destDir) {
- Nodeid nodeid = new Nodeid(new Value(null,
- EventDriver.CLIENT_NODE.getId()));
- String username = cluster.getUsername() != null ? cluster.getUsername()
- : System.getProperty("user.name");
- String asterixZipName = InstallerDriver.getAsterixZip()
- .substring(
- InstallerDriver.getAsterixZip().lastIndexOf(
- File.separator) + 1);
- String fileToTransfer = new File(InstallerDriver.getAsterixDir()
- + File.separator + instanceName + File.separator
- + asterixZipName).getAbsolutePath();
- String pargs = username + " " + fileToTransfer + " " + destinationIp
- + " " + destDir + " " + "unpack";
- Event event = new Event("file_transfer", nodeid, pargs);
- return new Pattern(null, 1, null, event);
- }
+ private Pattern createCopyHyracksPattern(String instanceName, Cluster cluster, String destinationIp, String destDir) {
+ Nodeid nodeid = new Nodeid(new Value(null, EventDriver.CLIENT_NODE.getId()));
+ String username = cluster.getUsername() != null ? cluster.getUsername() : System.getProperty("user.name");
+ String asterixZipName = InstallerDriver.getAsterixZip().substring(
+ InstallerDriver.getAsterixZip().lastIndexOf(File.separator) + 1);
+ String fileToTransfer = new File(InstallerDriver.getAsterixDir() + File.separator + instanceName
+ + File.separator + asterixZipName).getAbsolutePath();
+ String pargs = username + " " + fileToTransfer + " " + destinationIp + " " + destDir + " " + "unpack";
+ Event event = new Event("file_transfer", nodeid, pargs);
+ return new Pattern(null, 1, null, event);
+ }
- private Pattern createCCStartPattern(String hostId) {
- Nodeid nodeid = new Nodeid(new Value(null, hostId));
- Event event = new Event("cc_start", nodeid, "");
- return new Pattern(null, 1, null, event);
- }
+ private Pattern createCCStartPattern(String hostId) {
+ Nodeid nodeid = new Nodeid(new Value(null, hostId));
+ Event event = new Event("cc_start", nodeid, "");
+ return new Pattern(null, 1, null, event);
+ }
- public Pattern createCCStopPattern(String hostId) {
- Nodeid nodeid = new Nodeid(new Value(null, hostId));
- Event event = new Event("cc_failure", nodeid, null);
- return new Pattern(null, 1, null, event);
- }
+ public Pattern createCCStopPattern(String hostId) {
+ Nodeid nodeid = new Nodeid(new Value(null, hostId));
+ Event event = new Event("cc_failure", nodeid, null);
+ return new Pattern(null, 1, null, event);
+ }
- public Pattern createNCStartPattern(String ccHost, String hostId,
- String nodeControllerId, String iodevices) {
- Nodeid nodeid = new Nodeid(new Value(null, hostId));
- String pargs = ccHost + " " + nodeControllerId + " " + iodevices;
- Event event = new Event("node_join", nodeid, pargs);
- return new Pattern(null, 1, null, event);
- }
+ public Pattern createNCStartPattern(String ccHost, String hostId, String nodeControllerId, String iodevices) {
+ Nodeid nodeid = new Nodeid(new Value(null, hostId));
+ String pargs = ccHost + " " + nodeControllerId + " " + iodevices;
+ Event event = new Event("node_join", nodeid, pargs);
+ return new Pattern(null, 1, null, event);
+ }
- public Pattern createNCStopPattern(String hostId, String nodeControllerId) {
- Nodeid nodeid = new Nodeid(new Value(null, hostId));
- Event event = new Event("node_failure", nodeid, nodeControllerId);
- return new Pattern(null, 1, null, event);
- }
+ public Pattern createNCStopPattern(String hostId, String nodeControllerId) {
+ Nodeid nodeid = new Nodeid(new Value(null, hostId));
+ Event event = new Event("node_failure", nodeid, nodeControllerId);
+ return 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 b6589d0..d397bcd 100644
--- a/asterix-installer/src/main/resources/clusters/local/local.xml
+++ b/asterix-installer/src/main/resources/clusters/local/local.xml
@@ -8,7 +8,7 @@
<iodevices>/tmp</iodevices>
<store>asterix/storage</store>
<java_home></java_home>
- <java_heap>1024m</java_heap>
+ <java_opts>-Xmx1024m</java_opts>
<master-node>
<id>master</id>
<client-ip>127.0.0.1</client-ip>
diff --git a/asterix-installer/src/main/resources/zookeeper/stop_zk b/asterix-installer/src/main/resources/zookeeper/stop_zk
index d8615d9..9bef86e 100755
--- a/asterix-installer/src/main/resources/zookeeper/stop_zk
+++ b/asterix-installer/src/main/resources/zookeeper/stop_zk
@@ -2,5 +2,5 @@
shift 1
for zk_host in $@
do
- ssh $zk_host "kill -9 `jps | grep QuorumPeerMain | cut -d " " -f1`" &
+ ssh $zk_host "kill -15 `jps | grep QuorumPeerMain | cut -d " " -f1`" &
done