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 6417b1435a documents GC candidate removal process (#6663)
6417b1435a is described below

commit 6417b1435aa7abc7ffd3edd0933edcf2c8ba67e6
Author: Keith Turner <[email protected]>
AuthorDate: Mon Nov 23 15:53:33 2026 -0500

    documents GC candidate removal process (#6663)
    
    Writing the documentation led to some improvements in the code.
---
 .../server/init/FileSystemInitializer.java         |   2 +-
 .../java/org/apache/accumulo/gc/GcCandidates.java  |  86 ++++++++-
 .../apache/accumulo/gc/GarbageCollectionTest.java  | 192 ++++++++++-----------
 3 files changed, 180 insertions(+), 100 deletions(-)

diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/init/FileSystemInitializer.java
 
b/server/base/src/main/java/org/apache/accumulo/server/init/FileSystemInitializer.java
index a0ac9726a2..18886e6c1f 100644
--- 
a/server/base/src/main/java/org/apache/accumulo/server/init/FileSystemInitializer.java
+++ 
b/server/base/src/main/java/org/apache/accumulo/server/init/FileSystemInitializer.java
@@ -64,7 +64,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class FileSystemInitializer {
-  private static final String TABLE_TABLETS_TABLET_DIR = "table_info";
+  public static final String TABLE_TABLETS_TABLET_DIR = "table_info";
   private static final Logger log = 
LoggerFactory.getLogger(FileSystemInitializer.class);
   private static final Text SPLIT_POINT =
       MetadataSchema.TabletsSection.getRange().getEndKey().getRow();
diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/GcCandidates.java 
b/server/gc/src/main/java/org/apache/accumulo/gc/GcCandidates.java
index a6e8bc2618..0e21b234cb 100644
--- a/server/gc/src/main/java/org/apache/accumulo/gc/GcCandidates.java
+++ b/server/gc/src/main/java/org/apache/accumulo/gc/GcCandidates.java
@@ -18,6 +18,13 @@
  */
 package org.apache.accumulo.gc;
 
+import static org.apache.accumulo.core.Constants.BULK_PREFIX;
+import static org.apache.accumulo.core.Constants.CLONE_PREFIX;
+import static 
org.apache.accumulo.core.Constants.GENERATED_TABLET_DIRECTORY_PREFIX;
+import static org.apache.accumulo.core.metadata.RootTable.ROOT_TABLET_DIR_NAME;
+import static 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ServerColumnFamily.DEFAULT_TABLET_DIR_NAME;
+import static 
org.apache.accumulo.server.init.FileSystemInitializer.TABLE_TABLETS_TABLET_DIR;
+
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.file.Path;
@@ -33,10 +40,61 @@ import org.apache.accumulo.core.gc.Reference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterators;
 
 /**
  * Code that supports efficient removal of references from a set of gc 
candidates.
+ *
+ * <p>
+ * Internally this class uses relative paths to match references with 
candidates. This is done for
+ * two reasons. First, it makes the normalization code easier to examine and 
verify. Normalization
+ * is critical to matching, if done incorrectly it could lead to mismatches 
that cause referenced
+ * files to be deleted. The second reason relative paths are used is to avoid 
problems with volume
+ * replacements. If absolute paths were used, then more complex normalization 
and volume
+ * replacements would need to be considered. Considering both of these 
increases the surface area
+ * for mismatch bugs that could lead to deleting referenced files.
+ *
+ * <p>
+ * Using relative paths is done with the following assumptions.
+ * <ul>
+ * <li>File names generated by accumulo are globally unique. If users are 
allowed to generate file
+ * names for bulk import, then this may not be true.</li>
+ * <li>Tablet directory names generated by accumulo are globally unique, 
except for the default
+ * tablet in each table. If users are allowed to generate file names for bulk 
import, then accumulo
+ * will enforce globally unique directory names in the bulk import fate 
operation.</li>
+ * <li>All file paths generated by Accumulo will include a table id. If users 
are allowed to
+ * generate file names for bulk import, then those paths would not include a 
table id.</li>
+ * <li>Tablet directories either have a {@code t-} prefix or are named {@code 
default_tablet}</li>
+ * <li>Bulk directories will have a {@code b-} prefix. If users are allowed to 
generate file names
+ * for bulk import, it would be best for this code enforce another prefix like 
{@code be-}</li>
+ * </ul>
+ *
+ * <p>
+ * Putting the above assumptions together leads to the conclusion that the 
last two parts of a file
+ * path are globally unique. For the case of a tables default tablet, its 
directory name is not
+ * unique but all the files in the directory are. For the case of a user named 
bulk import path, its
+ * file names may not be unique but its directory is. So for file matching 
only the last two path
+ * elements are needed.
+ *
+ * <p>
+ * When matching tablet directory deletion candidates, this code uses relative 
paths of the form
+ * {@code /<table id>/<tablet dir>}. The table id is included to account for 
the default tablet
+ * directory name not being unique across tables. When the table id is added, 
it makes the relative
+ * path globally unique. Files in tablet directories are only created by 
Accumulo, so do not need to
+ * consider matching user generated bulk paths.
+ *
+ * <p>
+ * When matching bulk directories, it is assumed that bulk directory names are 
globally unique. User
+ * created bulk paths may not have table id. Therefore, only the bulk 
directory name is used for
+ * matching bulk directory candidates.
+ *
+ * <p>
+ * When matching table deletion candidates, bulk and tablet directories are 
considered. User
+ * generated bulk paths are not expected to have a table id, but if they did 
this could cause a
+ * match that prevents deleting an empty table directory. As simple solution 
to this would be to
+ * give user generated bulk directories a different prefix like {@code be-}, 
then those need not be
+ * considered for matching.
  */
 public class GcCandidates extends AbstractCollection<GcCandidate> {
 
@@ -102,10 +160,14 @@ public class GcCandidates extends 
AbstractCollection<GcCandidate> {
           }
           case TABLET_DIR -> {
             var lastThree = lastThree(candidate.getPath(), false, 2, 2);
+            Preconditions.checkArgument(isTabletDir(lastThree.name), "Not a 
tablet dir %s",
+                lastThree.name);
             tabletDirCandidates.put("/" + lastThree.dir + "/" + 
lastThree.name, candidate);
           }
           case BULK_DIR -> {
             var lastThree = lastThree(candidate.getPath(), 1);
+            Preconditions.checkArgument(isBulkDir(lastThree.name), "Not a bulk 
dir %s",
+                lastThree.name);
             bulkDirCandidates.put(lastThree.name, candidate);
           }
           case TABLE_DIR -> {
@@ -114,7 +176,7 @@ public class GcCandidates extends 
AbstractCollection<GcCandidate> {
           }
         }
       } catch (IllegalArgumentException e) {
-        log.warn("Ignoring invalid deletion candidate {}", candidate);
+        log.warn("Ignoring invalid deletion candidate {} {}", candidate, 
e.getMessage());
       }
     });
   }
