DomGarguilo commented on code in PR #2792:
URL: https://github.com/apache/accumulo/pull/2792#discussion_r956210539
##########
server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java:
##########
@@ -216,6 +225,46 @@ private long
removeBlipCandidates(GarbageCollectionEnvironment gce,
return blipCount;
}
+ @VisibleForTesting
+ /**
+ *
+ */
+ protected void ensureAllTablesChecked(Set<TableId> tableIdsBefore,
Set<TableId> tableIdsSeen,
+ Set<TableId> tableIdsAfter) {
+
+ // if a table was added or deleted during this run, it is acceptable to not
+ // have seen those tables ids when scanning the metadata table. So get the
intersection
+ Set<TableId> tableIdsMustHaveSeen = new HashSet<>(tableIdsBefore);
+ tableIdsMustHaveSeen.retainAll(tableIdsAfter);
+
+ if (tableIdsMustHaveSeen.isEmpty() && !tableIdsSeen.isEmpty()) {
+ if (!tableIdsBefore.isEmpty() && tableIdsAfter.isEmpty()) {
+ throw new RuntimeException("ZK returned no table ids after scanning
for references,"
+ + " maybe all the tables were deleted");
+ } else {
+ // we saw no table ids in ZK but did in the metadata table. This is
unexpected.
+ throw new RuntimeException(
+ "Saw no table ids in ZK but did see table ids in metadata table: "
+ tableIdsSeen);
+ }
+ }
+
+ // From that intersection, remove all the table ids that were seen.
+ tableIdsMustHaveSeen.removeAll(tableIdsSeen);
Review Comment:
```suggestion
tableIdsMustHaveSeen = Sets.difference(tableIdsMustHaveSeen,
tableIdsSeen);
```
Will need to use this instead of `removeAll` if you decide to use
`Sets.intersection` to create `tableIdsMustHaveSeen` (as suggested above)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]