ASTERIXDB-1711: root metadata
s/asterix_root_metadata/root_metadata/
s/AsterixConstants/StorageConstants/
Change-Id: I7afc3062a4b98883a7a54bd410e8df558e5ebf3c
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1367
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <imaxon@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/AsterixConstants.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StorageConstants.java
similarity index 81%
rename from asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/AsterixConstants.java
rename to asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StorageConstants.java
index 4bca216..382c94b 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/AsterixConstants.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StorageConstants.java
@@ -19,12 +19,11 @@
package org.apache.asterix.common.utils;
/**
- * A static class that stores asterix constants
+ * A static class that stores storage constants
*/
-public class AsterixConstants {
- public static final String ASTERIX_ROOT_METADATA_DIR = "asterix_root_metadata";
+public class StorageConstants {
+ public static final String METADATA_ROOT = "root_metadata";
- private AsterixConstants() {
+ private StorageConstants() {
}
-
}
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
index 9c6725b..71cef80 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
@@ -27,7 +27,7 @@
import java.util.Map;
import java.util.Set;
-import org.apache.asterix.common.utils.AsterixConstants;
+import org.apache.asterix.common.utils.StorageConstants;
import org.apache.asterix.event.driver.EventDriver;
import org.apache.asterix.event.error.VerificationUtil;
import org.apache.asterix.event.model.AsterixInstance;
@@ -43,8 +43,6 @@
import org.apache.asterix.event.schema.pattern.Value;
import org.apache.asterix.event.service.AsterixEventService;
import org.apache.asterix.event.service.AsterixEventServiceUtil;
-import org.apache.asterix.event.service.ILookupService;
-import org.apache.asterix.event.service.ServiceProvider;
import org.apache.asterix.installer.schema.conf.Backup;
public class PatternCreator {
@@ -145,7 +143,7 @@
Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
iodevices = node.getIodevices() == null ? instance.getCluster().getIodevices() : node.getIodevices();
pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + store + " "
- + AsterixConstants.ASTERIX_ROOT_METADATA_DIR + " " + AsterixEventServiceUtil.TXN_LOG_DIR + " "
+ + StorageConstants.METADATA_ROOT + " " + AsterixEventServiceUtil.TXN_LOG_DIR + " "
+ backupId + " " + hdfsBackupDir + " " + "hdfs" + " " + node.getId() + " " + hdfsUrl + " "
+ hadoopVersion;
Event event = new Event("backup", nodeid, pargs);
@@ -170,7 +168,7 @@
iodevices = node.getIodevices() == null ? instance.getCluster().getIodevices() : node.getIodevices();
txnLogDir = node.getTxnLogDir() == null ? instance.getCluster().getTxnLogDir() : node.getTxnLogDir();
pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + store + " "
- + AsterixConstants.ASTERIX_ROOT_METADATA_DIR + " " + txnLogDir + " " + backupId + " " + backupDir
+ + StorageConstants.METADATA_ROOT + " " + txnLogDir + " " + backupId + " " + backupDir
+ " " + "local" + " " + node.getId();
Event event = new Event("backup", nodeid, pargs);
patternList.add(new Pattern(null, 1, null, event));
@@ -193,7 +191,7 @@
Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + clusterStore + " "
- + AsterixConstants.ASTERIX_ROOT_METADATA_DIR + " " + AsterixEventServiceUtil.TXN_LOG_DIR + " "
+ + StorageConstants.METADATA_ROOT + " " + AsterixEventServiceUtil.TXN_LOG_DIR + " "
+ backupId + " " + " " + hdfsBackupDir + " " + "hdfs" + " " + node.getId() + " " + hdfsUrl + " "
+ hadoopVersion;
Event event = new Event("restore", nodeid, pargs);
@@ -214,7 +212,7 @@
Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + clusterStore + " "
- + AsterixConstants.ASTERIX_ROOT_METADATA_DIR + " " + AsterixEventServiceUtil.TXN_LOG_DIR + " "
+ + StorageConstants.METADATA_ROOT + " " + AsterixEventServiceUtil.TXN_LOG_DIR + " "
+ backupId + " " + backupDir + " " + "local" + " " + node.getId();
Event event = new Event("restore", nodeid, pargs);
patternList.add(new Pattern(null, 1, null, event));
@@ -449,7 +447,7 @@
for (Node node : cluster.getNode()) {
String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
String primaryIODevice = iodevices.split(",")[0].trim();
- pargs = primaryIODevice + File.separator + AsterixConstants.ASTERIX_ROOT_METADATA_DIR;
+ pargs = primaryIODevice + File.separator + StorageConstants.METADATA_ROOT;
nodeid = new Nodeid(new Value(null, node.getId()));
event = new Event("file_delete", nodeid, pargs);
patternList.add(new Pattern(null, 1, null, event));
diff --git a/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/BackupCommand.java b/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/BackupCommand.java
index 9028e4c..22b6952 100644
--- a/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/BackupCommand.java
+++ b/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/BackupCommand.java
@@ -36,8 +36,6 @@
public class BackupCommand extends AbstractCommand {
- public static final String ASTERIX_ROOT_METADATA_DIR = "asterix_root_metadata";
-
@Override
protected void execCommand() throws Exception {
InstallerDriver.initConfig(true);
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 8600efb..6ccc6d0 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
@@ -45,6 +45,7 @@
import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.common.replication.AsterixReplicationJob;
import org.apache.asterix.common.replication.IReplicationManager;
+import org.apache.asterix.common.utils.StorageConstants;
import org.apache.asterix.common.utils.StoragePathUtil;
import org.apache.commons.io.FileUtils;
import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -67,8 +68,8 @@
public static final String METADATA_FILE_NAME = ".metadata";
// Private constants
private static final Logger LOGGER = Logger.getLogger(PersistentLocalResourceRepository.class.getName());
- private static final String STORAGE_METADATA_DIRECTORY = "root_metadata";
- private static final String STORAGE_METADATA_FILE_NAME_PREFIX = ".root_metadata";
+ private static final String STORAGE_METADATA_DIRECTORY = StorageConstants.METADATA_ROOT;
+ private static final String STORAGE_METADATA_FILE_NAME_PREFIX = "." + StorageConstants.METADATA_ROOT;
private static final long STORAGE_LOCAL_RESOURCE_ID = -4321;
private static final int MAX_CACHED_RESOURCES = 1000;
private static final FilenameFilter METADATA_FILES_FILTER = (File dir, String name) -> name.equalsIgnoreCase(
diff --git a/asterixdb/asterix-yarn/src/main/java/org/apache/asterix/aoya/AsterixApplicationMaster.java b/asterixdb/asterix-yarn/src/main/java/org/apache/asterix/aoya/AsterixApplicationMaster.java
index 00d9018..56d3d07 100644
--- a/asterixdb/asterix-yarn/src/main/java/org/apache/asterix/aoya/AsterixApplicationMaster.java
+++ b/asterixdb/asterix-yarn/src/main/java/org/apache/asterix/aoya/AsterixApplicationMaster.java
@@ -47,7 +47,7 @@
import org.apache.asterix.common.config.GlobalConfig;
import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.event.schema.cluster.Property;
+import org.apache.asterix.common.utils.StorageConstants;
import org.apache.asterix.event.schema.yarnCluster.Cluster;
import org.apache.asterix.event.schema.yarnCluster.MasterNode;
import org.apache.asterix.event.schema.yarnCluster.Node;
@@ -1288,7 +1288,7 @@
FileStatus[] backups = fs.listStatus(new Path(src.toString()));
for (FileStatus b : backups) {
if (!b.getPath().toString().contains("txnLogs")
- && !b.getPath().toString().contains(File.separator + "asterix_root_metadata")) {
+ && !b.getPath().toString().contains(File.separator + StorageConstants.METADATA_ROOT)) {
vargs.add(b.getPath() + "," + s + File.separator + clusterDesc.getStore());
}
}