hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ewan Higgs (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-15209) DistCp to eliminate needless deletion of files under already-deleted directories
Date Thu, 15 Mar 2018 10:06:00 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-15209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16400153#comment-16400153

Ewan Higgs commented on HADOOP-15209:


+ * We do not rely on parent entries being added immediately before children,
+ * as sorting may place "/dir12" between "/dir1" and its descendants.
+ *{code}
AFAICT, SequenceFile.Sorter will put these in the correct order (for alphanumerics... if you
have (, ), #, - etc in your filename it probably gets wonky). This means you can do the following:
boolean shouldDelete(CopyListingFileStatus status) {
  final Path path = status.getPath();
  Preconditions.checkArgument(!path.isRoot(), "Root Dir");
  final String pathStr = path.toString();
  final String pathAsDir = pathStr + Path.SEPARATOR;

  if (lastDir == null) {
    if (status.isDirectory()) {
      lastDir = pathAsDir;
    return true;

  if (pathStr.startsWith(lastDir)
      || pathAsDir.equals(lastDir)) {
    return false;
  } else {
    if (status.isDirectory()) {
      lastDir = pathAsDir;
    return true;
This means you no longer need a cache. If you'd like I can attach a patch with the update
that passes all the unit tests.

> DistCp to eliminate needless deletion of files under already-deleted directories
> --------------------------------------------------------------------------------
>                 Key: HADOOP-15209
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15209
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: tools/distcp
>    Affects Versions: 2.9.0
>            Reporter: Steve Loughran
>            Assignee: Steve Loughran
>            Priority: Major
>         Attachments: HADOOP-15209-001.patch, HADOOP-15209-002.patch, HADOOP-15209-003.patch,
HADOOP-15209-004.patch, HADOOP-15209-005.patch, HADOOP-15209-006.patch, HADOOP-15209-007.patch
> DistCP issues a delete(file) request even if is underneath an already deleted directory.
This generates needless load on filesystems/object stores, and, if the store throttles delete,
can dramatically slow down the delete operation.
> If the distcp delete operation can build a history of deleted directories, then it will
know when it does not need to issue those deletes.
> Care is needed here to make sure that whatever structure is created does not overload
the heap of the process.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org

View raw message