You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2018/08/20 01:55:11 UTC
[2/4] hbase git commit: HBASE-18512,
Region Server will abort with IllegalStateException if HDFS umask has
limited scope
HBASE-18512, Region Server will abort with IllegalStateException if HDFS umask has limited scope
Signed-off-by: tedyu <yu...@gmail.com>
(cherry picked from commit 12201249383bb7dab56ff857fba074c6ed311990)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/d1b0c322
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d1b0c322
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d1b0c322
Branch: refs/heads/branch-1.3
Commit: d1b0c322373e27f10ac104ae2c2fd2645444929f
Parents: 7d7279d
Author: Pankaj Kumar <pa...@huawei.com>
Authored: Mon Aug 14 21:27:45 2017 +0800
Committer: Sean Busbey <bu...@apache.org>
Committed: Fri Aug 17 23:10:40 2018 -0500
----------------------------------------------------------------------
.../security/access/SecureBulkLoadEndpoint.java | 21 +++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/d1b0c322/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SecureBulkLoadEndpoint.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SecureBulkLoadEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SecureBulkLoadEndpoint.java
index f0169ab..2ad8cee 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SecureBulkLoadEndpoint.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SecureBulkLoadEndpoint.java
@@ -148,15 +148,26 @@ public class SecureBulkLoadEndpoint extends SecureBulkLoadService
fs = baseStagingDir.getFileSystem(conf);
if (!fs.exists(baseStagingDir)) {
fs.mkdirs(baseStagingDir, PERM_HIDDEN);
- } else {
- fs.setPermission(baseStagingDir, PERM_HIDDEN);
}
- //no sticky bit in hadoop-1.0, making directory nonempty so it never gets erased
- fs.mkdirs(new Path(baseStagingDir,"DONOTERASE"), PERM_HIDDEN);
FileStatus status = fs.getFileStatus(baseStagingDir);
- if(status == null) {
+ if (status == null) {
throw new IllegalStateException("Failed to create staging directory");
}
+
+ // If HDFS UMASK value has limited scope then staging directory permission may not be 711
+ // after creation, so we should set staging directory permission explicitly.
+ if (!status.getPermission().equals(PERM_HIDDEN)) {
+ fs.setPermission(baseStagingDir, PERM_HIDDEN);
+ status = fs.getFileStatus(baseStagingDir);
+ }
+
+ // no sticky bit in hadoop-1.0, making directory nonempty so it never gets erased
+ Path doNotEraseDir = new Path(baseStagingDir, "DONOTERASE");
+ if (!fs.exists(doNotEraseDir)) {
+ fs.mkdirs(doNotEraseDir, PERM_HIDDEN);
+ fs.setPermission(doNotEraseDir, PERM_HIDDEN);
+ }
+
String scheme = fs.getScheme().toLowerCase();
if (!fsSet.contains(scheme) && !status.getPermission().equals(PERM_HIDDEN)) {
throw new IllegalStateException(