hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (Jira)" <j...@apache.org>
Subject [jira] [Work logged] (HADOOP-15891) Provide Regex Based Mount Point In Inode Tree
Date Wed, 02 Sep 2020 01:15:00 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 02/Sep/20 01:14
            Start Date: 02/Sep/20 01:14
    Worklog Time Spent: 10m 
      Work Description: JohnZZGithub commented on a change in pull request #2185:
URL: https://github.com/apache/hadoop/pull/2185#discussion_r481521111



##########
File path: hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestRegexMountPointResolvedDstPathReplaceInterceptor.java
##########
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.fs.viewfs;
+
+import java.io.IOException;
+
+import org.apache.hadoop.fs.Path;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.apache.hadoop.fs.viewfs.RegexMountPointInterceptorType.REPLACE_RESOLVED_DST_PATH;
+
+/**
+ * Test RegexMountPointResolvedDstPathReplaceInterceptor.
+ */
+public class TestRegexMountPointResolvedDstPathReplaceInterceptor {
+
+  public String createSerializedString(String regex, String replaceString) {
+    return REPLACE_RESOLVED_DST_PATH.getConfigName()
+        + RegexMountPoint.INTERCEPTOR_INTERNAL_SEP + regex
+        + RegexMountPoint.INTERCEPTOR_INTERNAL_SEP + replaceString;
+  }
+
+  @Test
+  public void testDeserializeFromStringNormalCase() throws IOException {
+    String srcRegex = "-";
+    String replaceString = "_";
+    String serializedString = createSerializedString(srcRegex, replaceString);
+    RegexMountPointResolvedDstPathReplaceInterceptor interceptor =
+        RegexMountPointResolvedDstPathReplaceInterceptor
+            .deserializeFromString(serializedString);
+    Assert.assertTrue(interceptor.getSrcRegexString().equals(srcRegex));
+    Assert.assertTrue(interceptor.getReplaceString().equals(replaceString));
+    Assert.assertTrue(interceptor.getSrcRegexPattern() == null);
+    interceptor.initialize();
+    Assert.assertTrue(
+        interceptor.getSrcRegexPattern().toString().equals(srcRegex));
+  }
+
+  @Test
+  public void testDeserializeFromStringBadCase() throws IOException {
+    String srcRegex = "-";
+    String replaceString = "_";
+    String serializedString = createSerializedString(srcRegex, replaceString);
+    serializedString = serializedString + ":ddd";
+    RegexMountPointResolvedDstPathReplaceInterceptor interceptor =
+        RegexMountPointResolvedDstPathReplaceInterceptor
+            .deserializeFromString(serializedString);
+    Assert.assertEquals(interceptor, null);
+  }
+
+  @Test
+  public void testSerialization() {
+    String srcRegex = "word1";
+    String replaceString = "word2";
+    String serializedString = createSerializedString(srcRegex, replaceString);
+    RegexMountPointResolvedDstPathReplaceInterceptor interceptor =
+        new RegexMountPointResolvedDstPathReplaceInterceptor(srcRegex,
+            replaceString);
+    Assert.assertEquals(interceptor.serializeToString(), serializedString);
+  }
+
+  @Test

Review comment:
       I meant to have a safegurad when users want to change the interceptor settings format.
But I'm OK to remove it.




----------------------------------------------------------------
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:
users@infra.apache.org


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

    Worklog Id:     (was: 477551)
    Time Spent: 1h  (was: 50m)

> 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: 1h
>  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-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message