HBASE-2520 Cleanup arrays vs Lists of scanners

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@945418 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-05-17 23:11:13 +00:00
parent 0491cb140a
commit e553b2c34a
13 changed files with 123 additions and 136 deletions

View File

@ -595,6 +595,7 @@ Release 0.21.0 - Unreleased
(Nicolas Spiegelberg via Stack)
HBASE-2340 Add end-to-end test of sync/flush (Forward-port from branch)
HBASE-2555 Get rid of HColumnDescriptor.MAPFILE_INDEX_INTERVAL
HBASE-2520 Cleanup arrays vs Lists of scanners (Todd Lipcon via Stack)
NEW FEATURES

View File

@ -1962,8 +1962,7 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
Store store = stores.get(entry.getKey());
scanners.add(store.getScanner(theScan, entry.getValue()));
}
this.storeHeap =
new KeyValueHeap(scanners.toArray(new KeyValueScanner[0]), comparator);
this.storeHeap = new KeyValueHeap(scanners, comparator);
}
private void resetFilters() {

View File

@ -51,9 +51,9 @@ public class KeyValueHeap implements KeyValueScanner, InternalScanner {
* @param scanners
* @param comparator
*/
public KeyValueHeap(KeyValueScanner [] scanners, KVComparator comparator) {
public KeyValueHeap(List<KeyValueScanner> scanners, KVComparator comparator) {
this.comparator = new KVScannerComparator(comparator);
this.heap = new PriorityQueue<KeyValueScanner>(scanners.length,
this.heap = new PriorityQueue<KeyValueScanner>(scanners.size(),
this.comparator);
for (KeyValueScanner scanner : scanners) {
if (scanner.peek() != null) {

View File

@ -25,6 +25,7 @@ import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.rmi.UnexpectedException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.NavigableSet;
@ -379,12 +380,11 @@ public class MemStore implements HeapSize {
/**
* @return scanner on memstore and snapshot in this order.
*/
KeyValueScanner [] getScanners() {
List<KeyValueScanner> getScanners() {
this.lock.readLock().lock();
try {
KeyValueScanner [] scanners = new KeyValueScanner[1];
scanners[0] = new MemStoreScanner();
return scanners;
return Collections.<KeyValueScanner>singletonList(
new MemStoreScanner());
} finally {
this.lock.readLock().unlock();
}

View File

@ -38,7 +38,7 @@ public class MinorCompactingStoreScanner implements KeyValueScanner, InternalSca
private KeyValue.KVComparator comparator;
MinorCompactingStoreScanner(Store store,
KeyValueScanner [] scanners) {
List<KeyValueScanner> scanners) {
comparator = store.comparator;
KeyValue firstKv = KeyValue.createFirstOnRow(HConstants.EMPTY_START_ROW);
for (KeyValueScanner scanner : scanners ) {
@ -49,7 +49,7 @@ public class MinorCompactingStoreScanner implements KeyValueScanner, InternalSca
}
MinorCompactingStoreScanner(String cfName, KeyValue.KVComparator comparator,
KeyValueScanner [] scanners) {
List<KeyValueScanner> scanners) {
this.comparator = comparator;
KeyValue firstKv = KeyValue.createFirstOnRow(HConstants.EMPTY_START_ROW);

View File

@ -880,16 +880,8 @@ public class Store implements HConstants, HeapSize {
final boolean majorCompaction, final long maxId)
throws IOException {
// For each file, obtain a scanner:
KeyValueScanner [] scanners = new KeyValueScanner[filesToCompact.size()];
for (int i = 0; i < filesToCompact.size(); ++i) {
Reader r = filesToCompact.get(i).getReader();
if (r == null) {
LOG.warn("StoreFile " + filesToCompact.get(i) + " has a null Reader");
continue;
}
// Instantiate HFile.Reader.Scanner to not cache blocks and not use pread
scanners[i] = new StoreFileScanner(r.getScanner(false, false));
}
List<KeyValueScanner> scanners = StoreFileScanner.getScannersForStoreFiles(
filesToCompact, false, false);
// Make the instantiation lazy in case compaction produces no product; i.e.
// where all source cells are expired or deleted.
@ -904,9 +896,7 @@ public class Store implements HConstants, HeapSize {
// since scanner.next() can return 'false' but still be delivering data,
// we have to use a do/while loop.
ArrayList<KeyValue> kvs = new ArrayList<KeyValue>();
boolean more = true;
while (more) {
more = scanner.next(kvs);
while (scanner.next(kvs)) {
// output to writer:
for (KeyValue kv : kvs) {
if (writer == null) {
@ -1003,6 +993,7 @@ public class Store implements HConstants, HeapSize {
}
// WARN ugly hack here, but necessary sadly.
// TODO why is this necessary? need a comment here if it's unintuitive!
ReadWriteConsistencyControl.resetThreadReadPoint(region.getRWCC());
// Tell observers that list of StoreFiles has changed.
@ -1359,7 +1350,7 @@ public class Store implements HConstants, HeapSize {
return size;
}
/*
/**
* Datastructure that holds size and row to split a file around.
* TODO: Take a KeyValue rather than row.
*/

View File

@ -20,15 +20,23 @@
package org.apache.hadoop.hbase.regionserver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.io.hfile.HFileScanner;
import org.apache.hadoop.hbase.io.hfile.HFile.Reader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* A KeyValue scanner that iterates over a single HFile
*/
class StoreFileScanner implements KeyValueScanner {
static final Log LOG = LogFactory.getLog(Store.class);
private HFileScanner hfs;
private KeyValue cur = null;
@ -37,10 +45,33 @@ class StoreFileScanner implements KeyValueScanner {
* Implements a {@link KeyValueScanner} on top of the specified {@link HFileScanner}
* @param hfs HFile scanner
*/
public StoreFileScanner(HFileScanner hfs) {
private StoreFileScanner(HFileScanner hfs) {
this.hfs = hfs;
}
/**
* Return an array of scanners corresponding to the given
* set of store files.
*/
public static List<KeyValueScanner> getScannersForStoreFiles(
Collection<StoreFile> filesToCompact,
boolean cacheBlocks,
boolean usePread) {
List<KeyValueScanner> scanners =
new ArrayList<KeyValueScanner>(filesToCompact.size());
for (StoreFile file : filesToCompact) {
Reader r = file.getReader();
if (r == null) {
// TODO why can this happen? this seems like something worth
// throwing an exception over!
LOG.error("StoreFile " + file + " has a null Reader");
continue;
}
scanners.add(new StoreFileScanner(r.getScanner(cacheBlocks, usePread)));
}
return scanners;
}
public String toString() {
return "StoreFileScanner[" + hfs.toString() + ", cur=" + cur + "]";
}

View File

@ -24,8 +24,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.io.hfile.HFile;
import org.apache.hadoop.hbase.io.hfile.HFileScanner;
import java.io.IOException;
import java.util.ArrayList;
@ -72,8 +70,7 @@ class StoreScanner implements KeyValueScanner, InternalScanner, ChangedReadersOb
}
// Combine all seeked scanners with a heap
heap = new KeyValueHeap(
scanners.toArray(new KeyValueScanner[scanners.size()]), store.comparator);
heap = new KeyValueHeap(scanners, store.comparator);
this.store.addChangedReaderObserver(this);
}
@ -86,7 +83,7 @@ class StoreScanner implements KeyValueScanner, InternalScanner, ChangedReadersOb
* @param scan the spec
* @param scanners ancilliary scanners
*/
StoreScanner(Store store, Scan scan, KeyValueScanner [] scanners) {
StoreScanner(Store store, Scan scan, List<KeyValueScanner> scanners) {
this.store = store;
this.cacheBlocks = false;
this.isGet = false;
@ -107,7 +104,7 @@ class StoreScanner implements KeyValueScanner, InternalScanner, ChangedReadersOb
StoreScanner(final Scan scan, final byte [] colFamily, final long ttl,
final KeyValue.KVComparator comparator,
final NavigableSet<byte[]> columns,
final KeyValueScanner [] scanners) {
final List<KeyValueScanner> scanners) {
this.store = null;
this.isGet = false;
this.cacheBlocks = scan.getCacheBlocks();
@ -125,11 +122,13 @@ class StoreScanner implements KeyValueScanner, InternalScanner, ChangedReadersOb
* @return List of scanners ordered properly.
*/
private List<KeyValueScanner> getScanners() {
List<KeyValueScanner> scanners = getStoreFileScanners();
KeyValueScanner [] memstorescanners = this.store.memstore.getScanners();
for (int i = memstorescanners.length - 1; i >= 0; i--) {
scanners.add(memstorescanners[i]);
}
// First the store file scanners
Map<Long, StoreFile> map = this.store.getStorefiles().descendingMap();
List<KeyValueScanner> scanners =
StoreFileScanner.getScannersForStoreFiles(map.values(),
cacheBlocks, isGet);
// Then the memstore scanners
scanners.addAll(this.store.memstore.getScanners());
return scanners;
}
@ -231,27 +230,6 @@ class StoreScanner implements KeyValueScanner, InternalScanner, ChangedReadersOb
return next(outResult, -1);
}
private List<KeyValueScanner> getStoreFileScanners() {
List<HFileScanner> s =
new ArrayList<HFileScanner>(this.store.getStorefilesCount());
Map<Long, StoreFile> map = this.store.getStorefiles().descendingMap();
for(StoreFile sf : map.values()) {
HFile.Reader r = sf.getReader();
if (r == null) {
LOG.warn("StoreFile " + sf + " has null Reader");
continue;
}
// If isGet, use pread, else false, dont use pread
s.add(r.getScanner(this.cacheBlocks, isGet));
}
List<KeyValueScanner> scanners =
new ArrayList<KeyValueScanner>(s.size()+1);
for(HFileScanner hfs : s) {
scanners.add(new StoreFileScanner(hfs));
}
return scanners;
}
// Implementation of ChangedReadersObserver
public synchronized void updateReaders() throws IOException {
if (this.closing) return;
@ -269,8 +247,7 @@ class StoreScanner implements KeyValueScanner, InternalScanner, ChangedReadersOb
}
// Combine all seeked scanners with a heap
heap = new KeyValueHeap(
scanners.toArray(new KeyValueScanner[scanners.size()]), store.comparator);
heap = new KeyValueHeap(scanners, store.comparator);
// Reset the state of the Query Matcher and set to top row
matcher.reset();

View File

@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.KeyValue;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Collections;
import java.util.List;
/**
* A fixture that implements and presents a KeyValueScanner.
@ -50,6 +51,15 @@ public class KeyValueScanFixture implements KeyValueScanner {
Collections.sort(data, this.comparator);
}
public static List<KeyValueScanner> scanFixture(KeyValue[] ... kvArrays) {
ArrayList<KeyValueScanner> scanners = new ArrayList<KeyValueScanner>();
for (KeyValue [] kvs : kvArrays) {
scanners.add(new KeyValueScanFixture(KeyValue.COMPARATOR, kvs));
}
return scanners;
}
@Override
public KeyValue peek() {
return this.current;

View File

@ -35,7 +35,7 @@ public class TestKeyValueHeap extends HBaseTestCase
implements HConstants {
private static final boolean PRINT = false;
List<Scanner> scanners = new ArrayList<Scanner>();
List<KeyValueScanner> scanners = new ArrayList<KeyValueScanner>();
private byte [] row1;
private byte [] fam1;
@ -102,7 +102,7 @@ implements HConstants {
//Creating KeyValueHeap
KeyValueHeap kvh =
new KeyValueHeap(scanners.toArray(new Scanner[0]), KeyValue.COMPARATOR);
new KeyValueHeap(scanners, KeyValue.COMPARATOR);
List<KeyValue> actual = new ArrayList<KeyValue>();
while(kvh.peek() != null){
@ -155,7 +155,7 @@ implements HConstants {
//Creating KeyValueHeap
KeyValueHeap kvh =
new KeyValueHeap(scanners.toArray(new Scanner[0]), KeyValue.COMPARATOR);
new KeyValueHeap(scanners, KeyValue.COMPARATOR);
KeyValue seekKv = new KeyValue(row2, fam1, null, null);
kvh.seek(seekKv);
@ -200,13 +200,12 @@ implements HConstants {
scanners.add(new Scanner(l4));
//Creating KeyValueHeap
KeyValueHeap kvh =
new KeyValueHeap(scanners.toArray(new Scanner[0]), KeyValue.COMPARATOR);
KeyValueHeap kvh = new KeyValueHeap(scanners, KeyValue.COMPARATOR);
while(kvh.next() != null);
for(Scanner scanner : scanners) {
assertTrue(scanner.isClosed());
for(KeyValueScanner scanner : scanners) {
assertTrue(((Scanner)scanner).isClosed());
}
}

View File

@ -76,7 +76,7 @@ public class TestMemStore extends TestCase {
*/
public void testScanAcrossSnapshot() throws IOException {
int rowCount = addRows(this.memstore);
KeyValueScanner [] memstorescanners = this.memstore.getScanners();
List<KeyValueScanner> memstorescanners = this.memstore.getScanners();
Scan scan = new Scan();
List<KeyValue> result = new ArrayList<KeyValue>();
ReadWriteConsistencyControl.resetThreadReadPoint(rwcc);
@ -95,8 +95,8 @@ public class TestMemStore extends TestCase {
s.close();
}
assertEquals(rowCount, count);
for (int i = 0; i < memstorescanners.length; i++) {
memstorescanners[0].close();
for (KeyValueScanner scanner : memstorescanners) {
scanner.close();
}
ReadWriteConsistencyControl.resetThreadReadPoint(rwcc);
@ -123,8 +123,8 @@ public class TestMemStore extends TestCase {
s.close();
}
assertEquals(rowCount, count);
for (int i = 0; i < memstorescanners.length; i++) {
memstorescanners[0].close();
for (KeyValueScanner scanner : memstorescanners) {
scanner.close();
}
memstorescanners = this.memstore.getScanners();
// Assert that new values are seen in kvset as we scan.
@ -190,9 +190,9 @@ public class TestMemStore extends TestCase {
private void verifyScanAcrossSnapshot2(KeyValue kv1, KeyValue kv2) {
ReadWriteConsistencyControl.resetThreadReadPoint(rwcc);
KeyValueScanner[] memstorescanners = this.memstore.getScanners();
assertEquals(1, memstorescanners.length);
final KeyValueScanner scanner = memstorescanners[0];
List<KeyValueScanner> memstorescanners = this.memstore.getScanners();
assertEquals(1, memstorescanners.size());
final KeyValueScanner scanner = memstorescanners.get(0);
scanner.seek(KeyValue.createFirstOnRow(HConstants.EMPTY_START_ROW));
assertEquals(kv1, scanner.next());
assertEquals(kv2, scanner.next());
@ -224,14 +224,14 @@ public class TestMemStore extends TestCase {
memstore.add(kv1);
ReadWriteConsistencyControl.resetThreadReadPoint(rwcc);
KeyValueScanner[] s = this.memstore.getScanners();
assertScannerResults(s[0], new KeyValue[]{});
KeyValueScanner s = this.memstore.getScanners().get(0);
assertScannerResults(s, new KeyValue[]{});
rwcc.completeMemstoreInsert(w);
ReadWriteConsistencyControl.resetThreadReadPoint(rwcc);
s = this.memstore.getScanners();
assertScannerResults(s[0], new KeyValue[]{kv1});
s = this.memstore.getScanners().get(0);
assertScannerResults(s, new KeyValue[]{kv1});
w = rwcc.beginMemstoreInsert();
KeyValue kv2 = new KeyValue(row, f, q2, v);
@ -239,14 +239,14 @@ public class TestMemStore extends TestCase {
memstore.add(kv2);
ReadWriteConsistencyControl.resetThreadReadPoint(rwcc);
s = this.memstore.getScanners();
assertScannerResults(s[0], new KeyValue[]{kv1});
s = this.memstore.getScanners().get(0);
assertScannerResults(s, new KeyValue[]{kv1});
rwcc.completeMemstoreInsert(w);
ReadWriteConsistencyControl.resetThreadReadPoint(rwcc);
s = this.memstore.getScanners();
assertScannerResults(s[0], new KeyValue[]{kv1, kv2});
s = this.memstore.getScanners().get(0);
assertScannerResults(s, new KeyValue[]{kv1, kv2});
}
private static class ReadOwnWritesTester extends Thread {
@ -300,7 +300,7 @@ public class TestMemStore extends TestCase {
// Assert that we can read back
ReadWriteConsistencyControl.resetThreadReadPoint(rwcc);
KeyValueScanner s = this.memstore.getScanners()[0];
KeyValueScanner s = this.memstore.getScanners().get(0);
s.seek(kv);
KeyValue ret = s.next();
@ -429,7 +429,7 @@ public class TestMemStore extends TestCase {
InternalScanner scanner =
new StoreScanner(new Scan(Bytes.toBytes(startRowId)), FAMILY,
Integer.MAX_VALUE, this.memstore.comparator, null,
new KeyValueScanner[]{memstore.getScanners()[0]});
memstore.getScanners());
List<KeyValue> results = new ArrayList<KeyValue>();
for (int i = 0; scanner.next(results); i++) {
int rowId = startRowId + i;
@ -857,8 +857,7 @@ public class TestMemStore extends TestCase {
static void doScan(MemStore ms, int iteration) {
long nanos = System.nanoTime();
KeyValueScanner [] ss = ms.getScanners();
KeyValueScanner s = ss[0];
KeyValueScanner s = ms.getScanners().get(0);
s.seek(KeyValue.createFirstOnRow(new byte[]{}));
System.out.println(iteration + " create/seek took: " + (System.nanoTime() - nanos)/1000);

View File

@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.KeyValueTestUtil;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static org.apache.hadoop.hbase.regionserver.KeyValueScanFixture.scanFixture;
public class TestMinorCompactingStoreScanner extends TestCase {
@ -45,9 +46,8 @@ public class TestMinorCompactingStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "i", 11, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R2", "cf", "a", 11, KeyValue.Type.Put, "dont-care"),
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
List<KeyValueScanner> scanners = scanFixture(kvs);
InternalScanner scan =
new MinorCompactingStoreScanner("cf", KeyValue.COMPARATOR, scanners);
List<KeyValue> results = new ArrayList<KeyValue>();
@ -77,9 +77,7 @@ public class TestMinorCompactingStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "a", 10, KeyValue.Type.Delete, "dont-care"),
KeyValueTestUtil.create("R1", "cf", "a", 10, KeyValue.Type.Put, "dont-care")
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
List<KeyValueScanner> scanners = scanFixture(kvs);
InternalScanner scan =
new MinorCompactingStoreScanner("cf", KeyValue.COMPARATOR, scanners);
List<KeyValue> results = new ArrayList<KeyValue>();

View File

@ -28,9 +28,12 @@ import org.apache.hadoop.hbase.util.Bytes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.NavigableSet;
import java.util.TreeSet;
import static org.apache.hadoop.hbase.regionserver.KeyValueScanFixture.scanFixture;
public class TestStoreScanner extends TestCase {
private static final String CF_STR = "cf";
@ -60,9 +63,10 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create(r1, CF_STR, "a", 4, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create(r1, CF_STR, "a", 5, KeyValue.Type.Put, "dont-care"),
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
List<KeyValueScanner> scanners = Arrays.<KeyValueScanner>asList(
new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
});
Scan scanSpec = new Scan(Bytes.toBytes(r1));
scanSpec.setTimeRange(0, 6);
scanSpec.setMaxVersions();
@ -110,9 +114,10 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "a", 1, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R1", "cf", "a", 1, KeyValue.Type.Put, "dont-care"),
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
List<KeyValueScanner> scanners = Arrays.asList(
new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
});
Scan scanSpec = new Scan(Bytes.toBytes("R1"));
// this only uses maxVersions (default=1) and TimeRange (default=all)
@ -140,10 +145,7 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "a", 1, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R2", "cf", "a", 1, KeyValue.Type.Put, "dont-care")
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR,
kvs)
};
List<KeyValueScanner> scanners = scanFixture(kvs);
Scan scanSpec = new Scan(Bytes.toBytes("R1"));
// this only uses maxVersions (default=1) and TimeRange (default=all)
@ -175,9 +177,7 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "a", 1, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R1", "cf", "a", 1, KeyValue.Type.Delete, "dont-care"),
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
List<KeyValueScanner> scanners = scanFixture(kvs);
Scan scanSpec = new Scan(Bytes.toBytes("R1"));
StoreScanner scan =
new StoreScanner(scanSpec, CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
@ -198,9 +198,7 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "a", 1, KeyValue.Type.Delete, "dont-care"),
KeyValueTestUtil.create("R2", "cf", "a", 20, KeyValue.Type.Put, "dont-care")
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
List<KeyValueScanner> scanners = scanFixture(kvs);
Scan scanSpec = new Scan(Bytes.toBytes("R1"));
StoreScanner scan =
new StoreScanner(scanSpec, CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
@ -228,10 +226,8 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "a", now-100, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R1", "cf", "a", now, KeyValue.Type.Put, "dont-care")
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs1),
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs2)
};
List<KeyValueScanner> scanners = scanFixture(kvs1, kvs2);
StoreScanner scan =
new StoreScanner(new Scan(Bytes.toBytes("R1")), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
getCols("a"), scanners);
@ -255,10 +251,8 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "a", now, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R2", "cf", "z", now, KeyValue.Type.Put, "dont-care")
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs1),
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs2)
};
List<KeyValueScanner> scanners = scanFixture(kvs1, kvs2);
Scan scanSpec = new Scan(Bytes.toBytes("R1")).setMaxVersions(2);
StoreScanner scan =
new StoreScanner(scanSpec, CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
@ -276,9 +270,7 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "b", 1, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R1", "cf", "a", 1, KeyValue.Type.DeleteColumn, "dont-care"),
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
List<KeyValueScanner> scanners = scanFixture(kvs);
StoreScanner scan =
new StoreScanner(new Scan(Bytes.toBytes("R1")), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
null, scanners);
@ -307,9 +299,7 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "d", 8, KeyValue.Type.Put, "dont-care"), // no
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
List<KeyValueScanner> scanners = scanFixture(kvs);
StoreScanner scan =
new StoreScanner(new Scan().setMaxVersions(2), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
null, scanners);
@ -337,9 +327,7 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "i", 11, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R2", "cf", "a", 11, KeyValue.Type.Put, "dont-care"),
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
List<KeyValueScanner> scanners = scanFixture(kvs);
StoreScanner scan =
new StoreScanner(new Scan().setMaxVersions(Integer.MAX_VALUE), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
null, scanners);
@ -360,9 +348,7 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "a", 8, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R1", "cf", "b", 5, KeyValue.Type.Put, "dont-care")
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs),
};
List<KeyValueScanner> scanners = scanFixture(kvs);
StoreScanner scan =
new StoreScanner(new Scan(), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
null, scanners);
@ -385,9 +371,7 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R1", "cf", "i", 11, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R2", "cf", "a", 11, KeyValue.Type.Put, "dont-care"),
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
List<KeyValueScanner> scanners = scanFixture(kvs);
StoreScanner scan =
new StoreScanner(new Scan(), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
getCols("a", "d"), scanners);
@ -423,9 +407,7 @@ public class TestStoreScanner extends TestCase {
KeyValueTestUtil.create("R2", "cf", "c", now-200, KeyValue.Type.Put, "dont-care"),
KeyValueTestUtil.create("R2", "cf", "c", now-1000, KeyValue.Type.Put, "dont-care")
};
KeyValueScanner [] scanners = new KeyValueScanner[] {
new KeyValueScanFixture(KeyValue.COMPARATOR, kvs)
};
List<KeyValueScanner> scanners = scanFixture(kvs);
Scan scan = new Scan();
scan.setMaxVersions(1);
StoreScanner scanner =