This is an automated email from the ASF dual-hosted git repository. ddanielr pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit 36f30b40a473be4685dc09c6a550a7c0f7259f50 Merge: e31ac96bcf 1ccc3ef056 Author: Daniel Roberts ddanielr <[email protected]> AuthorDate: Wed Jun 10 18:45:09 2026 +0000 Merge branch '2.1' .../apache/accumulo/gc/GarbageCollectionTest.java | 85 +++++++++++++--------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --cc server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java index 7a93f315d1,a251215223..72cc61e474 --- a/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java +++ b/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java @@@ -273,23 -283,20 +276,18 @@@ public class GarbageCollectionTest GarbageCollectionAlgorithm gca = new GarbageCollectionAlgorithm(); - gca.collect(gce); - assertFileDeleted(gce); - assertCandidateRemoved(gce, GcCandidateType.INUSE, candOne, candTwo, candThree); - - // Remove the reference to this flush file, run the GC which should not trim it from the - // candidates, and assert that it's gone - gce.removeFileReference("4", null, "hdfs://foo.com:6000/accumulo/tables/4/t0/F000.rf"); - candOne = gce.addCandidate("hdfs://foo:6000/accumulo/tables/4/t0/F000.rf"); + // Remove the reference to a file in the candidates should cause it to be removed + gce.removeFileReference("4", null, candOne.getPath()); gca.collect(gce); assertFileDeleted(gce, candOne); + assertCandidateRemoved(gce, GcCandidateType.INUSE, candTwo, candThree); - candTwo = gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F001.rf"); - // Remove the reference to a file in the candidates should cause it to be removed - gce.removeFileReference("4", null, candTwo.getPath()); + // 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"); gca.collect(gce); - assertFileDeleted(gce, candTwo); - assertNoCandidatesRemoved(gce); + assertFileDeleted(gce); - // Adding more candidates which do not have references should be removed + // 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"); gca.collect(gce); @@@ -425,21 -450,22 +434,22 @@@ gce.removeFileReference(refsToRemove.get(i)[0], null, refsToRemove.get(i)[1]); gca.collect(gce); assertFileDeleted(gce); - assertCandidateRemoved(gce, GcCandidateType.INUSE, candOne); - candOne = gce.addCandidate("/4/t0/F000.rf"); } + // InUse references have been removed + assertCandidateRemoved(gce, GcCandidateType.INUSE, candOne, candTwo, candThree); gce.removeFileReference(refsToRemove.get(2)[0], null, refsToRemove.get(2)[1]); + var cand = gce.addCandidate(refsToRemove.get(2)[1]); gca.collect(gce); - assertFileDeleted(gce, candOne); - assertNoCandidatesRemoved(gce); + assertFileDeleted(gce, cand); - candThree = gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F001.rf"); gce.removeFileReference("4", null, "/t0/F001.rf"); + candThree = gce.addCandidate("/4/t0/F001.rf"); gca.collect(gce); assertFileDeleted(gce, candThree); + assertNoCandidatesRemoved(gce); - // add absolute candidate for file that already has a relative candidate + // add an absolute candidate for file that already has a relative candidate var candFour = gce.addCandidate("hdfs://foo.com:6000/accumulo/tables/4/t0/F002.rf"); gca.collect(gce); assertFileDeleted(gce); @@@ -450,11 -476,11 +460,13 @@@ gce.removeFileReference("4", null, "/t0/F002.rf"); gca.collect(gce); assertFileDeleted(gce, candFour); + assertNoCandidatesRemoved(gce); + // Finally re-add the relative candidate to remove the last file + candTwo = gce.addCandidate("/4/t0/F002.rf"); gca.collect(gce); assertFileDeleted(gce, candTwo); + assertNoCandidatesRemoved(gce); } @Test
