virajjasani commented on a change in pull request #2892:
URL: https://github.com/apache/hadoop/pull/2892#discussion_r611354463



##########
File path: 
hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyCommitter.java
##########
@@ -635,7 +635,10 @@ private void concatFileChunks(Configuration conf, Path 
sourceFile,
         ++i;
       }
     }
+    long firstChunkLastModifiedTs = dstfs.getFileStatus(firstChunkFile)
+        .getModificationTime();
     dstfs.concat(firstChunkFile, restChunkFiles);
+    dstfs.setTimes(firstChunkFile, firstChunkLastModifiedTs, -1);

Review comment:
       Sure @jojochuang , I can update mtime after rename(). However, for the 
better understanding, when I looked into it, it seems that mtime is updated for 
parent dirs rather than file itself.
   For instance, renameTo updates mtime 
[here](https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java#L222)
 and it internally updates mtime of srcParent and dstParent 
[here](https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java#L747-L750)
   Does this seem correct (unless I am missing something)? I also manually 
verified that mtime is not updated for the file after it's rename(), however, 
if we want to update mtime after rename() for safety purpose, that should be 
good I believe.
   
   Thanks




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

Reply via email to