Skip to content

Commit

Permalink
Merge branch '2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ddanielr committed Nov 2, 2023
2 parents 3c4292d + e34b439 commit a4cc5f8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@
*
* <pre>
* {@code
* [{"name":"small", "type": "internal", "maxSize":"100M","numThreads":3},
* [
* {"name":"small", "type": "internal", "maxSize":"100M","numThreads":3},
* {"name":"medium", "type": "internal", "maxSize":"500M","numThreads":3},
* {"name: "large", "type": "external", "queue", "Queue1"}
* {"name": "large", "type": "external", "queue", "Queue1"}
* ]}
* </pre>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -310,7 +309,6 @@ public void testRootUniqueMutationDelete() throws Exception {
killMacGc();
TableId tableId = DataLevel.METADATA.tableId();
log.info("Root GcCandidate Deletion test");
// Behavior for 2.1. INUSE candidates deletion support will be added in 3.x
log.info("GcCandidates will be added but not removed from Zookeeper");

Ample ample = cluster.getServerContext().getAmple();
Expand All @@ -322,10 +320,20 @@ public void testRootUniqueMutationDelete() throws Exception {
ArrayList<GcCandidate> tempCandidates = new ArrayList<>();
while (cIter.hasNext()) {
GcCandidate cTemp = cIter.next();
log.debug("PreExisting Candidate Found: {}", cTemp);
tempCandidates.add(cTemp);
}
assertTrue(tempCandidates.size() == 0);
if (tempCandidates.size() != 0) {
ample.deleteGcCandidates(datalevel, tempCandidates, Ample.GcCandidateType.VALID);
tempCandidates.clear();

cIter = ample.getGcCandidates(datalevel);
while (cIter.hasNext()) {
GcCandidate cTemp = cIter.next();
log.debug("PreExisting Candidate Found: {}", cTemp);
tempCandidates.add(cTemp);
}
assertEquals(0, tempCandidates.size());
}

// Create multiple candidate entries
List<GcCandidate> candidates =
Expand All @@ -349,11 +357,11 @@ public void testRootUniqueMutationDelete() throws Exception {
counter++;
}
// Ensure Zookeeper collapsed the entries and did not support duplicates.
assertTrue(counter == 2);
assertEquals(2, counter);

cIter = ample.getGcCandidates(datalevel);
while (cIter.hasNext()) {
// This should be a noop call. Root inUse candidate deletions are not supported in 2.1.x
// This should be a noop call. Root inUse candidate deletions are not supported.
ample.deleteGcCandidates(datalevel, List.of(cIter.next()), Ample.GcCandidateType.INUSE);
}

Expand All @@ -367,13 +375,13 @@ public void testRootUniqueMutationDelete() throws Exception {
for (GcCandidate cand : candidates) {
if (gcC.getPath().equals(cand.getPath())) {
// Candidate uid's will never match as they are randomly generated in 2.1.x
assertTrue(!Objects.equals(gcC.getUid(), cand.getUid()));
assertNotEquals(gcC.getUid(), cand.getUid());
counter--;
}
}
}
// Ensure that we haven't seen more candidates than we expected.
assertTrue(counter == 0);
assertEquals(0, counter);

// Delete the candidates as VALID GcCandidates
cIter = ample.getGcCandidates(datalevel);
Expand All @@ -391,7 +399,7 @@ public void testRootUniqueMutationDelete() throws Exception {
counter++;
}
}
assertEquals(counter, 0);
assertEquals(0, counter);
}

@Test
Expand Down Expand Up @@ -467,7 +475,7 @@ private void createAndDeleteUniqueMutation(TableId tableId, Ample.GcCandidateTyp
log.debug("PreExisting Candidate Found: {}", cTemp);
candidates.add(cTemp);
}
assertTrue(candidates.size() == 0);
assertEquals(0, candidates.size());

// Create multiple candidate entries
List<StoredTabletFile> stfs = Stream
Expand All @@ -485,7 +493,7 @@ private void createAndDeleteUniqueMutation(TableId tableId, Ample.GcCandidateTyp
log.debug("Candidate Found: {}", cTemp);
candidates.add(cTemp);
}
assertTrue(candidates.size() == 2);
assertEquals(2, candidates.size());

GcCandidate deleteCandidate = candidates.get(0);
assertNotNull(deleteCandidate);
Expand All @@ -503,12 +511,12 @@ private void createAndDeleteUniqueMutation(TableId tableId, Ample.GcCandidateTyp
GcCandidate gcC = candidate.next();
log.debug("Candidate Found: {}", gcC);
if (gcC.getPath().equals(deleteCandidate.getPath())) {
assertTrue(!Objects.equals(gcC.getUid(), deleteCandidate.getUid()));
assertNotEquals(gcC.getUid(), deleteCandidate.getUid());
foundNewCandidate = true;
}
counter++;
}
assertTrue(counter == 2);
assertEquals(2, counter);
assertTrue(foundNewCandidate);
}
}

0 comments on commit a4cc5f8

Please sign in to comment.