You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by br...@apache.org on 2015/01/14 18:28:23 UTC
svn commit: r1651739 - in /hive/branches/HIVE-8065:
itests/util/src/main/java/org/apache/hadoop/hive/ql/
shims/0.23/src/main/java/org/apache/hadoop/hive/shims/
shims/common/src/main/java/org/apache/hadoop/hive/shims/
Author: brock
Date: Wed Jan 14 17:28:23 2015
New Revision: 1651739
URL: http://svn.apache.org/r1651739
Log:
HIVE-9355 - Remove keys in the cleanup methods for encryption related qtest (Ferdinand Xu via Brock)
Modified:
hive/branches/HIVE-8065/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
hive/branches/HIVE-8065/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
hive/branches/HIVE-8065/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java
Modified: hive/branches/HIVE-8065/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-8065/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java?rev=1651739&r1=1651738&r2=1651739&view=diff
==============================================================================
--- hive/branches/HIVE-8065/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java (original)
+++ hive/branches/HIVE-8065/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java Wed Jan 14 17:28:23 2015
@@ -618,6 +618,19 @@ public class QTestUtil {
setup.postTest(conf);
}
+ public void clearKeysCreatedInTests() {
+ if (hes == null) {
+ return;
+ }
+ try {
+ for (String keyAlias : hes.getKeys()) {
+ hes.deleteKey(keyAlias);
+ }
+ } catch (IOException e) {
+ LOG.error("Fail to clean the keys created in test due to the error", e);
+ }
+ }
+
/**
* Clear out any side effects of running tests
*/
@@ -688,6 +701,7 @@ public class QTestUtil {
}
clearTablesCreatedDuringTests();
+ clearKeysCreatedInTests();
if (clusterType != MiniClusterType.encrypted) {
// allocate and initialize a new conf since a test can
@@ -697,6 +711,7 @@ public class QTestUtil {
// renew the metastore since the cluster type is unencrypted
db = Hive.get(conf); // propagate new conf to meta store
}
+
setup.preTest(conf);
}
@@ -709,6 +724,7 @@ public class QTestUtil {
}
clearTablesCreatedDuringTests();
+ clearKeysCreatedInTests();
SessionState.get().getConf().setBoolean("hive.test.shutdown.phase", true);
Modified: hive/branches/HIVE-8065/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-8065/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java?rev=1651739&r1=1651738&r2=1651739&view=diff
==============================================================================
--- hive/branches/HIVE-8065/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java (original)
+++ hive/branches/HIVE-8065/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java Wed Jan 14 17:28:23 2015
@@ -1048,9 +1048,7 @@ public class Hadoop23Shims extends Hadoo
public void createKey(String keyName, int bitLength)
throws IOException, NoSuchAlgorithmException {
- if (keyProvider == null) {
- throw new IOException("HDFS security key provider is not configured on your server.");
- }
+ checkKeyProvider();
if (keyProvider.getMetadata(keyName) == null) {
final KeyProvider.Options options = new Options(this.conf);
@@ -1065,9 +1063,7 @@ public class Hadoop23Shims extends Hadoo
@Override
public void deleteKey(String keyName) throws IOException {
- if (keyProvider == null) {
- throw new IOException("HDFS security key provider is not configured on your server.");
- }
+ checkKeyProvider();
if (keyProvider.getMetadata(keyName) != null) {
keyProvider.deleteKey(keyName);
@@ -1077,6 +1073,18 @@ public class Hadoop23Shims extends Hadoo
}
}
+ @Override
+ public List<String> getKeys() throws IOException {
+ checkKeyProvider();
+ return keyProvider.getKeys();
+ }
+
+ private void checkKeyProvider() throws IOException {
+ if (keyProvider == null) {
+ throw new IOException("HDFS security key provider is not configured on your server.");
+ }
+ }
+
/**
* Compares two encryption key strengths.
*
Modified: hive/branches/HIVE-8065/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-8065/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java?rev=1651739&r1=1651738&r2=1651739&view=diff
==============================================================================
--- hive/branches/HIVE-8065/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java (original)
+++ hive/branches/HIVE-8065/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java Wed Jan 14 17:28:23 2015
@@ -612,6 +612,9 @@ public interface HadoopShims {
@VisibleForTesting
public void deleteKey(String keyName) throws IOException;
+
+ @VisibleForTesting
+ public List<String> getKeys() throws IOException;
}
/**
@@ -649,7 +652,13 @@ public interface HadoopShims {
@Override
public void deleteKey(String keyName) throws IOException {
/* not supported */
- };
+ }
+
+ @Override
+ public List<String> getKeys() throws IOException{
+ /* not supported */
+ return null;
+ }
}
/**