This is an automated email from the ASF dual-hosted git repository. ctubbsii 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 6f8be5c Add consistency checks for lastFlushID and lastCompactID (#2531) 6f8be5c is described below commit 6f8be5c9f26676712eb417db69ea1938380f4ff3 Author: Jeffrey Manno <jeffreymann...@gmail.com> AuthorDate: Sat Feb 26 15:55:36 2022 -0500 Add consistency checks for lastFlushID and lastCompactID (#2531) This restores the original checks from #2397 24f16e5c0279fcc2e0bc1ff9c17fce791f7437f6 to fix #2153 that were reverted in 664b5a5dd137a58e4df47915c8f5f209a530cd8a due to a failure in DeleteRowsIT. This change fixes that failure by including a check to ensure the Optional flushId or compactId is present, before doing the consistency check. This fixes #2153 Co-authored-by: foster33 <lukefo...@gmail.com> Co-authored-by: Christopher Tubbs <ctubb...@apache.org> --- .../org/apache/accumulo/tserver/tablet/Tablet.java | 24 ++++++++++++++++++---- 1 file changed, 20 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 4e74057..07e21ed 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 @@ -1377,7 +1377,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"; @@ -1401,6 +1401,24 @@ public class Tablet { throw new RuntimeException(msg); } + tabletMeta.getFlushId().ifPresent(flushId -> { + if (flushId != lastFlushID) { + String msg = "Closed tablet " + extent + " lastFlushID is inconsistent with metadata : " + + flushId + " != " + lastFlushID; + log.error(msg); + throw new RuntimeException(msg); + } + }); + + tabletMeta.getCompactId().ifPresent(compactId -> { + if (compactId != lastCompactID) { + String msg = "Closed tablet " + extent + " lastCompactID is inconsistent with metadata : " + + compactId + " != " + lastCompactID; + log.error(msg); + throw new RuntimeException(msg); + } + }); + compareToDataInMemory(tabletMeta); } catch (Exception e) { String msg = "Failed to do close consistency check for tablet " + extent; @@ -1411,12 +1429,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) {