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

Íñigo Goiri commented on HDFS-13453:
------------------------------------

Internally, we had:
{code}
  private Map<String, Long> getMountPointDates(String path) {
    Map<String, Long> ret = new TreeMap<>();
    if (subclusterResolver instanceof MountTableResolver) {
      try {
        MountTableResolver mountTable = (MountTableResolver)subclusterResolver;
        List<MountTable> entries = mountTable.getMounts(path);
        for (MountTable entry : entries) {
          String srcPath = entry.getSourcePath();
          long modTime = entry.getDateModified();

          // Remove the suffix
          srcPath = srcPath.substring(path.length());
          int index = srcPath.indexOf("/");
          if (index > 0) {
            srcPath = srcPath.substring(0, index);
          }
          // Remove the / in the beginning
          if (srcPath.startsWith("/")) {
            srcPath = srcPath.substring(1);
          }

          // Get the latest date
          Long prevTime = ret.get(srcPath);
          if (prevTime == null || prevTime < modTime) {
            ret.put(srcPath, modTime);
          }
        }
      } catch (IOException ioe) {
        LOG.error("Cannot get mount table entries", ioe);
      }
    }
    return ret;
  }
{code}

I think that  [^HDFS-13453-001.patch] goes even a little further.
You may want to extract the variable and do a merge of these two approaches.

> RBF: getMountPointDates should fetch latest subdir time/date when parent dir 
> is not present but /parent/child dirs are present in mount table
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-13453
>                 URL: https://issues.apache.org/jira/browse/HDFS-13453
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Dibyendu Karmakar
>            Assignee: Dibyendu Karmakar
>            Priority: Major
>         Attachments: HDFS-13453-000.patch, HDFS-13453-001.patch
>
>
> [HDFS-13386|https://issues.apache.org/jira/browse/HDFS-13386] is not handling 
> the case when /parent in not present in mount table but /parent/subdir is in 
> mount table.
> In this case getMountPointDates is not able to fetch the latest time for 
> /parent as /parent is not present in mount table.
> For this scenario we will display latest modified subdir date/time as /parent 
> modified time.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
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