You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2008/06/10 00:45:24 UTC

svn commit: r665928 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/client/HTable.java src/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Author: stack
Date: Mon Jun  9 15:45:24 2008
New Revision: 665928

URL: http://svn.apache.org/viewvc?rev=665928&view=rev
Log:
HBASE-665 server side scanner doesn't honor stop row

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=665928&r1=665927&r2=665928&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Mon Jun  9 15:45:24 2008
@@ -43,6 +43,7 @@
    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

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java?rev=665928&r1=665927&r2=665928&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java Mon Jun  9 15:45:24 2008
@@ -1276,7 +1276,7 @@
      * 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 @@
 
       // 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 @@
       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 @@
       if (values != null && values.size() != 0) {
         return values;
       }
-      
       return null;
     }
 

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=665928&r1=665927&r2=665928&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java Mon Jun  9 15:45:24 2008
@@ -1056,7 +1056,8 @@
       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 @@
     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");