diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompositeImmutableSegment.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompositeImmutableSegment.java index 16d0a425f7f..30d0d8d79ee 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompositeImmutableSegment.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompositeImmutableSegment.java @@ -18,12 +18,12 @@ */ package org.apache.hadoop.hbase.regionserver; -import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting; import org.apache.commons.logging.Log; +import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellComparator; -import org.apache.hadoop.hbase.classification.InterfaceAudience; -import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.io.TimeRange; +import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting; import java.util.ArrayList; import java.util.Iterator; @@ -122,7 +122,7 @@ public class CompositeImmutableSegment extends ImmutableSegment { } @Override - public boolean shouldSeek(Scan scan, long oldestUnexpiredTS){ + public boolean shouldSeek(TimeRange tr, long oldestUnexpiredTS){ throw new IllegalStateException("Not supported by CompositeImmutableScanner"); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ImmutableSegment.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ImmutableSegment.java index 19b66b48889..39ad4c62423 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ImmutableSegment.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ImmutableSegment.java @@ -24,7 +24,6 @@ import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.util.ClassSize; -import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.io.TimeRange; import java.io.IOException; @@ -130,8 +129,8 @@ public class ImmutableSegment extends Segment { ///////////////////// PUBLIC METHODS ///////////////////// @Override - public boolean shouldSeek(Scan scan, long oldestUnexpiredTS) { - return this.timeRange.includesTimeRange(scan.getTimeRange()) && + public boolean shouldSeek(TimeRange tr, long oldestUnexpiredTS) { + return this.timeRange.includesTimeRange(tr) && this.timeRange.getMax() >= oldestUnexpiredTS; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MutableSegment.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MutableSegment.java index 0b8f9832e29..8c7b3c332f8 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MutableSegment.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MutableSegment.java @@ -27,7 +27,7 @@ import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.classification.InterfaceAudience; -import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.io.TimeRange; import org.apache.hadoop.hbase.util.ClassSize; import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting; @@ -112,8 +112,8 @@ public class MutableSegment extends Segment { } @Override - public boolean shouldSeek(Scan scan, long oldestUnexpiredTS) { - return (this.timeRangeTracker.includesTimeRange(scan.getTimeRange()) + public boolean shouldSeek(TimeRange tr, long oldestUnexpiredTS) { + return (this.timeRangeTracker.includesTimeRange(tr) && (this.timeRangeTracker.getMax() >= oldestUnexpiredTS)); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Segment.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Segment.java index a264567b9f0..8395119ab54 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Segment.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Segment.java @@ -32,7 +32,7 @@ import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValueUtil; import org.apache.hadoop.hbase.classification.InterfaceAudience; -import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.io.TimeRange; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.ClassSize; @@ -177,7 +177,7 @@ public abstract class Segment { return KeyValueUtil.length(cell); } - public abstract boolean shouldSeek(Scan scan, long oldestUnexpiredTS); + public abstract boolean shouldSeek(TimeRange tr, long oldestUnexpiredTS); public abstract long getMinTimestamp(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SegmentScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SegmentScanner.java index ffdf295c1d1..337b763c2ec 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SegmentScanner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SegmentScanner.java @@ -280,7 +280,8 @@ public class SegmentScanner implements KeyValueScanner { */ @Override public boolean shouldUseScanner(Scan scan, Store store, long oldestUnexpiredTS) { - return getSegment().shouldSeek(scan,oldestUnexpiredTS); + return getSegment().shouldSeek(scan.getColumnFamilyTimeRange() + .getOrDefault(store.getColumnFamilyDescriptor().getName(), scan.getTimeRange()), oldestUnexpiredTS); } @Override