HDFS-11689. New exception thrown by DFSClient%isHDFSEncryptionEnabled broke hacky hive code. Contributed by Yongjun Zhang.

(cherry picked from commit 5078df7be3)
This commit is contained in:
Yongjun Zhang 2017-04-21 13:36:31 -07:00
parent 28f0de875d
commit c88e5e1836
2 changed files with 17 additions and 9 deletions

View File

@ -3060,10 +3060,24 @@ public void setKeyProvider(KeyProvider provider) {
/** /**
* Probe for encryption enabled on this filesystem. * Probe for encryption enabled on this filesystem.
* Note (see HDFS-11689):
* Not to throw exception in this method since it would break hive.
* Hive accesses this method and assumes no exception would be thrown.
* Hive should not access DFSClient since it is InterfaceAudience.Private.
* Deprecated annotation is added to trigger build warning at hive side.
* Request has been made to Hive to remove access to DFSClient.
* @return true if encryption is enabled * @return true if encryption is enabled
*/ */
public boolean isHDFSEncryptionEnabled() throws IOException{ @Deprecated
return getKeyProviderUri() != null; public boolean isHDFSEncryptionEnabled() {
boolean result = false;
try {
result = (getKeyProviderUri() != null);
} catch (IOException ioe) {
DFSClient.LOG.warn("Exception while checking whether encryption zone "
+ "is supported, assumes it is not supported", ioe);
}
return result;
} }
/** /**

View File

@ -2476,13 +2476,7 @@ public DFSInotifyEventInputStream getInotifyEventStream(long lastReadTxid)
*/ */
@Override @Override
public Path getTrashRoot(Path path) { public Path getTrashRoot(Path path) {
try { if ((path == null) || !dfs.isHDFSEncryptionEnabled()) {
if ((path == null) || !dfs.isHDFSEncryptionEnabled()) {
return super.getTrashRoot(path);
}
} catch (IOException ioe) {
DFSClient.LOG.warn("Exception while checking whether encryption zone is "
+ "supported", ioe);
return super.getTrashRoot(path); return super.getTrashRoot(path);
} }