You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jd...@apache.org on 2015/09/23 01:32:29 UTC

hive git commit: HIVE-11762: TestHCatLoaderEncryption failures when using Hadoop 2.7 (Jason Dere, reviewed by Sergio Pena)

Repository: hive
Updated Branches:
  refs/heads/master 5a5539c36 -> 1c52a7e72


HIVE-11762: TestHCatLoaderEncryption failures when using Hadoop 2.7 (Jason Dere, reviewed by Sergio Pena)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1c52a7e7
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1c52a7e7
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1c52a7e7

Branch: refs/heads/master
Commit: 1c52a7e72ab9c2a27902592599bc588e9e3d8be8
Parents: 5a5539c
Author: Jason Dere <jd...@hortonworks.com>
Authored: Tue Sep 22 16:31:07 2015 -0700
Committer: Jason Dere <jd...@hortonworks.com>
Committed: Tue Sep 22 16:31:07 2015 -0700

----------------------------------------------------------------------
 shims/0.23/pom.xml                              |  1 -
 .../apache/hadoop/hive/shims/Hadoop23Shims.java | 23 +++++++++++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/1c52a7e7/shims/0.23/pom.xml
----------------------------------------------------------------------
diff --git a/shims/0.23/pom.xml b/shims/0.23/pom.xml
index 2e16956..3b1fb97 100644
--- a/shims/0.23/pom.xml
+++ b/shims/0.23/pom.xml
@@ -61,7 +61,6 @@
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdfs</artifactId>
       <version>${hadoop-23.version}</version>
-      <optional>true</optional>
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>

http://git-wip-us.apache.org/repos/asf/hive/blob/1c52a7e7/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
----------------------------------------------------------------------
diff --git a/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java b/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
index 83369ee..c08e76d 100644
--- a/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
+++ b/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
@@ -532,13 +532,34 @@ public class Hadoop23Shims extends HadoopShimsSecure {
     // else the updates do not get flushed properly
     KeyProviderCryptoExtension keyProvider =  miniDFSCluster.getNameNode().getNamesystem().getProvider();
     if (keyProvider != null) {
-      miniDFSCluster.getFileSystem().getClient().setKeyProvider(keyProvider);
+      try {
+        setKeyProvider(miniDFSCluster.getFileSystem().getClient(), keyProvider);
+      } catch (Exception err) {
+        throw new IOException(err);
+      }
     }
 
     cluster = new MiniDFSShim(miniDFSCluster);
     return cluster;
   }
 
+  private static void setKeyProvider(DFSClient dfsClient, KeyProviderCryptoExtension provider)
+      throws Exception {
+    Method setKeyProviderHadoop27Method = null;
+    try {
+      setKeyProviderHadoop27Method = DFSClient.class.getMethod("setKeyProvider", KeyProvider.class);
+    } catch (NoSuchMethodException err) {
+      // We can just use setKeyProvider() as it is
+    }
+
+    if (setKeyProviderHadoop27Method != null) {
+      // Method signature changed in Hadoop 2.7. Cast provider to KeyProvider
+      setKeyProviderHadoop27Method.invoke(dfsClient, (KeyProvider) provider);
+    } else {
+      dfsClient.setKeyProvider(provider);
+    }
+  }
+
   /**
    * MiniDFSShim.
    *