From 1666d58eaeb09ca49da4161f67673118d122b973 Mon Sep 17 00:00:00 2001 From: WenFeiYi Date: Mon, 30 Jan 2023 11:34:09 +0800 Subject: [PATCH] HBASE-27543 May be miss data when use mob --- .../hadoop/hbase/regionserver/compactions/Compactor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java index bd9ce6035ad4..2df710de2a85 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java @@ -134,7 +134,7 @@ protected static class FileDetails { /** Earliest put timestamp if major compaction */ public long earliestPutTs = HConstants.LATEST_TIMESTAMP; /** Latest put timestamp */ - public long latestPutTs = HConstants.LATEST_TIMESTAMP; + public long latestPutTs = 0; /** The last key in the files we're compacting. */ public long maxSeqId = 0; /** Latest memstore read point found in any of the involved files */ @@ -216,8 +216,9 @@ private FileDetails getFileDetails(Collection filesToCompact, boolea } } tmp = fileInfo.get(TIMERANGE_KEY); - fd.latestPutTs = + long latestPutTs = tmp == null ? HConstants.LATEST_TIMESTAMP : TimeRangeTracker.parseFrom(tmp).getMax(); + fd.latestPutTs = Math.max(fd.latestPutTs, latestPutTs); LOG.debug( "Compacting {}, keycount={}, bloomtype={}, size={}, " + "encoding={}, compression={}, seqNum={}{}",