You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by we...@apache.org on 2020/11/03 19:29:23 UTC
[hadoop] branch branch-3.1 updated: HADOOP-17255.
JavaKeyStoreProvider fails to create a new key if the keystore is HDFS.
(#2291)
This is an automated email from the ASF dual-hosted git repository.
weichiu pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 166bee9 HADOOP-17255. JavaKeyStoreProvider fails to create a new key if the keystore is HDFS. (#2291)
166bee9 is described below
commit 166bee93af6fb68ee2b3fab4c355413cae9fc1d6
Author: Akira Ajisaka <aa...@apache.org>
AuthorDate: Wed Nov 4 04:20:23 2020 +0900
HADOOP-17255. JavaKeyStoreProvider fails to create a new key if the keystore is HDFS. (#2291)
Reviewed-by: Steve Loughran <st...@cloudera.com>
Reviewed-by: Wei-Chiu Chuang <we...@apache.org>
(cherry picked from commit 7f5caca04cb8e5dab8410ef64daa0fe799e389fd)
(cherry picked from commit dd1634ec3b676d6c3da18af7da46734584ddd9f6)
(cherry picked from commit 1c7043b1ff89ba9c995cbf546a99bbbcccbe56b1)
---
.../java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java
index 5beda0d..a41e36a 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -103,6 +104,7 @@ public class JavaKeyStoreProvider extends KeyProvider {
private final Path path;
private final FileSystem fs;
private FsPermission permissions;
+ private FileContext context;
private KeyStore keyStore;
private char[] password;
private boolean changed = false;
@@ -130,6 +132,7 @@ public class JavaKeyStoreProvider extends KeyProvider {
this.uri = uri;
path = ProviderUtils.unnestUri(uri);
fs = path.getFileSystem(conf);
+ context = FileContext.getFileContext(conf);
locateKeystore();
ReadWriteLock lock = new ReentrantReadWriteLock(true);
readLock = lock.readLock();
@@ -638,10 +641,7 @@ public class JavaKeyStoreProvider extends KeyProvider {
private void renameOrFail(Path src, Path dest)
throws IOException {
- if (!fs.rename(src, dest)) {
- throw new IOException("Rename unsuccessful : "
- + String.format("'%s' to '%s'", src, dest));
- }
+ context.rename(src, dest, org.apache.hadoop.fs.Options.Rename.NONE);
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org