[
https://issues.apache.org/jira/browse/HADOOP-18450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17699118#comment-17699118
]
ASF GitHub Bot commented on HADOOP-18450:
-----------------------------------------
virajjasani commented on code in PR #5452:
URL: https://github.com/apache/hadoop/pull/5452#discussion_r1132896769
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java:
##########
@@ -640,6 +640,10 @@ private void revertFromOld(Path oldPath, boolean
fileExisted)
private void renameOrFail(Path src, Path dest)
throws IOException {
if (!fs.rename(src, dest)) {
+ if (!fs.exists(src)) {
+ throw new FileNotFoundException(src.toUri().toString());
+ }
Review Comment:
How about keeping this check just before `fs#rename`? Could save efforts of
doing rename in the first place?
> JavaKeyStoreProvider should throw FileNotFoundException in renameOrFail
> -----------------------------------------------------------------------
>
> Key: HADOOP-18450
> URL: https://issues.apache.org/jira/browse/HADOOP-18450
> Project: Hadoop Common
> Issue Type: New Feature
> Components: common
> Affects Versions: 3.4.0, 3.3.5
> Environment: UBI 8 running Java 11
> Reporter: Steve Vaughan
> Assignee: Steve Vaughan
> Priority: Critical
> Labels: pull-request-available
>
> Attempting to create a key a KMS is configured with the JavaKeystoreProvider
> and an HDFS store. The calls to:
> {noformat}
> renameOrFail(Path src, Path dest) throws IOException {noformat}
> ... fails with an IOException when it attempts to rename a file. The calling
> code catches FileNotFoundException since the src file may not exist.
>
> Example:
> {noformat}
> $ hadoop key create sample
> java.io.IOException: Rename unsuccessful :
> 'hdfs://mycluster/security/kms.jks_NEW' to
> 'hdfs://mycluster/security/kms.jks_NEW_ORPHANED_1662946593691'{noformat}
>
> Update the implementation to check for the file, throwing a
> FileNotFoundException.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]