This is an automated email from the ASF dual-hosted git repository.

jmanno pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 24f16e5  Add consistency checks for lastFlushID and lastCompactID 
(#2397)
24f16e5 is described below

commit 24f16e5c0279fcc2e0bc1ff9c17fce791f7437f6
Author: Luke Foster <84727868+foste...@users.noreply.github.com>
AuthorDate: Sat Feb 19 09:52:21 2022 -0500

    Add consistency checks for lastFlushID and lastCompactID (#2397)
---
 .../org/apache/accumulo/tserver/tablet/Tablet.java   | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
index 56645d6..3fb330e 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
@@ -1378,7 +1378,7 @@ public class Tablet {
 
     try {
       var tabletMeta = context.getAmple().readTablet(extent, ColumnType.FILES, 
ColumnType.LOGS,
-          ColumnType.ECOMP, ColumnType.PREV_ROW);
+          ColumnType.ECOMP, ColumnType.PREV_ROW, ColumnType.FLUSH_ID, 
ColumnType.COMPACT_ID);
 
       if (tabletMeta == null) {
         String msg = "Closed tablet " + extent + " not found in metadata";
@@ -1402,6 +1402,20 @@ public class Tablet {
         throw new RuntimeException(msg);
       }
 
+      if (tabletMeta.getFlushId().orElse(-1) != lastFlushID) {
+        String msg = "Closed tablet " + extent + " lastFlushID is inconsistent 
with metadata : "
+            + tabletMeta.getFlushId().orElse(-1) + " != " + lastFlushID;
+        log.error(msg);
+        throw new RuntimeException(msg);
+      }
+
+      if (tabletMeta.getCompactId().orElse(-1) != lastCompactID) {
+        String msg = "Closed tablet " + extent + " lastCompactID is 
inconsistent with metadata : "
+            + tabletMeta.getCompactId().orElse(-1) + " != " + lastCompactID;
+        log.error(msg);
+        throw new RuntimeException(msg);
+      }
+
       compareToDataInMemory(tabletMeta);
     } catch (Exception e) {
       String msg = "Failed to do close consistency check for tablet " + extent;
@@ -1412,12 +1426,10 @@ public class Tablet {
 
     if (!otherLogs.isEmpty() || !currentLogs.isEmpty() || 
!referencedLogs.isEmpty()) {
       String msg = "Closed tablet " + extent + " has walog entries in memory 
currentLogs = "
-          + currentLogs + "  otherLogs = " + otherLogs + " refererncedLogs = " 
+ referencedLogs;
+          + currentLogs + "  otherLogs = " + otherLogs + " referencedLogs = " 
+ referencedLogs;
       log.error(msg);
       throw new RuntimeException(msg);
     }
-
-    // TODO check lastFlushID and lostCompactID - ACCUMULO-1290
   }
 
   private void compareToDataInMemory(TabletMetadata tabletMetadata) {

Reply via email to