You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by ti...@apache.org on 2016/11/30 23:23:37 UTC

asterixdb git commit: ASTERIXDB-1711: root metadata

Repository: asterixdb
Updated Branches:
  refs/heads/master 8a742fd19 -> 4c958b2de


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 <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <im...@apache.org>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/4c958b2d
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/4c958b2d
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/4c958b2d

Branch: refs/heads/master
Commit: 4c958b2de81099c125d917049aa045c45ea41424
Parents: 8a742fd
Author: Till Westmann <ti...@apache.org>
Authored: Tue Nov 29 15:57:42 2016 -0800
Committer: Till Westmann <ti...@apache.org>
Committed: Wed Nov 30 15:23:07 2016 -0800

----------------------------------------------------------------------
 .../asterix/common/utils/AsterixConstants.java  | 30 --------------------
 .../asterix/common/utils/StorageConstants.java  | 29 +++++++++++++++++++
 .../asterix/event/util/PatternCreator.java      | 14 ++++-----
 .../installer/command/BackupCommand.java        |  2 --
 .../PersistentLocalResourceRepository.java      |  5 ++--
 .../asterix/aoya/AsterixApplicationMaster.java  |  4 +--
 6 files changed, 40 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4c958b2d/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/AsterixConstants.java
----------------------------------------------------------------------
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/AsterixConstants.java
deleted file mode 100644
index 4bca216..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/AsterixConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.utils;
-
-/**
- * A static class that stores asterix constants
- */
-public class AsterixConstants {
-    public static final String ASTERIX_ROOT_METADATA_DIR = "asterix_root_metadata";
-
-    private AsterixConstants() {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4c958b2d/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StorageConstants.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StorageConstants.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StorageConstants.java
new file mode 100644
index 0000000..382c94b
--- /dev/null
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StorageConstants.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.common.utils;
+
+/**
+ * A static class that stores storage constants
+ */
+public class StorageConstants {
+    public static final String METADATA_ROOT = "root_metadata";
+
+    private StorageConstants() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4c958b2d/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
----------------------------------------------------------------------
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.List;
 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.Patterns;
 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 @@ public class PatternCreator {
             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 @@ public class PatternCreator {
             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 @@ public class PatternCreator {
             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 @@ public class PatternCreator {
             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 @@ public class PatternCreator {
         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));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4c958b2d/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/BackupCommand.java
----------------------------------------------------------------------
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 @@ import org.apache.asterix.installer.schema.conf.Backup;
 
 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);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4c958b2d/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
----------------------------------------------------------------------
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.config.AsterixMetadataProperties;
 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 class PersistentLocalResourceRepository implements ILocalResourceReposito
     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(

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4c958b2d/asterixdb/asterix-yarn/src/main/java/org/apache/asterix/aoya/AsterixApplicationMaster.java
----------------------------------------------------------------------
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 java.util.concurrent.atomic.AtomicInteger;
 
 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 @@ public class AsterixApplicationMaster {
                     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());
                         }
                     }