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

This commit is contained in:
Yongjun Zhang 2017-04-21 13:36:31 -07:00
parent a22fe02fba
commit 5078df7be3
2 changed files with 17 additions and 9 deletions

View File

@ -2944,10 +2944,24 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
/**
* 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
*/
public boolean isHDFSEncryptionEnabled() throws IOException{
return getKeyProviderUri() != null;
@Deprecated
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

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