HBASE-1566 using Scan(startRow,stopRow) will cause you to iterate the entire table

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@788551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-06-25 23:56:40 +00:00
parent 969b989c63
commit 9754249af2
3 changed files with 16 additions and 3 deletions

View File

@ -227,6 +227,8 @@ Release 0.20.0 - Unreleased
HBASE-1569 rare race condition can take down a regionserver
HBASE-1450 Scripts passed to hbase shell do not have shell context set up
for them
HBASE-1566 using Scan(startRow,stopRow) will cause you to iterate the
entire table
IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage

View File

@ -35,15 +35,13 @@ import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.RegionException;
import org.apache.hadoop.hbase.RemoteExceptionHandler;
import org.apache.hadoop.hbase.TableExistsException;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.ipc.HMasterInterface;
import org.apache.hadoop.hbase.ipc.HRegionInterface;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.MetaUtils;
import org.apache.hadoop.hbase.util.Writables;
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper;
import org.apache.hadoop.io.BooleanWritable;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.ipc.RemoteException;

View File

@ -1881,9 +1881,22 @@ public class HTable {
* filter.
*/
private boolean filterSaysStop(final byte [] endKey) {
if (scan.getStopRow().length > 0) {
// there is a stop row, check to see if we are past it.
byte [] stopRow = scan.getStopRow();
int cmp = Bytes.compareTo(stopRow, 0, stopRow.length,
endKey, 0, endKey.length);
if (cmp <= 0) {
// stopRow <= endKey (endKey is equals to or larger than stopRow)
// This is a stop.
return true;
}
}
if(!scan.hasFilter()) {
return false;
}
if (scan.getFilter() != null) {
// Let the filter see current row.
scan.getFilter().filterRowKey(endKey, 0, endKey.length);