You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2021/02/05 22:18:22 UTC

[GitHub] [hadoop] zehaoc2 commented on a change in pull request #2670: HDFS-15811. completeFile should log final file size.

zehaoc2 commented on a change in pull request #2670:
URL: https://github.com/apache/hadoop/pull/2670#discussion_r571280969



##########
File path: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
##########
@@ -3146,23 +3148,30 @@ INodeFile checkLease(INodesInPath iip, String holder, long fileId)
   boolean completeFile(final String src, String holder,
                        ExtendedBlock last, long fileId)
     throws IOException {
+    final String operationName = CMD_COMPLETE_FILE;
     boolean success = false;
+    FileStatus stat = null;
     checkOperation(OperationCategory.WRITE);
     final FSPermissionChecker pc = getPermissionChecker();
     FSPermissionChecker.setOperationType(null);
     writeLock();
     try {
       checkOperation(OperationCategory.WRITE);
       checkNameNodeSafeMode("Cannot complete file " + src);
-      success = FSDirWriteFileOp.completeFile(this, pc, src, holder, last,
+      INodesInPath iip = dir.resolvePath(pc, src, fileId);
+      success = FSDirWriteFileOp.completeFile(this, iip, src, holder, last,
                                               fileId);
+      if (success) {
+        stat = dir.getAuditFileInfo(iip);
+      }
     } finally {
-      writeUnlock("completeFile");
+      writeUnlock(operationName);

Review comment:
       Sorry. I should change this to "complete" instead of "close". I change this because the audit log cmd names usually mimic the client api names rather than the rpc method name. For instance, rpc method "startFile" is audit logged as cmd "create". 




----------------------------------------------------------------
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:
users@infra.apache.org



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