Skip to content

Commit

Permalink
Use 2.2 hive client for greater compatibility
Browse files Browse the repository at this point in the history
Cherry-pick of existing commit.
orig-pr: #10615
orig-commit: 69eb9f3
orig-commit-author: Gene Pang <gene.pang@gmail.com>

pr-link: #10628
change-id: cid-4252def95b950aa7bce0db631078cdf510c3dff1
  • Loading branch information
alluxio-bot committed Dec 12, 2019
1 parent 9c03e91 commit 257aa33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion table/server/underdb/hive/pom.xml
Expand Up @@ -26,7 +26,8 @@
<!-- The following paths need to be defined here as well as in the parent pom so that mvn can -->
<!-- run properly from sub-project directories -->
<build.path>${project.parent.parent.parent.parent.basedir}/build</build.path>
<hive-metastore.version>2.3.6</hive-metastore.version>
<!-- 2.2.0 client works with a wide range of HMS, from 1.0 to 3.1 -->
<hive-metastore.version>2.2.0</hive-metastore.version>
</properties>

<dependencies>
Expand Down
Expand Up @@ -30,6 +30,7 @@
import alluxio.util.io.PathUtils;

import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.HiveMetaHookLoader;
import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
import org.apache.hadoop.hive.metastore.IMetaStoreClient;
import org.apache.hadoop.hive.metastore.RetryingMetaStoreClient;
Expand All @@ -55,6 +56,7 @@
*/
public class HiveDatabase implements UnderDatabase {
private static final Logger LOG = LoggerFactory.getLogger(HiveDatabase.class);
private static final HiveMetaHookLoader NOOP_HOOK = table -> null;

private final UdbContext mUdbContext;
private final UdbConfiguration mConfiguration;
Expand Down Expand Up @@ -252,7 +254,8 @@ IMetaStoreClient getHive() throws IOException {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
HiveConf conf = new HiveConf();
conf.verifyAndSet("hive.metastore.uris", mConnectionUri);
mHive = RetryingMetaStoreClient.getProxy(conf, null, HiveMetaStoreClient.class.getName());
mHive =
RetryingMetaStoreClient.getProxy(conf, NOOP_HOOK, HiveMetaStoreClient.class.getName());
mHive.getDatabase(mHiveDbName);
return mHive;
} catch (NoSuchObjectException e) {
Expand Down

0 comments on commit 257aa33

Please sign in to comment.