[ https://issues.apache.org/jira/browse/HDFS-16881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17654231#comment-17654231 ]
ASF GitHub Bot commented on HDFS-16881: --------------------------------------- szetszwo commented on code in PR #5268: URL: https://github.com/apache/hadoop/pull/5268#discussion_r1061074364 ########## hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java: ########## @@ -388,6 +392,12 @@ public enum DirOp { DFS_PROTECTED_SUBDIRECTORIES_ENABLE, DFS_PROTECTED_SUBDIRECTORIES_ENABLE_DEFAULT); + final long readLockThresholdMs = conf.getLong( + DFS_NAMENODE_READ_LOCK_REPORTING_THRESHOLD_MS_KEY, + DFS_NAMENODE_READ_LOCK_REPORTING_THRESHOLD_MS_DEFAULT); + // use half of read lock threshold Review Comment: Indeed, let's make it configurable. ########## hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSPermissionChecker.java: ########## @@ -446,4 +447,20 @@ private static INodeFile createINodeFile(INodeDirectory parent, String name, parent.addChild(inodeFile); return inodeFile; } + + @Test + public void testCheckAccessControlEnforcerSlowness() throws Exception { + final long thresholdMs = 10; + final String message = FSPermissionChecker.runCheckPermission(() -> { + try { + Thread.sleep(20); + } catch (InterruptedException e) { + throw new RuntimeException(e); Review Comment: Sure. Thanks for pointing out the JUnit behavior. > Warn if AccessControlEnforcer runs for a long time to check permission > ---------------------------------------------------------------------- > > Key: HDFS-16881 > URL: https://issues.apache.org/jira/browse/HDFS-16881 > Project: Hadoop HDFS > Issue Type: Bug > Components: namanode > Reporter: Tsz-wo Sze > Assignee: Tsz-wo Sze > Priority: Major > Labels: pull-request-available > > AccessControlEnforcer is configurable. If an external AccessControlEnforcer > runs for a long time to check permission with the FSnamesystem lock, it will > significantly slow down the entire Namenode. In the JIRA, we will print a > WARN message when it happens. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org