jojochuang commented on a change in pull request #2732:
URL: https://github.com/apache/hadoop/pull/2732#discussion_r589370003
##########
File path:
hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/SimpleCopyListing.java
##########
@@ -688,6 +696,71 @@ private void traverseDirectory(SequenceFile.Writer
fileListWriter,
workers.shutdown();
}
+ private void traverseDirectoryLegacy(SequenceFile.Writer fileListWriter,
+ FileSystem sourceFS, ArrayList<FileStatus> sourceDirs,
+ Path sourcePathRoot, DistCpContext context, HashSet<String> excludeList,
+ List<FileStatusInfo> fileStatuses) throws IOException {
+ final boolean preserveAcls = context.shouldPreserve(FileAttribute.ACL);
+ final boolean preserveXAttrs = context.shouldPreserve(FileAttribute.XATTR);
+ final boolean preserveRawXattrs = context.shouldPreserveRawXattrs();
+
+ Stack<FileStatus> pathStack = new Stack<FileStatus>();
+ for (FileStatus fs : sourceDirs) {
+ if (excludeList == null || !excludeList
+ .contains(fs.getPath().toUri().getPath())) {
+ pathStack.add(fs);
+ }
+ }
+
+ while (!pathStack.isEmpty()) {
+ prepareListing(pathStack.pop().getPath(), fileListWriter, sourceFS,
+ sourcePathRoot, context, excludeList, fileStatuses, preserveAcls,
+ preserveXAttrs, preserveRawXattrs);
+ }
+ }
+
+ @SuppressWarnings("checkstyle:parameternumber")
+ private void prepareListing(Path path, SequenceFile.Writer fileListWriter,
Review comment:
Sorry for coming back late.
Can we refactor this method a bit to use fewer parameters?
##########
File path: hadoop-tools/hadoop-distcp/src/site/markdown/DistCp.md.vm
##########
@@ -362,6 +362,7 @@ Command Line Options
| `-copybuffersize <copybuffersize>` | Size of the copy buffer to use. By
default, `<copybuffersize>` is set to 8192B | |
| `-xtrack <path>` | Save information about missing source files to the
specified path. | This option is only valid with `-update` option. This is an
experimental property and it cannot be used with `-atomic` option. |
| `-direct` | Write directly to destination paths | Useful for avoiding
potentially very expensive temporary file rename operations when the
destination is an object store |
+| `-useIterator` | Uses single threaded listStatusIterator to build listing |
Useful for saving memory at the client side. |
Review comment:
I was think we shouuld update the doc to mention it will disable
-numListstatusThreads. But if we can merge that WIP patch soon then it's fine.
##########
File path:
hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/SimpleCopyListing.java
##########
@@ -688,6 +696,71 @@ private void traverseDirectory(SequenceFile.Writer
fileListWriter,
workers.shutdown();
}
+ private void traverseDirectoryLegacy(SequenceFile.Writer fileListWriter,
+ FileSystem sourceFS, ArrayList<FileStatus> sourceDirs,
+ Path sourcePathRoot, DistCpContext context, HashSet<String> excludeList,
+ List<FileStatusInfo> fileStatuses) throws IOException {
+ final boolean preserveAcls = context.shouldPreserve(FileAttribute.ACL);
+ final boolean preserveXAttrs = context.shouldPreserve(FileAttribute.XATTR);
+ final boolean preserveRawXattrs = context.shouldPreserveRawXattrs();
+
+ Stack<FileStatus> pathStack = new Stack<FileStatus>();
+ for (FileStatus fs : sourceDirs) {
+ if (excludeList == null || !excludeList
+ .contains(fs.getPath().toUri().getPath())) {
+ pathStack.add(fs);
+ }
+ }
+
+ while (!pathStack.isEmpty()) {
+ prepareListing(pathStack.pop().getPath(), fileListWriter, sourceFS,
+ sourcePathRoot, context, excludeList, fileStatuses, preserveAcls,
+ preserveXAttrs, preserveRawXattrs);
+ }
+ }
+
+ @SuppressWarnings("checkstyle:parameternumber")
+ private void prepareListing(Path path, SequenceFile.Writer fileListWriter,
Review comment:
maybe we should refactor traverseDirectory() into a class since we pass
over the parameters here and there.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]