diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMemStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMemStore.java index e6fd04d4bb3..9f4fd2f8c4b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMemStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMemStore.java @@ -60,18 +60,16 @@ public abstract class AbstractMemStore implements MemStore { public final static long DEEP_OVERHEAD = FIXED_OVERHEAD; - public static long addToScanners(List segments, long readPt, long order, + public static void addToScanners(List segments, long readPt, List scanners) { for (Segment item : segments) { - order = addToScanners(item, readPt, order, scanners); + addToScanners(item, readPt, scanners); } - return order; } - protected static long addToScanners(Segment segment, long readPt, long order, + protected static void addToScanners(Segment segment, long readPt, List scanners) { - scanners.add(segment.getScanner(readPt, order)); - return order - 1; + scanners.add(segment.getScanner(readPt)); } protected AbstractMemStore(final Configuration conf, final CellComparator c) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactingMemStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactingMemStore.java index ea4cc0870d7..68d7d7ec2bc 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactingMemStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactingMemStore.java @@ -354,20 +354,16 @@ public class CompactingMemStore extends AbstractMemStore { } @Override - /* - * Scanners are ordered from 0 (oldest) to newest in increasing order. - */ public List getScanners(long readPt) throws IOException { MutableSegment activeTmp = active; List pipelineList = pipeline.getSegments(); List snapshotList = snapshot.getAllSegments(); - long order = 1L + pipelineList.size() + snapshotList.size(); + long numberOfSegments = 1L + pipelineList.size() + snapshotList.size(); // The list of elements in pipeline + the active element + the snapshot segment - // The order is the Segment ordinal - List list = createList((int) order); - order = addToScanners(activeTmp, readPt, order, list); - order = addToScanners(pipelineList, readPt, order, list); - addToScanners(snapshotList, readPt, order, list); + List list = createList((int) numberOfSegments); + addToScanners(activeTmp, readPt, list); + addToScanners(pipelineList, readPt, list); + addToScanners(snapshotList, readPt, list); return list; } 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 b6bbb599a9e..98e09814925 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 @@ -120,19 +120,11 @@ public class CompositeImmutableSegment extends ImmutableSegment { throw new IllegalStateException("Not supported by CompositeImmutableScanner"); } - /** - * Creates the scanner for the given read point, and a specific order in a list - * @return a scanner for the given read point - */ - @Override - public KeyValueScanner getScanner(long readPoint, long order) { - throw new IllegalStateException("Not supported by CompositeImmutableScanner"); - } @Override - public List getScanners(long readPoint, long order) { + public List getScanners(long readPoint) { List list = new ArrayList<>(segments.size()); - AbstractMemStore.addToScanners(segments, readPoint, order, list); + AbstractMemStore.addToScanners(segments, readPoint, list); return list; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultMemStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultMemStore.java index 9ef6a6cc2b4..ddeaddf2304 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultMemStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultMemStore.java @@ -125,9 +125,8 @@ public class DefaultMemStore extends AbstractMemStore { */ public List getScanners(long readPt) throws IOException { List list = new ArrayList<>(); - long order = snapshot.getNumOfSegments(); - order = addToScanners(active, readPt, order, list); - addToScanners(snapshot.getAllSegments(), readPt, order, list); + addToScanners(active, readPt, list); + addToScanners(snapshot.getAllSegments(), readPt, list); return list; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java index b0f42d7e1f3..c629f7a7f8f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java @@ -415,13 +415,6 @@ public class KeyValueHeap extends NonReversedNonLazyKeyValueScanner return this.heap; } - /** - * @see KeyValueScanner#getScannerOrder() - */ - @Override - public long getScannerOrder() { - return 0; - } @VisibleForTesting KeyValueScanner getCurrentForTesting() { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueScanner.java index 864cc061c55..7809bfffb14 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueScanner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueScanner.java @@ -73,13 +73,13 @@ public interface KeyValueScanner extends Shipper, Closeable { boolean reseek(Cell key) throws IOException; /** - * Get the order of this KeyValueScanner. This is only relevant for StoreFileScanners and - * MemStoreScanners (other scanners simply return 0). This is required for comparing multiple - * files to find out which one has the latest data. StoreFileScanners are ordered from 0 - * (oldest) to newest in increasing order. MemStoreScanner gets LONG.max since it always - * contains freshest data. + * Get the order of this KeyValueScanner. This is only relevant for StoreFileScanners. + * This is required for comparing multiple files to find out which one has the latest + * data. StoreFileScanners are ordered from 0 (oldest) to newest in increasing order. */ - long getScannerOrder(); + default long getScannerOrder(){ + return 0; + } /** * Close the KeyValue scanner. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreCompactorSegmentsIterator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreCompactorSegmentsIterator.java index 6fa8e53f947..d20d0d0cf83 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreCompactorSegmentsIterator.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreCompactorSegmentsIterator.java @@ -56,10 +56,7 @@ public class MemStoreCompactorSegmentsIterator extends MemStoreSegmentsIterator super(compactionKVMax); List scanners = new ArrayList(); - // create the list of scanners to traverse over all the data - // no dirty reads here as these are immutable segments - int order = segments.size(); - AbstractMemStore.addToScanners(segments, Integer.MAX_VALUE, order, scanners); + AbstractMemStore.addToScanners(segments, Integer.MAX_VALUE, scanners); // build the scanner based on Query Matcher // reinitialize the compacting scanner for each instance of iterator compactingScanner = createScanner(store, scanners); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreMergerSegmentsIterator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreMergerSegmentsIterator.java index 02824ba94bf..01a780c09d9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreMergerSegmentsIterator.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreMergerSegmentsIterator.java @@ -47,8 +47,7 @@ public class MemStoreMergerSegmentsIterator extends MemStoreSegmentsIterator { super(compactionKVMax); // create the list of scanners to traverse over all the data // no dirty reads here as these are immutable segments - int order = segments.size(); - AbstractMemStore.addToScanners(segments, Integer.MAX_VALUE, order, scanners); + AbstractMemStore.addToScanners(segments, Integer.MAX_VALUE, scanners); heap = new KeyValueHeap(scanners, comparator); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreSnapshot.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreSnapshot.java index cbd60e5da30..f74722483f7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreSnapshot.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreSnapshot.java @@ -40,7 +40,7 @@ public class MemStoreSnapshot implements Closeable { this.cellsCount = snapshot.getCellsCount(); this.memStoreSize = snapshot.getMemStoreSize(); this.timeRangeTracker = snapshot.getTimeRangeTracker(); - this.scanners = snapshot.getScanners(Long.MAX_VALUE, Long.MAX_VALUE); + this.scanners = snapshot.getScanners(Long.MAX_VALUE); this.tagsPresent = snapshot.isTagsPresent(); } 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 70074bf3b41..517f537d126 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 @@ -118,16 +118,8 @@ public abstract class Segment { return new SegmentScanner(this, readPoint); } - /** - * Creates the scanner for the given read point, and a specific order in a list - * @return a scanner for the given read point - */ - public KeyValueScanner getScanner(long readPoint, long order) { - return new SegmentScanner(this, readPoint, order); - } - - public List getScanners(long readPoint, long order) { - return Collections.singletonList(new SegmentScanner(this, readPoint, order)); + public List getScanners(long readPoint) { + return Collections.singletonList(new SegmentScanner(this, readPoint)); } /** 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 a8b0d3d501a..8a867b67b9a 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 @@ -35,12 +35,6 @@ import org.apache.hadoop.hbase.client.Scan; @InterfaceAudience.Private public class SegmentScanner implements KeyValueScanner { - /** - * Order of this scanner relative to other scanners. See - * {@link KeyValueScanner#getScannerOrder()}. - */ - private long scannerOrder; - private static final long DEFAULT_SCANNER_ORDER = Long.MAX_VALUE; // the observed structure protected final Segment segment; @@ -61,15 +55,11 @@ public class SegmentScanner implements KeyValueScanner { // flag to indicate if this scanner is closed protected boolean closed = false; - protected SegmentScanner(Segment segment, long readPoint) { - this(segment, readPoint, DEFAULT_SCANNER_ORDER); - } /** - * @param scannerOrder see {@link KeyValueScanner#getScannerOrder()}. * Scanners are ordered from 0 (oldest) to newest in increasing order. */ - protected SegmentScanner(Segment segment, long readPoint, long scannerOrder) { + protected SegmentScanner(Segment segment, long readPoint) { this.segment = segment; this.readPoint = readPoint; //increase the reference count so the underlying structure will not be de-allocated @@ -77,7 +67,6 @@ public class SegmentScanner implements KeyValueScanner { iter = segment.iterator(); // the initialization of the current is required for working with heap of SegmentScanners updateCurrent(); - this.scannerOrder = scannerOrder; if (current == null) { // nothing to fetch from this scanner close(); @@ -252,13 +241,6 @@ public class SegmentScanner implements KeyValueScanner { } } - /** - * @see KeyValueScanner#getScannerOrder() - */ - @Override - public long getScannerOrder() { - return scannerOrder; - } /** * Close the KeyValue scanner. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java index 2973e57819d..9a71a207dd8 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java @@ -1046,13 +1046,6 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner return false; } - /** - * @see KeyValueScanner#getScannerOrder() - */ - @Override - public long getScannerOrder() { - return 0; - } /** * Seek storefiles in parallel to optimize IO latency as much as possible diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CollectionBackedScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CollectionBackedScanner.java index d8b218c5444..d69a8c7483c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CollectionBackedScanner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CollectionBackedScanner.java @@ -116,13 +116,6 @@ public class CollectionBackedScanner extends NonReversedNonLazyKeyValueScanner { return false; } - /** - * @see org.apache.hadoop.hbase.regionserver.KeyValueScanner#getScannerOrder() - */ - @Override - public long getScannerOrder() { - return 0; - } @Override public void close() {