You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ad...@apache.org on 2022/04/22 05:43:37 UTC

[ozone] branch master updated: HDDS-6189. Intermittent failure in TestDirectoryDeletingServiceWithFSO (#3328)

This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 4345fb1c58 HDDS-6189. Intermittent failure in TestDirectoryDeletingServiceWithFSO (#3328)
4345fb1c58 is described below

commit 4345fb1c58c71e443832e2047be61eb17e607aa9
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Fri Apr 22 07:43:31 2022 +0200

    HDDS-6189. Intermittent failure in TestDirectoryDeletingServiceWithFSO (#3328)
---
 .../ozone/TestDirectoryDeletingServiceWithFSO.java | 40 +++++++++++-----------
 .../hadoop/fs/ozone/TestRootedDDSWithFSO.java      | 10 ++----
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestDirectoryDeletingServiceWithFSO.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestDirectoryDeletingServiceWithFSO.java
index 8bf3856de8..14a73e3b9c 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestDirectoryDeletingServiceWithFSO.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestDirectoryDeletingServiceWithFSO.java
@@ -39,7 +39,6 @@ import org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo;
 import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
 import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
 import org.apache.ozone.test.GenericTestUtils;
-import org.apache.ozone.test.tag.Flaky;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.Assert;
@@ -53,6 +52,7 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import java.util.function.LongSupplier;
 
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ACL_ENABLED;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_BLOCK_DELETING_SERVICE_INTERVAL;
@@ -135,7 +135,6 @@ public class TestDirectoryDeletingServiceWithFSO {
     }
   }
 
-  @Flaky("HDDS-6189")
   @Test
   public void testDeleteEmptyDirectory() throws Exception {
     Path root = new Path("/rootDir");
@@ -155,8 +154,8 @@ public class TestDirectoryDeletingServiceWithFSO {
     assertTableRowCount(deletedDirTable, 0);
     assertTableRowCount(dirTable, 2);
 
-    assertSubPathsCount(dirDeletingService.getDeletedDirsCount(), 0);
-    assertSubPathsCount(dirDeletingService.getMovedFilesCount(), 0);
+    assertSubPathsCount(dirDeletingService::getDeletedDirsCount, 0);
+    assertSubPathsCount(dirDeletingService::getMovedFilesCount, 0);
 
     // Delete the appRoot, empty dir
     fs.delete(appRoot, true);
@@ -167,8 +166,8 @@ public class TestDirectoryDeletingServiceWithFSO {
     assertTableRowCount(deletedDirTable, 0);
     assertTableRowCount(dirTable, 1);
 
-    assertSubPathsCount(dirDeletingService.getDeletedDirsCount(), 1);
-    assertSubPathsCount(dirDeletingService.getMovedFilesCount(), 0);
+    assertSubPathsCount(dirDeletingService::getDeletedDirsCount, 1);
+    assertSubPathsCount(dirDeletingService::getMovedFilesCount, 0);
 
     Assert.assertTrue(dirTable.iterator().hasNext());
     Assert.assertEquals(root.getName(),
@@ -219,8 +218,8 @@ public class TestDirectoryDeletingServiceWithFSO {
     assertTableRowCount(keyTable, 15);
     assertTableRowCount(dirTable, 20);
 
-    assertSubPathsCount(dirDeletingService.getMovedFilesCount(), 0);
-    assertSubPathsCount(dirDeletingService.getDeletedDirsCount(), 0);
+    assertSubPathsCount(dirDeletingService::getMovedFilesCount, 0);
+    assertSubPathsCount(dirDeletingService::getDeletedDirsCount, 0);
 
     // Delete the appRoot
     fs.delete(appRoot, true);
@@ -232,8 +231,8 @@ public class TestDirectoryDeletingServiceWithFSO {
     assertTableRowCount(keyTable, 0);
     assertTableRowCount(dirTable, 1);
 
-    assertSubPathsCount(dirDeletingService.getMovedFilesCount(), 15);
-    assertSubPathsCount(dirDeletingService.getDeletedDirsCount(), 19);
+    assertSubPathsCount(dirDeletingService::getMovedFilesCount, 15);
+    assertSubPathsCount(dirDeletingService::getDeletedDirsCount, 19);
 
     Assert.assertTrue(dirDeletingService.getRunCount() > 1);
   }
@@ -266,8 +265,8 @@ public class TestDirectoryDeletingServiceWithFSO {
     assertTableRowCount(dirTable, 5);
     assertTableRowCount(keyTable, 3);
 
-    assertSubPathsCount(dirDeletingService.getMovedFilesCount(), 0);
-    assertSubPathsCount(dirDeletingService.getDeletedDirsCount(), 0);
+    assertSubPathsCount(dirDeletingService::getMovedFilesCount, 0);
+    assertSubPathsCount(dirDeletingService::getDeletedDirsCount, 0);
 
     // Delete the rootDir, which should delete all keys.
     fs.delete(root, true);
@@ -279,15 +278,16 @@ public class TestDirectoryDeletingServiceWithFSO {
     assertTableRowCount(keyTable, 0);
     assertTableRowCount(dirTable, 0);
 
-    assertSubPathsCount(dirDeletingService.getMovedFilesCount(), 3);
-    assertSubPathsCount(dirDeletingService.getDeletedDirsCount(), 5);
+    assertSubPathsCount(dirDeletingService::getMovedFilesCount, 3);
+    assertSubPathsCount(dirDeletingService::getDeletedDirsCount, 5);
 
     Assert.assertTrue(dirDeletingService.getRunCount() > 1);
   }
 
-  private void assertSubPathsCount(long pathCount, long expectedCount)
+  static void assertSubPathsCount(LongSupplier pathCount, long expectedCount)
       throws TimeoutException, InterruptedException {
-    GenericTestUtils.waitFor(() -> pathCount >= expectedCount, 1000, 120000);
+    GenericTestUtils.waitFor(() -> pathCount.getAsLong() >= expectedCount,
+        1000, 120000);
   }
 
   private void assertTableRowCount(Table<String, ?> table, int count)
@@ -374,8 +374,8 @@ public class TestDirectoryDeletingServiceWithFSO {
     assertTableRowCount(deletedDirTable, 0);
     assertTableRowCount(deletedKeyTable, 0);
 
-    assertSubPathsCount(dirDeletingService.getMovedFilesCount(), 0);
-    assertSubPathsCount(dirDeletingService.getDeletedDirsCount(), 0);
+    assertSubPathsCount(dirDeletingService::getMovedFilesCount, 0);
+    assertSubPathsCount(dirDeletingService::getDeletedDirsCount, 0);
     // verify whether KeyDeletingService has purged the keys
     long currentDeletedKeyCount = keyDeletingService.getDeletedKeyCount().get();
     Assert.assertEquals(prevDeletedKeyCount + 3, currentDeletedKeyCount);
@@ -392,8 +392,8 @@ public class TestDirectoryDeletingServiceWithFSO {
     assertTableRowCount(deletedDirTable, 0);
     assertTableRowCount(deletedKeyTable, 0);
 
-    assertSubPathsCount(dirDeletingService.getMovedFilesCount(), 2);
-    assertSubPathsCount(dirDeletingService.getDeletedDirsCount(), 1);
+    assertSubPathsCount(dirDeletingService::getMovedFilesCount, 2);
+    assertSubPathsCount(dirDeletingService::getDeletedDirsCount, 1);
     // verify whether KeyDeletingService has purged the keys
     currentDeletedKeyCount = keyDeletingService.getDeletedKeyCount().get();
     Assert.assertEquals(prevDeletedKeyCount + 5, currentDeletedKeyCount);
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedDDSWithFSO.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedDDSWithFSO.java
index 5a7d4c610d..952402e2c2 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedDDSWithFSO.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedDDSWithFSO.java
@@ -51,6 +51,7 @@ import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
+import static org.apache.hadoop.fs.ozone.TestDirectoryDeletingServiceWithFSO.assertSubPathsCount;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ACL_ENABLED;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_BLOCK_DELETING_SERVICE_INTERVAL;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_ITERATE_BATCH_SIZE;
@@ -198,17 +199,12 @@ public class TestRootedDDSWithFSO {
     // There is an immediate file under bucket,
     // which was moved along with bucket delete.
     int movedFilesCount = totalFilesCount - 1;
-    assertSubPathsCount(dirDeletingService.getMovedFilesCount(),
+    assertSubPathsCount(dirDeletingService::getMovedFilesCount,
         movedFilesCount);
-    assertSubPathsCount(dirDeletingService.getDeletedDirsCount(),
+    assertSubPathsCount(dirDeletingService::getDeletedDirsCount,
         totalDirCount);
   }
 
-  private void assertSubPathsCount(long pathCount, long expectedCount)
-      throws TimeoutException, InterruptedException {
-    GenericTestUtils.waitFor(() -> pathCount >= expectedCount, 1000, 120000);
-  }
-
   private void checkPath(Path path) {
     try {
       fs.getFileStatus(path);


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