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

ASF GitHub Bot commented on HDFS-16954:
---------------------------------------

goiri commented on code in PR #5483:
URL: https://github.com/apache/hadoop/pull/5483#discussion_r1139298964


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java:
##########
@@ -641,6 +646,11 @@ public void rename2(final String src, final String dst,
         new Class<?>[] {String.class, String.class, options.getClass()},
         new RemoteParam(), dstParam, options);
     if (isMultiDestDirectory(src)) {
+      if (locs.size() == srcLocations.size()) {
+        throw new IOException(
+            "Rename of " + src + " to " + dst + " is not allowed," +
+                " The remote location should be exactly same.");

Review Comment:
   What's the assumption on why comparing sizes is equal to saying it is the 
same?



##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAllResolver.java:
##########
@@ -205,6 +204,20 @@ private void testAll(final String path) throws Exception {
     assertDirsEverywhere(path, 9);
     assertFilesDistributed(path, 16);
 
+    // Test rename to not multi mount dir
+    routerFs.mkdirs(new Path(path+ "/dir2/dir23"));
+    routerFs.mkdirs(new Path(path+ "/dir2/dir23/dir_1"));
+    routerFs.mkdirs(new Path(path+ "/dir2/dir23/dir_2"));
+    try {

Review Comment:
   LambdaTestUtils#intercept



##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAllResolver.java:
##########
@@ -52,6 +49,8 @@
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.junit.Assert.*;

Review Comment:
   Avoid





> RBF: The operation of renaming a multi-subcluster directory to a 
> single-cluster directory should throw ioexception
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-16954
>                 URL: https://issues.apache.org/jira/browse/HDFS-16954
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: rbf
>    Affects Versions: 3.4.0
>            Reporter: Max  Xie
>            Assignee: Max  Xie
>            Priority: Minor
>              Labels: pull-request-available
>
> The operation of renaming a multi-subcluster directory to a single-cluster 
> directory may cause inconsistent behavior of the file system. This operation 
> should throw exception to be reasonable.
> Examples are as follows:
> 1. add  hash_all mount point   `hdfs dfsrouteradmin -add /tmp/foo 
> subcluster1,subcluster2  /tmp/foo -order HASH_ALL`
> 2. add   mount point   `hdfs dfsrouteradmin -add /user/foo subcluster1 
> /user/foo`
> 3. mkdir dir for all subcluster.  ` hdfs dfs -mkdir /tmp/foo/123 `
> 4. check dir and all subclusters will have dir `/tmp/foo/123`
> `hdfs dfs -ls /tmp/foo/` : will show dir `/tmp/foo/123`;
> `hdfs dfs -ls hdfs://subcluster1/tmp/foo/` : will show dir 
> `hdfs://subcluster1/tmp/foo/123`;
> `hdfs dfs -ls hdfs://subcluster2/tmp/foo/` : will show dir 
> `hdfs://subcluster2/tmp/foo/123`;
> 5. rename `/tmp/foo/123` to `/user/foo/123`. The op will succeed. `hdfs dfs 
> -mv /tmp/foo/123 /user/foo/123 `
> 6. check dir again, rbf cluster still show dir `/tmp/foo/123`
> `hdfs dfs -ls /tmp/foo/` : will show dir `/tmp/foo/123`;
> `hdfs dfs -ls hdfs://subcluster1/tmp/foo/` : will no dirs;
> `hdfs dfs -ls hdfs://subcluster2/tmp/foo/` : will show dir 
> `hdfs://subcluster2/tmp/foo/123`;
> The step 5 should throw exception.
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to