Index: src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java (revision 11224) +++ src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java (working copy) @@ -41,6 +41,8 @@ private ScanQueryMatcher matcher; private KeyValueHeap heap; private boolean cacheBlocks; + private final Scan scan; + private NavigableSet columns; // Used to indicate that the scanner has closed (see HBASE-1107) // Doesnt need to be volatile because it's always accessed via synchronized methods @@ -62,6 +64,8 @@ throws IOException { this.store = store; this.cacheBlocks = scan.getCacheBlocks(); + this.scan = scan; + this.columns = columns; matcher = new ScanQueryMatcher(scan, store.getFamily().getName(), columns, store.ttl, store.comparator.getRawComparator(), store.versionsToReturn(scan.getMaxVersions()), @@ -69,7 +73,7 @@ this.isGet = scan.isGetScan(); // pass columns = try to filter out unnecessary ScanFiles - List scanners = getScanners(scan, columns); + List scanners = getScanners(); // Seek all scanners to the start of the Row (or if the exact maching row key does not // exist, then to the start of the next matching Row). @@ -97,6 +101,7 @@ this.store = store; this.cacheBlocks = false; this.isGet = false; + this.scan = scan; matcher = new ScanQueryMatcher(scan, store.getFamily().getName(), null, store.ttl, store.comparator.getRawComparator(), store.versionsToReturn(scan.getMaxVersions()), retainDeletesInOutput); @@ -118,6 +123,7 @@ throws IOException { this.store = null; this.isGet = false; + this.scan = scan; this.cacheBlocks = scan.getCacheBlocks(); this.matcher = new ScanQueryMatcher(scan, colFamily, columns, ttl, comparator.getRawComparator(), scan.getMaxVersions(), false); @@ -130,29 +136,9 @@ } /* - * @return List of scanners ordered properly. - */ - private List getScanners() throws IOException { - // First the store file scanners - - // TODO this used to get the store files in descending order, - // but now we get them in ascending order, which I think is - // actually more correct, since memstore get put at the end. - List sfScanners = StoreFileScanner - .getScannersForStoreFiles(store.getStorefiles(), cacheBlocks, isGet); - List scanners = - new ArrayList(sfScanners.size()+1); - scanners.addAll(sfScanners); - // Then the memstore scanners - scanners.addAll(this.store.memstore.getScanners()); - return scanners; - } - - /* * @return List of scanners to seek, possibly filtered by StoreFile. */ - private List getScanners(Scan scan, - final NavigableSet columns) throws IOException { + private List getScanners() throws IOException { boolean memOnly; boolean filesOnly; if (scan instanceof InternalScan) { @@ -171,7 +157,7 @@ // include only those scan files which pass all filters for (StoreFileScanner sfs : sfScanners) { - if (sfs.shouldSeek(scan, columns)) { + if (columns == null || sfs.shouldSeek(scan, columns)) { scanners.add(sfs); } }