You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/02/26 19:16:30 UTC

[GitHub] [hadoop-ozone] smengcl commented on a change in pull request #584: HDDS-3054. OzoneFileStatus#getModificationTime should return actual directory modification time when its OmKeyInfo is available

smengcl commented on a change in pull request #584: HDDS-3054. OzoneFileStatus#getModificationTime should return actual directory modification time when its OmKeyInfo is available
URL: https://github.com/apache/hadoop-ozone/pull/584#discussion_r384706707
 
 

 ##########
 File path: hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystem.java
 ##########
 @@ -354,4 +356,45 @@ private OzoneKeyDetails getKey(Path keyPath, boolean isDirectory)
   private void assertKeyNotFoundException(IOException ex) {
     GenericTestUtils.assertExceptionContains("KEY_NOT_FOUND", ex);
   }
+
+  private void testGetDirectoryModificationTime() throws IOException {
+    Path mdir1 = new Path("/mdir1");
+    Path mdir11 = new Path(mdir1, "mdir11");
+    Path mdir111 = new Path(mdir11, "mdir111");
+    fs.mkdirs(mdir111);
+    rootItemCount++; // mdir1
+
+    // Case 1: Dir key exist on server
+    FileStatus[] fileStatuses = o3fs.listStatus(mdir11);
+    // Above listStatus result should only have one entry: mdir111
+    assertEquals(1, fileStatuses.length);
+    assertEquals(mdir111.toString(),
+        fileStatuses[0].getPath().toUri().getPath());
+    assertTrue(fileStatuses[0].isDirectory());
+    // The dir key is actually created on server,
+    // so modification time should always be the same value.
+    long modificationTime = fileStatuses[0].getModificationTime();
+    // Check modification time in a small loop, it should always be the same
+    for (int i = 0; i < 5; i++) {
+      fileStatuses = o3fs.listStatus(mdir11);
+      assertEquals(modificationTime, fileStatuses[0].getModificationTime());
 
 Review comment:
   Hi @hanishakoneru , I think sleep is unnecessary since it always have ~4 ms difference between each check. Sleep would just slow down the whole test.

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


With regards,
Apache Git Services

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