You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ga...@apache.org on 2017/11/03 22:49:51 UTC
[7/7] hive git commit: HIVE-17967 Move HiveMetaStore class
HIVE-17967 Move HiveMetaStore class
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/c2bbd5f4
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/c2bbd5f4
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/c2bbd5f4
Branch: refs/heads/standalone-metastore
Commit: c2bbd5f4ad9d6973e57929dbd091c44e862797b1
Parents: 20c1d3e
Author: Alan Gates <ga...@hortonworks.com>
Authored: Fri Nov 3 15:23:04 2017 -0700
Committer: Alan Gates <ga...@hortonworks.com>
Committed: Fri Nov 3 15:23:04 2017 -0700
----------------------------------------------------------------------
.../apache/hadoop/hive/common/FileUtils.java | 21 -
.../TestMetaStoreConnectionUrlHook.java | 62 -
.../TestPartitionExpressionProxyDefault.java | 40 +
.../ql/TestMetaStoreLimitPartitionRequest.java | 3 +-
.../hadoop/hive/metastore/HiveMetaStore.java | 8086 ------------------
.../hadoop/hive/metastore/MetaStoreUtils.java | 845 +-
.../metastore/SerDeStorageSchemaReader.java | 58 +
.../hive/metastore/TSetIpAddressProcessor.java | 62 -
.../hive/metastore/TUGIBasedProcessor.java | 182 -
.../hive/metastore/repl/DumpDirCleanerTask.java | 62 -
.../metastore/DummyJdoConnectionUrlHook.java | 45 -
.../DummyRawStoreForJdoConnection.java | 1001 ---
.../hive/metastore/TestHiveMetastoreCli.java | 63 -
.../hadoop/hive/metastore/TestObjectStore2.java | 229 -
standalone-metastore/pom.xml | 1 +
.../DefaultPartitionExpressionProxy.java | 57 +
.../metastore/DefaultStorageSchemaReader.java | 38 +
.../hadoop/hive/metastore/HiveMetaStore.java | 7979 +++++++++++++++++
.../hadoop/hive/metastore/MetaStoreInit.java | 2 +-
.../hive/metastore/PartFilterExprUtil.java | 10 +-
.../hive/metastore/StorageSchemaReader.java | 46 +
.../hive/metastore/TSetIpAddressProcessor.java | 62 +
.../hive/metastore/TUGIBasedProcessor.java | 183 +
.../hive/metastore/conf/MetastoreConf.java | 27 +-
.../hive/metastore/events/EventCleanerTask.java | 4 +-
.../hive/metastore/events/ListenerEvent.java | 10 +
.../metastore/hooks/JDOConnectionURLHook.java | 5 +-
.../hive/metastore/repl/DumpDirCleanerTask.java | 69 +
.../hive/metastore/utils/CommonCliOptions.java | 160 +
.../hadoop/hive/metastore/utils/FileUtils.java | 33 +
.../hadoop/hive/metastore/utils/HdfsUtils.java | 173 +
.../hadoop/hive/metastore/utils/LogUtils.java | 140 +
.../hive/metastore/utils/MetaStoreUtils.java | 319 +-
.../hive/metastore/utils/SecurityUtils.java | 75 +
.../metastore/DummyJdoConnectionUrlHook.java | 45 +
.../DummyRawStoreForJdoConnection.java | 1000 +++
.../hive/metastore/TestHiveMetastoreCli.java | 65 +
.../TestMetaStoreConnectionUrlHook.java | 45 +
.../hadoop/hive/metastore/TestObjectStore.java | 147 +
.../hive/metastore/utils/TestHdfsUtils.java | 152 +
40 files changed, 11063 insertions(+), 10543 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/c2bbd5f4/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/common/FileUtils.java b/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
index ff09dd8..e0d9785 100644
--- a/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
+++ b/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
@@ -87,27 +87,6 @@ public final class FileUtils {
}
};
- public static final PathFilter SNAPSHOT_DIR_PATH_FILTER = new PathFilter() {
- @Override
- public boolean accept(Path p) {
- return ".snapshot".equalsIgnoreCase(p.getName());
- }
- };
-
- /**
- * Check if the path contains a subdirectory named '.snapshot'
- * @param p path to check
- * @param fs filesystem of the path
- * @return true if p contains a subdirectory named '.snapshot'
- * @throws IOException
- */
- public static boolean pathHasSnapshotSubDir(Path p, FileSystem fs) throws IOException {
- // Hadoop is missing a public API to check for snapshotable directories. Check with the directory name
- // until a more appropriate API is provided by HDFS-12257.
- final FileStatus[] statuses = fs.listStatus(p, FileUtils.SNAPSHOT_DIR_PATH_FILTER);
- return statuses != null && statuses.length != 0;
- }
-
/**
* Variant of Path.makeQualified that qualifies the input path against the default file system
* indicated by the configuration
http://git-wip-us.apache.org/repos/asf/hive/blob/c2bbd5f4/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreConnectionUrlHook.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreConnectionUrlHook.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreConnectionUrlHook.java
deleted file mode 100644
index 91a2888..0000000
--- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreConnectionUrlHook.java
+++ /dev/null
@@ -1,62 +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.hadoop.hive.metastore;
-
-import junit.framework.TestCase;
-
-import org.apache.hadoop.hive.cli.CliSessionState;
-import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.ql.session.SessionState;
-
-/**
- * TestMetaStoreConnectionUrlHook
- * Verifies that when an instance of an implementation of RawStore is initialized, the connection
- * URL has already been updated by any metastore connect URL hooks.
- */
-public class TestMetaStoreConnectionUrlHook extends TestCase {
- private HiveConf hiveConf;
-
- @Override
- protected void setUp() throws Exception {
-
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void testUrlHook() throws Exception {
- hiveConf = new HiveConf(this.getClass());
- hiveConf.setVar(HiveConf.ConfVars.METASTORECONNECTURLHOOK,
- DummyJdoConnectionUrlHook.class.getName());
- hiveConf.setVar(HiveConf.ConfVars.METASTORECONNECTURLKEY,
- DummyJdoConnectionUrlHook.initialUrl);
- hiveConf.setVar(HiveConf.ConfVars.METASTORE_RAW_STORE_IMPL,
- DummyRawStoreForJdoConnection.class.getName());
- hiveConf.setBoolean("hive.metastore.checkForDefaultDb", true);
- SessionState.start(new CliSessionState(hiveConf));
-
- // Instantiating the HMSHandler with hive.metastore.checkForDefaultDb will cause it to
- // initialize an instance of the DummyRawStoreForJdoConnection
- HiveMetaStore.HMSHandler hms = new HiveMetaStore.HMSHandler(
- "test_metastore_connection_url_hook_hms_handler", hiveConf);
- }
-}
http://git-wip-us.apache.org/repos/asf/hive/blob/c2bbd5f4/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestPartitionExpressionProxyDefault.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestPartitionExpressionProxyDefault.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestPartitionExpressionProxyDefault.java
new file mode 100644
index 0000000..e654c02
--- /dev/null
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestPartitionExpressionProxyDefault.java
@@ -0,0 +1,40 @@
+package org.apache.hadoop.hive.metastore;
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.metastore.api.MetaException;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
+import org.apache.hadoop.hive.ql.optimizer.ppr.PartitionExpressionForMetastore;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Make sure that when HiveMetaStore is instantiated, the default proper PartitionExpressionProxy
+ * instance is instantiated.
+ */
+public class TestPartitionExpressionProxyDefault {
+
+ @Test
+ public void checkPartitionExpressionProxy() throws MetaException {
+ Configuration conf = MetastoreConf.newMetastoreConf();
+ HiveMetaStore.HMSHandler hms = new HiveMetaStore.HMSHandler("for testing", conf, true);
+ Assert.assertEquals(PartitionExpressionForMetastore.class,
+ hms.getExpressionProxy().getClass());
+ }
+}
http://git-wip-us.apache.org/repos/asf/hive/blob/c2bbd5f4/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestMetaStoreLimitPartitionRequest.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestMetaStoreLimitPartitionRequest.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestMetaStoreLimitPartitionRequest.java
index 191d4a3..e783180 100644
--- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestMetaStoreLimitPartitionRequest.java
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestMetaStoreLimitPartitionRequest.java
@@ -35,6 +35,7 @@ import java.util.Set;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
import org.apache.hadoop.hive.metastore.HiveMetaStore;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
import org.apache.hive.jdbc.miniHS2.MiniHS2;
import org.apache.hive.service.cli.HiveSQLException;
import org.junit.After;
@@ -290,7 +291,7 @@ public class TestMetaStoreLimitPartitionRequest {
+ PARTITION_REQUEST_LIMIT);
} catch (HiveSQLException e) {
String exceedLimitMsg = String.format(HiveMetaStore.PARTITION_NUMBER_EXCEED_LIMIT_MSG, expectedPartitionNumber,
- TABLE_NAME, PARTITION_REQUEST_LIMIT, ConfVars.METASTORE_LIMIT_PARTITION_REQUEST.varname);
+ TABLE_NAME, PARTITION_REQUEST_LIMIT, MetastoreConf.ConfVars.LIMIT_PARTITION_REQUEST.toString());
assertTrue(getWrongExceptionMessage(exceedLimitMsg, e.getMessage()),
e.getMessage().contains(exceedLimitMsg.toString()));
}