Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-3107 HDFS truncate
  3. HDFS-7638

Small fix and few refinements for FSN#truncate

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.7.0
    • datanode, namenode
    • None
    • Reviewed

    Description

      1.

      removeBlocks(collectedBlocks);
      

      should be after logSync, as we do in other FSN places (rename, delete, write with overwrite), the reason is discussed in HDFS-2815 and https://issues.apache.org/jira/browse/HDFS-6871?focusedCommentId=14110068&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14110068

      2.

      stat = FSDirStatAndListingOp.getFileInfo(dir, src, false,
          FSDirectory.isReservedRawName(src), true);
      

      We'd better to use dir.getAuditFileInfo, since it's only for audit log. If audit log is not on, we don't need to get the file info.

      3.
      In truncateInternal,

      INodeFile file = iip.getLastINode().asFile();
      

      is not necessary.

      Attachments

        1. HDFS-7638.001.patch
          3 kB
          Yi Liu

        Activity

          People

            hitliuyi Yi Liu
            hitliuyi Yi Liu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: