You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by sa...@apache.org on 2020/05/01 19:23:12 UTC
[hbase-operator-tools] 01/01: Revert "HBASE-24222 Remove
FSUtils.checkAccess and replace with FileSystem.access in
hbase-operator-tools (#58)"
This is an automated email from the ASF dual-hosted git repository.
sakthi pushed a commit to branch revert-58-master
in repository https://gitbox.apache.org/repos/asf/hbase-operator-tools.git
commit 19ca52dc572147f1d11f56281964071a2c70ed79
Author: Sakthi <sa...@gmail.com>
AuthorDate: Fri May 1 12:23:05 2020 -0700
Revert "HBASE-24222 Remove FSUtils.checkAccess and replace with FileSystem.access in hbase-operator-tools (#58)"
This reverts commit e6e54aa568271c68f03f6833bed1776c80fcc0cd.
---
hbase-hbck2/src/main/java/org/apache/hbase/hbck1/HBaseFsck.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hbase-hbck2/src/main/java/org/apache/hbase/hbck1/HBaseFsck.java b/hbase-hbck2/src/main/java/org/apache/hbase/hbck1/HBaseFsck.java
index 7cda06b..dcf88bb 100644
--- a/hbase-hbck2/src/main/java/org/apache/hbase/hbck1/HBaseFsck.java
+++ b/hbase-hbck2/src/main/java/org/apache/hbase/hbck1/HBaseFsck.java
@@ -125,6 +125,7 @@ import org.apache.hadoop.hbase.replication.ReplicationException;
import org.apache.hadoop.hbase.replication.ReplicationPeerDescription;
import org.apache.hadoop.hbase.replication.ReplicationQueueStorage;
import org.apache.hadoop.hbase.replication.ReplicationStorageFactory;
+import org.apache.hadoop.hbase.security.AccessDeniedException;
import org.apache.hadoop.hbase.security.UserProvider;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Bytes.ByteArrayComparator;
@@ -144,7 +145,6 @@ import org.apache.hadoop.hbase.zookeeper.ZKWatcher;
import org.apache.hadoop.hbase.zookeeper.ZNodePaths;
import org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException;
import org.apache.hadoop.ipc.RemoteException;
-import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.hadoop.util.Tool;
@@ -2450,7 +2450,7 @@ public class HBaseFsck extends Configured implements Closeable {
}
}
- private void preCheckPermission() throws IOException {
+ private void preCheckPermission() throws IOException, AccessDeniedException {
if (shouldIgnorePreCheckPermission()) {
return;
}
@@ -2462,8 +2462,8 @@ public class HBaseFsck extends Configured implements Closeable {
FileStatus[] files = fs.listStatus(hbaseDir);
for (FileStatus file : files) {
try {
- fs.access(file.getPath(), FsAction.WRITE);
- } catch (AccessControlException ace) {
+ FSUtils.checkAccess(ugi, file, FsAction.WRITE);
+ } catch (AccessDeniedException ace) {
LOG.warn("Got AccessDeniedException when preCheckPermission ", ace);
errors.reportError(ErrorReporter.ERROR_CODE.WRONG_USAGE, "Current user " +
ugi.getUserName() + " does not have write perms to " + file.getPath() +