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={}{}",