@@ -147,6 +209,16 @@ public class GcCandidates extends 
AbstractCollection<GcCandidate> {
     return removeCount;
   }
 
+  private static boolean isBulkDir(String dirName) {
+    return dirName.startsWith(BULK_PREFIX);
+  }
+
+  private static boolean isTabletDir(String dirName) {
+    return dirName.startsWith(GENERATED_TABLET_DIRECTORY_PREFIX) || 
dirName.startsWith(CLONE_PREFIX)
+        || dirName.equals(DEFAULT_TABLET_DIR_NAME) || 
dirName.equals(ROOT_TABLET_DIR_NAME)
+        || dirName.equals(TABLE_TABLETS_TABLET_DIR);
+  }
+
   public void remove(Reference reference, Consumer<GcCandidate> 
removedConsumer) {
 
     Consumer<GcCandidate> nonNullConsumer = gcc -> {
@@ -162,12 +234,20 @@ public class GcCandidates extends 
AbstractCollection<GcCandidate> {
       
nonNullConsumer.accept(tableDirCandidates.remove(reference.getTableId().toString()));
     } else {
       var lastThree = lastThree(reference.getMetadataPath(), 2);
-      if (lastThree.maybeATableId != null) {
+      if (isTabletDir(lastThree.dir)) {
+        Preconditions.checkArgument(lastThree.maybeATableId != null,
+            "Path with tablet dir had no table id : %s", 
reference.getMetadataPath());
         nonNullConsumer.accept(
             tabletDirCandidates.remove("/" + lastThree.maybeATableId + "/" + 
lastThree.dir));
+      } else if (isBulkDir(lastThree.dir)) {
+        nonNullConsumer.accept(bulkDirCandidates.remove(lastThree.dir));
+      } else {
+        throw new IllegalArgumentException(
+            "Unknown directory type in path: " + reference.getMetadataPath());
+      }
+      if (lastThree.maybeATableId != null) {
         
nonNullConsumer.accept(tableDirCandidates.remove(lastThree.maybeATableId));
       }
-      nonNullConsumer.accept(bulkDirCandidates.remove(lastThree.dir));
       nonNullConsumer.accept(fileCandidates.remove("/" + lastThree.dir + "/" + 
lastThree.name));
     }
   }
diff --git 
a/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java 
b/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java
index dcf22beced..ae9da070ab 100644
--- a/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java
+++ b/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java
@@ -243,16 +243,16 @@ public class GarbageCollectionTest {
   public void minimalDelete() throws Exception {
     TestGCE gce = new TestGCE();
 
-    var candOne = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/4/t0/F000.rf");
-    var candTwo = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F001.rf");
-    var candThree = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/5/t0/F005.rf");
-    var candFour = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/6/t0/F006.rf");
+    var candOne = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/4/t-0/F000.rf");
+    var candTwo = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F001.rf");
+    var candThree = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/5/t-0/F005.rf");
+    var candFour = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/6/t-0/F006.rf");
 
     gce.addFileReference("4", null, candOne.getPath());
     gce.addFileReference("4", null, candTwo.getPath());
     gce.addFileReference("6", null, candFour.getPath());
-    gce.addDirReference("4", null, "t0");
-    gce.addDirReference("6", null, "t1");
+    gce.addDirReference("4", null, "t-0");
+    gce.addDirReference("6", null, "t-1");
 
     GarbageCollectionAlgorithm gca = new GarbageCollectionAlgorithm();
     gca.collect(gce);
@@ -265,15 +265,15 @@ public class GarbageCollectionTest {
   public void testBasic() throws Exception {
     TestGCE gce = new TestGCE();
 
-    var candOne = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/4/t0/F000.rf");
-    var candTwo = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F001.rf");
-    var candThree = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/5/t0/F005.rf");
+    var candOne = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/4/t-0/F000.rf");
+    var candTwo = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F001.rf");
+    var candThree = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/5/t-0/F005.rf");
 
-    gce.addDirReference("4", null, "t0");
-    gce.addDirReference("5", null, "t0");
+    gce.addDirReference("4", null, "t-0");
+    gce.addDirReference("5", null, "t-0");
     gce.addFileReference("4", null, candOne.getPath());
     gce.addFileReference("4", null, candTwo.getPath());
-    gce.addFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0//F002.rf");
+    gce.addFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0//F002.rf");
     gce.addFileReference("5", null, candThree.getPath());
 
     GarbageCollectionAlgorithm gca = new GarbageCollectionAlgorithm();
@@ -285,19 +285,19 @@ public class GarbageCollectionTest {
     assertCandidateRemoved(gce, GcCandidateType.INUSE, candTwo, candThree);
 
     // Removing a reference to a file that wasn't in the candidates should do 
nothing
-    gce.removeFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F002.rf");
+    gce.removeFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F002.rf");
     gca.collect(gce);
     assertFileDeleted(gce);
 
     // Adding more candidates which do not have references that should be 
removed
-    var candFour = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F003.rf");
-    var candFive = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F004.rf");
+    var candFour = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F003.rf");
+    var candFive = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F004.rf");
     gca.collect(gce);
     assertFileDeleted(gce, candFour, candFive);
     assertNoCandidatesRemoved(gce);
 
     // Removing a reference to a file that wasn't in the candidates should do 
nothing
-    gce.removeFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F002.rf");
+    gce.removeFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F002.rf");
     gca.collect(gce);
     assertFileDeleted(gce);
     assertNoCandidatesRemoved(gce);
@@ -315,7 +315,7 @@ public class GarbageCollectionTest {
     GcCandidate[] toBeRemoved = new GcCandidate[20];
 
     BiFunction<String,String,String> genPath =
-        (id, f) -> 
String.format("hdfs://foo:6000/accumulo/tables/%s/t%s/F00%s.rf", id, id, f);
+        (id, f) -> 
String.format("hdfs://foo:6000/accumulo/tables/%s/t-%s/F00%s.rf", id, id, f);
 
     var candOne = gce.addCandidate(genPath.apply("4", "0"));
     var candTwo = gce.addCandidate(genPath.apply("4", "1"));
@@ -335,7 +335,7 @@ public class GarbageCollectionTest {
 
     gce.addFileReference("4", null, candOne.getPath());
     gce.addFileReference("4", null, candTwo.getPath());
-    gce.addFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0//F002.rf");
+    gce.addFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0//F002.rf");
     gce.addFileReference("5", null, candThree.getPath());
     gce.addDirReference("4", null, "t4");
     gce.addDirReference("5", null, "t5");
@@ -382,16 +382,16 @@ public class GarbageCollectionTest {
   public void emptyPathsTest() throws Exception {
     TestGCE gce = new TestGCE();
 
-    var candOne = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/4//t0//F000.rf");
-    var candTwo = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4//t0//F001.rf");
-    var candThree = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/5//t0//F005.rf");
-    var candFour = 
gce.addCandidate("hdfs://foo.com:6000/accumulo//tables//6/t0/F006.rf");
+    var candOne = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/4//t-0//F000.rf");
+    var candTwo = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4//t-0//F001.rf");
+    var candThree = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/5//t-0//F005.rf");
+    var candFour = 
gce.addCandidate("hdfs://foo.com:6000/accumulo//tables//6/t-0/F006.rf");
 
     gce.addFileReference("4", null, candOne.getPath());
     gce.addFileReference("4", null, candTwo.getPath());
     gce.addFileReference("6", null, candFour.getPath());
-    gce.addDirReference("4", null, "t0");
-    gce.addDirReference("6", null, "t1");
+    gce.addDirReference("4", null, "t-0");
+    gce.addDirReference("6", null, "t-1");
 
     GarbageCollectionAlgorithm gca = new GarbageCollectionAlgorithm();
     gca.collect(gce);
@@ -404,25 +404,25 @@ public class GarbageCollectionTest {
   public void testReferencesAndCandidates() throws Exception {
     TestGCE gce = new TestGCE();
 
-    var candOne = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F000.rf");
-    var candTwo = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F002.rf");
-    var candThree = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F001.rf");
+    var candOne = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F000.rf");
+    var candTwo = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F002.rf");
+    var candThree = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F001.rf");
 
-    gce.addFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F000.rf");
-    gce.addFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F001.rf");
-    gce.addFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F002.rf");
-    gce.addFileReference("5", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F000.rf");
-    gce.addFileReference("6", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F000.rf");
-    gce.addDirReference("4", null, "t0");
-    gce.addDirReference("5", null, "t1");
-    gce.addDirReference("6", null, "t1");
+    gce.addFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F000.rf");
+    gce.addFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F001.rf");
+    gce.addFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F002.rf");
+    gce.addFileReference("5", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F000.rf");
+    gce.addFileReference("6", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F000.rf");
+    gce.addDirReference("4", null, "t-0");
+    gce.addDirReference("5", null, "t-1");
+    gce.addDirReference("6", null, "t-1");
 
     GarbageCollectionAlgorithm gca = new GarbageCollectionAlgorithm();
 
     List<String[]> refsToRemove = new ArrayList<>();
-    refsToRemove.add(new String[] {"4", 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F000.rf"});
-    refsToRemove.add(new String[] {"5", 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F000.rf"});
-    refsToRemove.add(new String[] {"6", 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F000.rf"});
+    refsToRemove.add(new String[] {"4", 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F000.rf"});
+    refsToRemove.add(new String[] {"5", 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F000.rf"});
+    refsToRemove.add(new String[] {"6", 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F000.rf"});
 
     Collections.shuffle(refsToRemove);
 
@@ -439,25 +439,25 @@ public class GarbageCollectionTest {
     gca.collect(gce);
     assertFileDeleted(gce, cand);
 
-    gce.removeFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F001.rf");
-    candThree = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F001.rf");
+    gce.removeFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F001.rf");
+    candThree = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F001.rf");
     gca.collect(gce);
     assertFileDeleted(gce, candThree);
     assertNoCandidatesRemoved(gce);
 
-    var candFour = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F002.rf");
+    var candFour = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F002.rf");
     gca.collect(gce);
     assertFileDeleted(gce);
     assertCandidateRemoved(gce, GcCandidateType.INUSE, candFour);
 
     // Re-add the absolute candidate
-    candFour = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F002.rf");
-    gce.removeFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F002.rf");
+    candFour = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F002.rf");
+    gce.removeFileReference("4", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F002.rf");
     gca.collect(gce);
     assertFileDeleted(gce, candFour);
     assertNoCandidatesRemoved(gce);
 
-    candTwo = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F002.rf");
+    candTwo = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F002.rf");
     gca.collect(gce);
     assertFileDeleted(gce, candTwo);
     assertNoCandidatesRemoved(gce);
@@ -467,9 +467,9 @@ public class GarbageCollectionTest {
   public void testBlip() throws Exception {
     TestGCE gce = new TestGCE();
 
-    
gce.addCandidate(GcCandidate.forBulkDir("hdfs://foo.com:6000/accumulo/tables/4/B-0"));
-    gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/B-0/F002.rf");
-    gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/B-0/F001.rf");
+    
gce.addCandidate(GcCandidate.forBulkDir("hdfs://foo.com:6000/accumulo/tables/4/b-0"));
+    gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/b-0/F002.rf");
+    gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/b-0/F001.rf");
     
gce.addCandidate(GcCandidate.forBulkDir("hdfs://foo.com:6000/accumulo/tables/5/b-1"));
     gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/5/b-1/F002.rf");
     gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/5/b-1/F001.rf");
@@ -478,7 +478,7 @@ public class GarbageCollectionTest {
     gce.addDirReference("6", null, "t-0");
     gce.addFileReference("6", null, 
"hdfs://foo.com:6000/accumulo/tables/6/b-2/I1234.rf");
 
-    gce.blips.add("/4/B-0");
+    gce.blips.add("/4/b-0");
     gce.blips.add("/5/b-1");
 
     GarbageCollectionAlgorithm gca = new GarbageCollectionAlgorithm();
@@ -488,13 +488,13 @@ public class GarbageCollectionTest {
     assertFileDeleted(gce);
 
     // Remove the first blip
-    gce.blips.remove("/4/B-0");
+    gce.blips.remove("/4/b-0");
 
     // And we should lose all files in that blip and the blip directory itself
     gca.collect(gce);
-    assertFileDeleted(gce, 
GcCandidate.forBulkDir("hdfs://foo.com:6000/accumulo/tables/4/B-0"),
-        
GcCandidate.forTabletFile("hdfs://foo.com:6000/accumulo/tables/4/B-0/F002.rf", 
0L),
-        
GcCandidate.forTabletFile("hdfs://foo.com:6000/accumulo/tables/4/B-0/F001.rf", 
1L));
+    assertFileDeleted(gce, 
GcCandidate.forBulkDir("hdfs://foo.com:6000/accumulo/tables/4/b-0"),
+        
GcCandidate.forTabletFile("hdfs://foo.com:6000/accumulo/tables/4/b-0/F002.rf", 
0L),
+        
GcCandidate.forTabletFile("hdfs://foo.com:6000/accumulo/tables/4/b-0/F001.rf", 
1L));
 
     gce.blips.remove("/5/b-1");
 
@@ -867,19 +867,19 @@ public class GarbageCollectionTest {
   public void testDeletingInUseReferenceCandidates() throws Exception {
     TestGCE gce = new TestGCE();
 
-    var candidate = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F000.rf");
+    var candidate = 
gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t-0/F000.rf");
 
-    gce.addFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t0/F000.rf");
-    gce.addFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t0/F001.rf");
-    gce.addFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t0/F002.rf");
-    gce.addFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t0/F003.rf");
-    gce.addFileReference("5", null, 
"hdfs://foo:6000/accumulo/tables/4/t0/F000.rf");
-    gce.addFileReference("9", null, 
"hdfs://foo:6000/accumulo/tables/9/t0/F003.rf");
-    gce.addFileReference("6", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t0/F000.rf");
-    gce.addDirReference("4", null, "t0");
-    gce.addDirReference("5", null, "t0");
-    gce.addDirReference("6", null, "t0");
-    gce.addDirReference("9", null, "t0");
+    gce.addFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t-0/F000.rf");
+    gce.addFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t-0/F001.rf");
+    gce.addFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t-0/F002.rf");
+    gce.addFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t-0/F003.rf");
+    gce.addFileReference("5", null, 
"hdfs://foo:6000/accumulo/tables/4/t-0/F000.rf");
+    gce.addFileReference("9", null, 
"hdfs://foo:6000/accumulo/tables/9/t-0/F003.rf");
+    gce.addFileReference("6", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-0/F000.rf");
+    gce.addDirReference("4", null, "t-0");
+    gce.addDirReference("5", null, "t-0");
+    gce.addDirReference("6", null, "t-0");
+    gce.addDirReference("9", null, "t-0");
 
     GarbageCollectionAlgorithm gca = new GarbageCollectionAlgorithm();
     // All candidates currently have references
@@ -889,8 +889,8 @@ public class GarbageCollectionTest {
 
     var cand1 = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/9/t2/F003.rf");
     var cand2 = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/144/t3/F003.rf");
-    gce.removeFileReference("9", null, 
"hdfs://foo:6000/accumulo/tables/9/t0/F003.rf");
-    gce.removeFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t0/F003.rf");
+    gce.removeFileReference("9", null, 
"hdfs://foo:6000/accumulo/tables/9/t-0/F003.rf");
+    gce.removeFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t-0/F003.rf");
 
     gca.collect(gce);
     assertNoCandidatesRemoved(gce);
@@ -904,19 +904,19 @@ public class GarbageCollectionTest {
 
     GcCandidate[] toBeRemoved = new GcCandidate[4];
 
-    toBeRemoved[0] = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/+r/t0/F000.rf");
-    toBeRemoved[1] = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/+r/t0/F001.rf");
-    toBeRemoved[2] = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/+r/t0/F002.rf");
-    toBeRemoved[3] = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/+r/t0/F003.rf");
+    toBeRemoved[0] = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/+r/t-0/F000.rf");
+    toBeRemoved[1] = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/+r/t-0/F001.rf");
+    toBeRemoved[2] = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/+r/t-0/F002.rf");
+    toBeRemoved[3] = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/+r/t-0/F003.rf");
 
-    gce.addFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t0/F000.rf");
-    gce.addFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t0/F001.rf");
-    gce.addFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t0/F002.rf");
-    gce.addFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t0/F003.rf");
-    gce.addFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/4/t1/F000.rf");
-    gce.addFileReference("+r", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t1/F000.rf");
+    gce.addFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t-0/F000.rf");
+    gce.addFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t-0/F001.rf");
+    gce.addFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t-0/F002.rf");
+    gce.addFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t-0/F003.rf");
+    gce.addFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/4/t-1/F000.rf");
+    gce.addFileReference("+r", null, 
"hdfs://foo.com:6000/accumulo/tables/4/t-1/F000.rf");
 
-    gce.addDirReference("+r", null, "t0");
+    gce.addDirReference("+r", null, "t-0");
 
     GarbageCollectionAlgorithm gca = new GarbageCollectionAlgorithm();
     gca.collect(gce);
@@ -924,10 +924,10 @@ public class GarbageCollectionTest {
     // Due to the gce Datalevel of ROOT, InUse candidate deletion is not 
supported
     assertNoCandidatesRemoved(gce);
 
-    gce.removeFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t0/F000.rf");
-    gce.removeFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t0/F001.rf");
-    gce.removeFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t0/F002.rf");
-    gce.removeFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t0/F003.rf");
+    gce.removeFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t-0/F000.rf");
+    gce.removeFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t-0/F001.rf");
+    gce.removeFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t-0/F002.rf");
+    gce.removeFileReference("+r", null, 
"hdfs://foo:6000/accumulo/tables/+r/t-0/F003.rf");
 
     // With file references deleted, the GC should now process the candidates
     gca.collect(gce);
@@ -945,7 +945,7 @@ public class GarbageCollectionTest {
 
     // Ensure that dir candidates still work
     var candOne = gce.addCandidate("6/t-0");
-    var candTwo = gce.addCandidate("7/T-1");
+    var candTwo = gce.addCandidate("7/t-2");
     gce.addDirReference("6", "m", "t-1");
     gce.addDirReference("6", null, "t-0");
 
@@ -984,12 +984,12 @@ public class GarbageCollectionTest {
     TestGCE gce = new TestGCE();
 
     // InUse Scan Refs should not be removed.
-    var scanCandidate = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/4/t0/F010.rf");
-    var candOne = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/4/t0/F000.rf");
-    var candTwo = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/6/t0/F123.rf");
-    gce.addDirReference("4", null, "t0");
-    gce.addScanReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t0/F010.rf");
-    gce.addFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t0/F000.rf");
+    var scanCandidate = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/4/t-0/F010.rf");
+    var candOne = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/4/t-0/F000.rf");
+    var candTwo = 
gce.addCandidate("hdfs://foo:6000/accumulo/tables/6/t-0/F123.rf");
+    gce.addDirReference("4", null, "t-0");
+    gce.addScanReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t-0/F010.rf");
+    gce.addFileReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t-0/F000.rf");
 
     GarbageCollectionAlgorithm gca = new GarbageCollectionAlgorithm();
 
@@ -998,7 +998,7 @@ public class GarbageCollectionTest {
     assertCandidateRemoved(gce, GcCandidateType.INUSE, candOne);
     assertEquals(Set.of(scanCandidate), gce.candidates);
 
-    gce.removeScanReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t0/F010.rf");
+    gce.removeScanReference("4", null, 
"hdfs://foo:6000/accumulo/tables/4/t-0/F010.rf");
     gca.collect(gce);
     assertFileDeleted(gce, scanCandidate);
     assertNoCandidatesRemoved(gce);
@@ -1155,8 +1155,8 @@ public class GarbageCollectionTest {
   public void externalFilesAreNotMatchedByFullUri() throws Exception {
     TestGCE gce = new TestGCE();
 
-    var sameNameDifferentLocation = 
gce.addCandidate("hdfs://nn1/external/b/shared.rf");
-    var referencedCandidate = 
gce.addCandidate("hdfs://nn2/external/b/shared.rf");
+    var sameNameDifferentLocation = 
gce.addCandidate("hdfs://nn1/external/b-0001/shared.rf");
+    var referencedCandidate = 
gce.addCandidate("hdfs://nn2/external/b-0001/shared.rf");
     gce.addFileReference("4", null, referencedCandidate.getPath());
 
     new GarbageCollectionAlgorithm().collect(gce);
@@ -1169,8 +1169,8 @@ public class GarbageCollectionTest {
   public void externalFileUrisAreNormalizedForMatching() throws Exception {
     TestGCE gce = new TestGCE();
 
-    var candidate = 
gce.addCandidate("hdfs://nn//external///rfiles//source.rf");
-    gce.addFileReference("4", null, "hdfs://nn/external/rfiles/source.rf");
+    var candidate = 
gce.addCandidate("hdfs://nn//external///b-0001//source.rf");
+    gce.addFileReference("4", null, "hdfs://nn/external/b-0001/source.rf");
 
     new GarbageCollectionAlgorithm().collect(gce);
 
@@ -1181,7 +1181,7 @@ public class GarbageCollectionTest {
   @Test
   public void externalScanReferenceProtectsCandidate() throws Exception {
     TestGCE gce = new TestGCE();
-    var candidate = gce.addCandidate("hdfs://nn/external/rfiles/source.rf");
+    var candidate = gce.addCandidate("hdfs://nn/external/b-0001/source.rf");
     gce.addScanReference("4", null, candidate.getPath());
 
     new GarbageCollectionAlgorithm().collect(gce);
@@ -1227,12 +1227,12 @@ public class GarbageCollectionTest {
 
   @Test
   public void testExternalFileReferenceDoesNotNeedTabletPathLayout() {
-    assertDoesNotThrow(() -> 
badRefTest("hdfs://foo.com:6000/accumulo/F00.rf"));
+    assertDoesNotThrow(() -> 
badRefTest("hdfs://foo.com:6000/accumulo/b-0004/F00.rf"));
   }
 
   @Test
   public void testExternalFileReferenceCanHaveArbitraryPath() {
-    assertDoesNotThrow(() -> 
badRefTest("hdfs://foo.com:6000/accumulo/tbls/5/F00.rf"));
+    assertDoesNotThrow(() -> 
badRefTest("hdfs://foo.com:6000/accumulo/tbls/b-0003/F00.rf"));
   }
 
 }

Reply via email to