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

keith-turner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 5d8ad07d39 fixes CloneTestIT (#6666)
5d8ad07d39 is described below

commit 5d8ad07d3905d03722a753d9cbe33812d52ef86e
Author: Keith Turner <[email protected]>
AuthorDate: Mon Nov 23 15:54:12 2026 -0500

    fixes CloneTestIT (#6666)
    
    After changes to make GC always delete files of a deleted table, a test
    was failing because it expected delete table to immediately delete files.
    Modified the test to look for an eventual deletion of the table dir.
    Also added some more checks of table dir deletion by GC to the test.
---
 .../test/functional/CloneTestIT_SimpleSuite.java   | 33 ++++++++++++++++------
 .../apache/accumulo/test/functional/TableIT.java   | 11 +++-----
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git 
a/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT_SimpleSuite.java
 
b/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT_SimpleSuite.java
index ab70614f41..07e7911a13 100644
--- 
a/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT_SimpleSuite.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT_SimpleSuite.java
@@ -70,6 +70,7 @@ import org.apache.accumulo.core.security.NamespacePermission;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl;
 import org.apache.accumulo.test.harness.SharedMiniClusterBase;
+import org.apache.accumulo.test.util.Wait;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -253,12 +254,12 @@ public class CloneTestIT_SimpleSuite extends 
SharedMiniClusterBase {
       c.tableOperations().flush(table3, null, null, true);
       // check for files
       FileSystem fs = getCluster().getFileSystem();
-      final String id = c.tableOperations().tableIdMap().get(table3);
+      final String id3 = c.tableOperations().tableIdMap().get(table3);
 
       // the following path expects mini to be configured with a single volume
-      final Path tablePath = new 
Path(mac.getSiteConfiguration().get(Property.INSTANCE_VOLUMES)
-          + "/" + Constants.TABLE_DIR + "/" + id);
-      FileStatus[] status = fs.listStatus(tablePath);
+      final Path table3Path = new 
Path(mac.getSiteConfiguration().get(Property.INSTANCE_VOLUMES)
+          + "/" + Constants.TABLE_DIR + "/" + id3);
+      FileStatus[] status = fs.listStatus(table3Path);
       assertTrue(status.length > 0);
       // verify disk usage
       List<DiskUsage> diskUsage = 
c.tableOperations().getDiskUsage(Collections.singleton(table3));
@@ -266,15 +267,21 @@ public class CloneTestIT_SimpleSuite extends 
SharedMiniClusterBase {
       assertTrue(diskUsage.get(0).getUsage() > 100);
       // delete the table
       c.tableOperations().delete(table3);
-      // verify its gone from the file system
-      if (fs.exists(tablePath)) {
-        status = fs.listStatus(tablePath);
-        assertTrue(status == null || status.length == 0);
-      }
+      // wait for GC to delete the table dir
+      Wait.waitFor(() -> !fs.exists(table3Path));
 
       c.tableOperations().create(table1);
 
       writeDataAndClone(c, table1, table2);
+      final String id1 = c.tableOperations().tableIdMap().get(table1);
+      final String id2 = c.tableOperations().tableIdMap().get(table2);
+      final Path table1Path = new 
Path(mac.getSiteConfiguration().get(Property.INSTANCE_VOLUMES)
+          + "/" + Constants.TABLE_DIR + "/" + id1);
+      final Path table2Path = new 
Path(mac.getSiteConfiguration().get(Property.INSTANCE_VOLUMES)
+          + "/" + Constants.TABLE_DIR + "/" + id2);
+      assertTrue(fs.exists(table1Path));
+      // clone will not create its table dir until its needed
+      assertFalse(fs.exists(table2Path));
 
       // delete source table, should not affect clone
       c.tableOperations().delete(table1);
@@ -282,10 +289,18 @@ public class CloneTestIT_SimpleSuite extends 
SharedMiniClusterBase {
       checkData(table2, c);
 
       c.tableOperations().compact(table2, null, null, true, true);
+      // now that table2 no longer references table1 file, GC should delete 
table 1 dir in
+      // filesystem
+      Wait.waitFor(() -> !fs.exists(table1Path));
+      // compaction should have created clones table dir
+      assertTrue(fs.exists(table2Path));
 
       checkData(table2, c);
 
       c.tableOperations().delete(table2);
+
+      // GC should delete table2 dir in filesystem eventually
+      Wait.waitFor(() -> !fs.exists(table2Path));
     }
   }
 
diff --git 
a/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java 
b/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java
index a21d4fcf0a..614a7af66d 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java
@@ -19,12 +19,10 @@
 package org.apache.accumulo.test.functional;
 
 import static 
org.apache.accumulo.test.harness.AccumuloITBase.MINI_CLUSTER_ONLY;
-import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
-import java.io.FileNotFoundException;
 import java.time.Duration;
 
 import org.apache.accumulo.cluster.AccumuloCluster;
@@ -44,6 +42,7 @@ import org.apache.accumulo.test.TestIngest;
 import org.apache.accumulo.test.VerifyIngest;
 import org.apache.accumulo.test.VerifyIngest.VerifyParams;
 import org.apache.accumulo.test.harness.AccumuloClusterHarness;
+import org.apache.accumulo.test.util.Wait;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.junit.jupiter.api.Tag;
@@ -87,11 +86,9 @@ public class TableIT extends AccumuloClusterHarness {
         to.delete(tableName);
         assertTrue(s.stream().findAny().isEmpty());
 
-        try {
-          assertEquals(0, fs.listStatus(tablePath).length);
-        } catch (FileNotFoundException ex) {
-          // that's fine, too
-        }
+        // GC should eventually delete table dir
+        Wait.waitFor(() -> !fs.exists(tablePath));
+
         assertNull(to.tableIdMap().get(tableName));
         to.create(tableName);
         TestIngest.ingest(c, params);

Reply via email to