adoroszlai commented on code in PR #10117:
URL: https://github.com/apache/ozone/pull/10117#discussion_r3135522265


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/Archiver.java:
##########
@@ -105,7 +106,20 @@ public static void includePath(Path dir, String subdir,
   public static long includeFile(File file, String entryName,
       ArchiveOutputStream<TarArchiveEntry> archiveOutput) throws IOException {
     final long bytes;
-    TarArchiveEntry entry = archiveOutput.createArchiveEntry(file, entryName);
+
+    TarArchiveEntry entry = new TarArchiveEntry(entryName);
+    entry.setMode(TarArchiveEntry.DEFAULT_FILE_MODE);
+    try {
+      BasicFileAttributes attrs = Files.readAttributes(
+          file.toPath(), BasicFileAttributes.class);
+      entry.setLastModifiedTime(attrs.lastModifiedTime());
+      entry.setLastAccessTime(attrs.lastAccessTime());
+      entry.setCreationTime(attrs.creationTime());
+    } catch (IOException e) {
+      entry.setModTime(file.lastModified()); // fallback
+    }
+    entry.setSize(file.length());

Review Comment:
   This is not the only `createArchiveEntry` call.  I think we should extract a 
helper function to `createBasicTarArchiveEntry`, and reuse it:
   
   
https://github.com/apache/ozone/blob/ee50981b88d3d76bbefdf57a748e52af7a82d579/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/Archiver.java#L88
   
   
https://github.com/apache/ozone/blob/ee50981b88d3d76bbefdf57a748e52af7a82d579/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/Archiver.java#L155



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

To unsubscribe, e-mail: [email protected]

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