dlmarion commented on code in PR #2792:
URL: https://github.com/apache/accumulo/pull/2792#discussion_r969895280


##########
server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java:
##########
@@ -216,6 +225,46 @@ private long 
removeBlipCandidates(GarbageCollectionEnvironment gce,
     return blipCount;
   }
 
+  @VisibleForTesting
+  /**
+   * Double check no tables were missed during GC
+   */
+  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
+    final 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);
+      }
+    }

Review Comment:
   Addressed in 8a21067b7e41e2d3d1be8c9e7b1e8ee4e7f6777e



-- 
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]

Reply via email to