HDFS-11689. New exception thrown by DFSClient%isHDFSEncryptionEnabled broke hacky hive code. Contributed by Yongjun Zhang.
This commit is contained in:
parent
a22fe02fba
commit
5078df7be3
@ -2944,10 +2944,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2570,13 +2570,7 @@ public Void next(final FileSystem fs, final Path p) throws IOException {
|
|||||||
*/
|
*/
|
||||||
@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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user