sunchao commented on a change in pull request #1725: HDFS-13616. Batch listing
of multiple directories
URL: https://github.com/apache/hadoop/pull/1725#discussion_r352907307
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
##########
@@ -3923,6 +3944,148 @@ DirectoryListing getListing(String src, byte[]
startAfter,
return dl;
}
+ public byte[] getSrcPathsHash(String[] srcs) {
+ MessageDigest md;
+ try {
+ md = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ throw new RuntimeException(e);
+ }
+
+ for (String src: srcs) {
+ md.update(src.getBytes(Charsets.UTF_8));
+ }
+ return md.digest();
+ }
+
+ BatchedDirectoryListing getBatchedListing(String[] srcs, byte[] startAfter,
Review comment:
I found a little hard to refactoring this given that several variables are
used throughout the method, such as `lastListing`. Would it be helpful if we
add more comments in the method body, explaining what each section is doing?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]