HBASE-18059 remove scanner order related code
This commit is contained in:
parent
3ac0ffde4c
commit
af4dd3eb3c
|
@ -60,18 +60,16 @@ public abstract class AbstractMemStore implements MemStore {
|
|||
|
||||
public final static long DEEP_OVERHEAD = FIXED_OVERHEAD;
|
||||
|
||||
public static long addToScanners(List<? extends Segment> segments, long readPt, long order,
|
||||
public static void addToScanners(List<? extends Segment> segments, long readPt,
|
||||
List<KeyValueScanner> 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<KeyValueScanner> scanners) {
|
||||
scanners.add(segment.getScanner(readPt, order));
|
||||
return order - 1;
|
||||
scanners.add(segment.getScanner(readPt));
|
||||
}
|
||||
|
||||
protected AbstractMemStore(final Configuration conf, final CellComparator c) {
|
||||
|
|
|
@ -354,20 +354,16 @@ public class CompactingMemStore extends AbstractMemStore {
|
|||
}
|
||||
|
||||
@Override
|
||||
/*
|
||||
* Scanners are ordered from 0 (oldest) to newest in increasing order.
|
||||
*/
|
||||
public List<KeyValueScanner> getScanners(long readPt) throws IOException {
|
||||
MutableSegment activeTmp = active;
|
||||
List<? extends Segment> pipelineList = pipeline.getSegments();
|
||||
List<? extends Segment> 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<KeyValueScanner> list = createList((int) order);
|
||||
order = addToScanners(activeTmp, readPt, order, list);
|
||||
order = addToScanners(pipelineList, readPt, order, list);
|
||||
addToScanners(snapshotList, readPt, order, list);
|
||||
List<KeyValueScanner> list = createList((int) numberOfSegments);
|
||||
addToScanners(activeTmp, readPt, list);
|
||||
addToScanners(pipelineList, readPt, list);
|
||||
addToScanners(snapshotList, readPt, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<KeyValueScanner> getScanners(long readPoint, long order) {
|
||||
public List<KeyValueScanner> getScanners(long readPoint) {
|
||||
List<KeyValueScanner> list = new ArrayList<>(segments.size());
|
||||
AbstractMemStore.addToScanners(segments, readPoint, order, list);
|
||||
AbstractMemStore.addToScanners(segments, readPoint, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,9 +125,8 @@ public class DefaultMemStore extends AbstractMemStore {
|
|||
*/
|
||||
public List<KeyValueScanner> getScanners(long readPt) throws IOException {
|
||||
List<KeyValueScanner> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -415,13 +415,6 @@ public class KeyValueHeap extends NonReversedNonLazyKeyValueScanner
|
|||
return this.heap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see KeyValueScanner#getScannerOrder()
|
||||
*/
|
||||
@Override
|
||||
public long getScannerOrder() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
KeyValueScanner getCurrentForTesting() {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -56,10 +56,7 @@ public class MemStoreCompactorSegmentsIterator extends MemStoreSegmentsIterator
|
|||
super(compactionKVMax);
|
||||
|
||||
List<KeyValueScanner> scanners = new ArrayList<KeyValueScanner>();
|
||||
// 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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<KeyValueScanner> getScanners(long readPoint, long order) {
|
||||
return Collections.singletonList(new SegmentScanner(this, readPoint, order));
|
||||
public List<KeyValueScanner> getScanners(long readPoint) {
|
||||
return Collections.singletonList(new SegmentScanner(this, readPoint));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue