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/02 06:22:42 UTC

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

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



##########
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:
       why change this?

##########
File path: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
##########
@@ -8667,6 +8676,9 @@ public void logAuditEvent(boolean succeeded, String userName,
         }
         sb.append("\t").append("proto=")
             .append(Server.getProtocol());
+        if (cmd.equals(CMD_COMPLETE_FILE) && status != null) {
+          sb.append("\t").append("fileSize=").append(status.getLen());

Review comment:
       we shouldn't only add a new field for this particular command, as it will probably break lots of applications parsing audit log. See https://issues.apache.org/jira/browse/HDFS-9184 for some more context. 




----------------------------------------------------------------
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