[ 
https://issues.apache.org/jira/browse/HADOOP-15891?focusedWorklogId=481238&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-481238
 ]

ASF GitHub Bot logged work on HADOOP-15891:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Sep/20 05:26
            Start Date: 10/Sep/20 05:26
    Worklog Time Spent: 10m 
      Work Description: umamaheswararao commented on pull request #2185:
URL: https://github.com/apache/hadoop/pull/2185#issuecomment-689992391


   I think the following new lines added into this method
   
   ```
   } else if (src.startsWith(Constants.CONFIG_VIEWFS_LINK_REGEX)) {
           final String target = si.getValue();
           String linkKeyPath = null;
           final String linkRegexPrefix = Constants.CONFIG_VIEWFS_LINK_REGEX + 
".";
           // settings#.linkKey
           String settingsAndLinkKeyPath = 
src.substring(linkRegexPrefix.length());
           int settingLinkKeySepIndex = settingsAndLinkKeyPath
               .indexOf(RegexMountPoint.SETTING_SRCREGEX_SEP);
           if (settingLinkKeySepIndex == -1) {
             // There's no settings
             linkKeyPath = settingsAndLinkKeyPath;
             settings = null;
           } else {
             // settings#.linkKey style configuration
             // settings from settings#.linkKey
             settings =
                 settingsAndLinkKeyPath.substring(0, settingLinkKeySepIndex);
             // linkKeyPath
             linkKeyPath = settingsAndLinkKeyPath.substring(
                 settings.length() + RegexMountPoint.SETTING_SRCREGEX_SEP
                     .length());
           }
           linkType = LinkType.REGEX;
           linkEntries.add(
               new LinkEntry(linkKeyPath, target, linkType, settings, ugi,
                   config));
           continue;
         }
   
   .......
   .......
   
    case REGEX:
             LOGGER.info("Add regex mount point:" + le.getSrc()
                 + ", target:" + le.getTarget()
                 + ", interceptor settings:" + le.getSettings());
             RegexMountPoint regexMountPoint =
                 new RegexMountPoint<T>(
                     this, le.getSrc(), le.getTarget(), le.getSettings());
             regexMountPoint.initialize();
             regexMountPointList.add(regexMountPoint);
             continue;
   
   ```
   
   Probably we can extract this logics to separate methods.
   I understand it needs multiple values needs to get from extarcted method, 
they are settings, linkType etc. Probably you can create LinkEntry in method 
and return LinkEntry. From there you can set linkType, settings etc.
   Check if they are possible to reduce lines in that method.
   
   move the following code to a small check method. There are two places we are 
doing same checks.
   ```
   if (src.length() != linkMergeSlashPrefix.length()) {
             throw new IOException("ViewFs: Mount points initialization error." 
+
                 " Invalid " + Constants.CONFIG_VIEWFS_LINK_MERGE_SLASH +
                 " entry in config: " + src);
           }
   ```
   At end of the method we have some logics for handle no mount points code. IF 
we need we could extract that to handleNoMountPoints method or so.
   
   Check if this refactoring can make checkstyle happy and code can look 
cleaner.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 481238)
    Time Spent: 7.5h  (was: 7h 20m)

> Provide Regex Based Mount Point In Inode Tree
> ---------------------------------------------
>
>                 Key: HADOOP-15891
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15891
>             Project: Hadoop Common
>          Issue Type: New Feature
>          Components: viewfs
>            Reporter: zhenzhao wang
>            Assignee: zhenzhao wang
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HADOOP-15891.015.patch, HDFS-13948.001.patch, 
> HDFS-13948.002.patch, HDFS-13948.003.patch, HDFS-13948.004.patch, 
> HDFS-13948.005.patch, HDFS-13948.006.patch, HDFS-13948.007.patch, 
> HDFS-13948.008.patch, HDFS-13948.009.patch, HDFS-13948.011.patch, 
> HDFS-13948.012.patch, HDFS-13948.013.patch, HDFS-13948.014.patch, HDFS-13948_ 
> Regex Link Type In Mont Table-V0.pdf, HDFS-13948_ Regex Link Type In Mount 
> Table-v1.pdf
>
>          Time Spent: 7.5h
>  Remaining Estimate: 0h
>
> This jira is created to support regex based mount point in Inode Tree. We 
> noticed that mount point only support fixed target path. However, we might 
> have user cases when target needs to refer some fields from source. e.g. We 
> might want a mapping of /cluster1/user1 => /cluster1-dc1/user-nn-user1, we 
> want to refer `cluster` and `user` field in source to construct target. It's 
> impossible to archive this with current link type. Though we could set 
> one-to-one mapping, the mount table would become bloated if we have thousands 
> of users. Besides, a regex mapping would empower us more flexibility. So we 
> are going to build a regex based mount point which target could refer groups 
> from src regex mapping. 



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

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

Reply via email to