[
https://issues.apache.org/jira/browse/HDFS-17134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17748933#comment-17748933
]
ASF GitHub Bot commented on HDFS-17134:
---------------------------------------
Hexiaoqiao commented on code in PR #5900:
URL: https://github.com/apache/hadoop/pull/5900#discussion_r1278571071
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java:
##########
@@ -819,20 +821,34 @@ public void renewLease(String clientName, List<String>
namespaces)
}
}
+ /**
+ * For {@link this#getListing(String,byte[],boolean)} to sort results.
Review Comment:
This java doc are not compliant with rules. try to as the following style.
`For {@link #getListing(String,byte[],boolean) GetLisiting} to sort results.`
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java:
##########
@@ -819,20 +821,34 @@ public void renewLease(String clientName, List<String>
namespaces)
}
}
+ /**
+ * For {@link this#getListing(String,byte[],boolean)} to sort results.
+ */
+ private static class GetListingComparator
+ implements Comparator<byte[]>, Serializable {
+ @Override
+ public int compare(byte[] o1, byte[] o2) {
+ return DFSUtilClient.compareBytes(o1, o2);
+ }
+ }
+
+ private static final GetListingComparator comparator =
Review Comment:
Don't need `final` modifier.
> RBF: Fix duplicate results of getListing through Router.
> --------------------------------------------------------
>
> Key: HDFS-17134
> URL: https://issues.apache.org/jira/browse/HDFS-17134
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Shuyan Zhang
> Assignee: Shuyan Zhang
> Priority: Major
> Labels: pull-request-available
>
> The result of `getListing` in NameNode are sorted based on `byte[]`, while
> the Router side is based on `String`. If there are special characters in
> path, the sorting result of the router will be inconsistent with the
> namenode. This may result in duplicate `getListing` results obtained by the
> client due to wrong `startAfter` parameter.
> For exemple, namenode returns [path1, path2, path3] for a `getListing`
> request, while router returns [path1, path3, path2] to client. Then client
> will pass `path2` as `startAfter` at the next iteration, so it will receive
> `path3` again.
> We need to fix the Router code so that the order of its result is the same as
> NameNode.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]