HBASE-665 server side scanner doesn't honor stop row

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@665928 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-06-09 22:45:24 +00:00
parent 2e0e750630
commit b5ae8db868
3 changed files with 23 additions and 7 deletions

View File

@ -43,6 +43,7 @@ Hbase Change Log
HBASE-668 HBASE-533 broke build HBASE-668 HBASE-533 broke build
HBASE-670 Historian deadlocks if regionserver is at global memory boundary HBASE-670 Historian deadlocks if regionserver is at global memory boundary
and is hosting .META. and is hosting .META.
HBASE-665 Server side scanner doesn't honor stop row
IMPROVEMENTS IMPROVEMENTS
HBASE-559 MR example job to count table rows HBASE-559 MR example job to count table rows

View File

@ -1276,7 +1276,7 @@ public class HTable {
* Returns false if there are no more scanners. * Returns false if there are no more scanners.
*/ */
private boolean nextScanner() throws IOException { private boolean nextScanner() throws IOException {
// close the previous scanner if it's open // Close the previous scanner if it's open
if (this.callable != null) { if (this.callable != null) {
this.callable.setClose(); this.callable.setClose();
getConnection().getRegionServerWithRetries(callable); getConnection().getRegionServerWithRetries(callable);
@ -1285,13 +1285,15 @@ public class HTable {
// if we're at the end of the table, then close and return false // if we're at the end of the table, then close and return false
// to stop iterating // to stop iterating
if (currentRegion != null){ if (currentRegion != null) {
if (CLIENT_LOG.isDebugEnabled()) { if (CLIENT_LOG.isDebugEnabled()) {
CLIENT_LOG.debug("Advancing forward from region " + currentRegion); CLIENT_LOG.debug("Advancing forward from region " + currentRegion);
} }
byte [] endKey = currentRegion.getEndKey(); byte [] endKey = currentRegion.getEndKey();
if (endKey == null || Bytes.equals(endKey, HConstants.EMPTY_BYTE_ARRAY)) { if (endKey == null ||
Bytes.equals(endKey, HConstants.EMPTY_BYTE_ARRAY) ||
filterSaysStop(endKey)) {
close(); close();
return false; return false;
} }
@ -1319,12 +1321,25 @@ public class HTable {
return true; return true;
} }
/**
* @param endKey
* @return Returns true if the passed region endkey is judged beyond
* filter.
*/
private boolean filterSaysStop(final byte [] endKey) {
if (this.filter == null) {
return false;
}
// Let the filter see current row.
this.filter.filterRowKey(endKey);
return this.filter.filterAllRemaining();
}
/** {@inheritDoc} */ /** {@inheritDoc} */
public RowResult next() throws IOException { public RowResult next() throws IOException {
if (this.closed) { if (this.closed) {
return null; return null;
} }
RowResult values = null; RowResult values = null;
do { do {
values = getConnection().getRegionServerWithRetries(callable); values = getConnection().getRegionServerWithRetries(callable);
@ -1333,7 +1348,6 @@ public class HTable {
if (values != null && values.size() != 0) { if (values != null && values.size() != 0) {
return values; return values;
} }
return null; return null;
} }

View File

@ -1056,7 +1056,8 @@ public class HRegion implements HConstants {
LOG.debug("Finished memcache flush for region " + this + LOG.debug("Finished memcache flush for region " + this +
" in " + " in " +
(System.currentTimeMillis() - startTime) + "ms, sequence id=" + (System.currentTimeMillis() - startTime) + "ms, sequence id=" +
sequenceId); sequenceId + ", " +
StringUtils.humanReadableInt(this.memcacheSize.get()));
if (!regionInfo.isMetaRegion()) { if (!regionInfo.isMetaRegion()) {
this.historian.addRegionFlush(regionInfo, timeTaken); this.historian.addRegionFlush(regionInfo, timeTaken);
} }
@ -1365,7 +1366,7 @@ public class HRegion implements HConstants {
while (this.memcacheSize.get() >= this.blockingMemcacheSize) { while (this.memcacheSize.get() >= this.blockingMemcacheSize) {
if (!blocked) { if (!blocked) {
LOG.info("Blocking updates for '" + Thread.currentThread().getName() + LOG.info("Blocking updates for '" + Thread.currentThread().getName() +
"': Memcache size " + "' on region " + Bytes.toString(getRegionName()) + ": Memcache size " +
StringUtils.humanReadableInt(this.memcacheSize.get()) + StringUtils.humanReadableInt(this.memcacheSize.get()) +
" is >= than blocking " + " is >= than blocking " +
StringUtils.humanReadableInt(this.blockingMemcacheSize) + " size"); StringUtils.humanReadableInt(this.blockingMemcacheSize) + " size");