diff --git a/CHANGES.txt b/CHANGES.txt index 9c65389bc08..177488ac09a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -43,6 +43,7 @@ Hbase Change Log HBASE-668 HBASE-533 broke build HBASE-670 Historian deadlocks if regionserver is at global memory boundary and is hosting .META. + HBASE-665 Server side scanner doesn't honor stop row IMPROVEMENTS HBASE-559 MR example job to count table rows diff --git a/src/java/org/apache/hadoop/hbase/client/HTable.java b/src/java/org/apache/hadoop/hbase/client/HTable.java index d7a26732ef1..1c340e2ef72 100644 --- a/src/java/org/apache/hadoop/hbase/client/HTable.java +++ b/src/java/org/apache/hadoop/hbase/client/HTable.java @@ -1276,7 +1276,7 @@ public class HTable { * Returns false if there are no more scanners. */ 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) { this.callable.setClose(); getConnection().getRegionServerWithRetries(callable); @@ -1285,13 +1285,15 @@ public class HTable { // if we're at the end of the table, then close and return false // to stop iterating - if (currentRegion != null){ + if (currentRegion != null) { if (CLIENT_LOG.isDebugEnabled()) { CLIENT_LOG.debug("Advancing forward from region " + currentRegion); } 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(); return false; } @@ -1319,12 +1321,25 @@ public class HTable { 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} */ public RowResult next() throws IOException { if (this.closed) { return null; } - RowResult values = null; do { values = getConnection().getRegionServerWithRetries(callable); @@ -1333,7 +1348,6 @@ public class HTable { if (values != null && values.size() != 0) { return values; } - return null; } diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java index dadeb87fdd4..144446f5d32 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -1056,7 +1056,8 @@ public class HRegion implements HConstants { LOG.debug("Finished memcache flush for region " + this + " in " + (System.currentTimeMillis() - startTime) + "ms, sequence id=" + - sequenceId); + sequenceId + ", " + + StringUtils.humanReadableInt(this.memcacheSize.get())); if (!regionInfo.isMetaRegion()) { this.historian.addRegionFlush(regionInfo, timeTaken); } @@ -1365,7 +1366,7 @@ public class HRegion implements HConstants { while (this.memcacheSize.get() >= this.blockingMemcacheSize) { if (!blocked) { LOG.info("Blocking updates for '" + Thread.currentThread().getName() + - "': Memcache size " + + "' on region " + Bytes.toString(getRegionName()) + ": Memcache size " + StringUtils.humanReadableInt(this.memcacheSize.get()) + " is >= than blocking " + StringUtils.humanReadableInt(this.blockingMemcacheSize) + " size");