Skip to content

Commit 3bba72a

Browse files
author
Ed Coleman
committed
minor rename to MetadataRowReadTracker and added a test from PR comment
1 parent 7f390aa commit 3bba72a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private void confirmDeletes(GarbageCollectionEnvironment gce,
176176

177177
// it is important that the tracker is closed before performing deletes so that last row is
178178
// checked
179-
try (MetadataReadTracker readTracker = new MetadataReadTracker()) {
179+
try (MetadataRowReadTracker readTracker = new MetadataRowReadTracker()) {
180180
Iterator<Entry<Key,Value>> iter = gce.getReferenceIterator();
181181
while (iter.hasNext()) {
182182
Entry<Key,Value> entry = iter.next();
@@ -364,14 +364,14 @@ public void collect(GarbageCollectionEnvironment gce)
364364
* Track metadata rows read to help validate that gc scan has complete information to make a
365365
* decision on deleting files
366366
*/
367-
private static class MetadataReadTracker implements AutoCloseable {
367+
private static class MetadataRowReadTracker implements AutoCloseable {
368368
private boolean hasDir = false;
369369
private boolean hasPrevRow = false;
370370
private Text row;
371371

372372
private boolean closed = false;
373373

374-
public MetadataReadTracker() {
374+
public MetadataRowReadTracker() {
375375
this.row = null;
376376
}
377377

server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,4 +870,14 @@ public void testPrevRowOnly() {
870870
assertEquals(3, gce.candidates.size());
871871
}
872872

873+
@Test
874+
public void testNoPrevRowNoDir() throws Exception {
875+
876+
GarbageCollectionAlgorithm gca = new GarbageCollectionAlgorithm();
877+
878+
TestGCE gce = new TestGCE();
879+
gce.candidates.add("/1636/default_tablet");
880+
gce.addFileReference("b", "m", "hdfs://foo.com:6000/user/foo/tables/b/t-0/F00.rf");
881+
assertThrows(IllegalStateException.class, () -> gca.collect(gce));
882+
}
873883
}

0 commit comments

Comments
 (0)