[ 
https://issues.apache.org/jira/browse/HDFS-14908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16957619#comment-16957619
 ] 

Xiaoqiao He commented on HDFS-14908:
------------------------------------

Thanks [~LiJinglun] for your feedback. What I mean that it could be more 
simpler as following demo shows consider this is a minor bugfix and only act on 
DFSAdmin#listOpenFiles, AND not more performance changes even if we add many 
codes. Welcome to some more suggestions cc [~elgoiri].
{code:java}
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
@@ -1872,7 +1872,8 @@ private void metaSave(PrintWriter out) {
 
         String fullPathName = inodeFile.getFullPathName();
         if (org.apache.commons.lang3.StringUtils.isEmpty(path)
-            || fullPathName.startsWith(path)) {
+            || (fullPathName.startsWith(path) && (fullPathName.equals(path)
+                || fullPathName.charAt(path.length() - 1) == 
Path.SEPARATOR_CHAR))) {
           openFileEntries.add(new OpenFileEntry(inodeFile.getId(),
               inodeFile.getFullPathName(),
               inodeFile.getFileUnderConstructionFeature().getClientName(),
{code}

> LeaseManager should check parent-child relationship when filter open files.
> ---------------------------------------------------------------------------
>
>                 Key: HDFS-14908
>                 URL: https://issues.apache.org/jira/browse/HDFS-14908
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 3.1.0, 3.0.1
>            Reporter: Jinglun
>            Assignee: Jinglun
>            Priority: Minor
>         Attachments: HDFS-14908.001.patch, HDFS-14908.002.patch, 
> HDFS-14908.003.patch, Test.java, TestV2.java
>
>
> Now when doing listOpenFiles(), LeaseManager only checks whether the filter 
> path is the prefix of the open files. We should check whether the filter path 
> is the parent/ancestor of the open files.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to