hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1333122 [2/2] - in /hbase/trunk/src: main/java/org/apache/hadoop/hbase/client/ main/java/org/apache/hadoop/hbase/protobuf/ main/java/org/apache/hadoop/hbase/protobuf/generated/ main/java/org/apache/hadoop/hbase/regionserver/ main/protobuf/...
Date Wed, 02 May 2012 17:24:25 GMT
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1333122&r1=1333121&r2=1333122&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Wed May  2
17:24:24 2012
@@ -3304,6 +3304,7 @@ public class HRegion implements HeapSize
     private int isScan;
     private boolean filterClosed = false;
     private long readPt;
+    private long maxResultSize;
 
     public HRegionInfo getRegionInfo() {
       return regionInfo;
@@ -3311,6 +3312,7 @@ public class HRegion implements HeapSize
     RegionScannerImpl(Scan scan, List<KeyValueScanner> additionalScanners) throws IOException
{
       //DebugPrint.println("HRegionScanner.<init>");
 
+      this.maxResultSize = scan.getMaxResultSize();
       this.filter = scan.getFilter();
       this.batch = scan.getBatch();
       if (Bytes.equals(scan.getStopRow(), HConstants.EMPTY_END_ROW)) {
@@ -3354,6 +3356,11 @@ public class HRegion implements HeapSize
       this(scan, null);
     }
 
+    @Override
+    public long getMaxResultSize() {
+      return maxResultSize;
+    }
+
     /**
      * Reset both the filter and the old filter.
      */

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1333122&r1=1333121&r2=1333122&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Wed
May  2 17:24:24 2012
@@ -2200,9 +2200,13 @@ public class HRegionServer extends Regio
               : results.toArray(new Result[0]);
         }
       }
-
-      for (int i = 0; i < nbRows
-          && currentScanResultSize < maxScannerResultSize; i++) {
+      long maxResultSize;
+      if (s.getMaxResultSize() > 0) {
+        maxResultSize = s.getMaxResultSize();
+      } else {
+        maxResultSize = maxScannerResultSize;
+      }
+      for (int i = 0; i < nbRows && currentScanResultSize < maxResultSize;
i++) {
         requestCount.incrementAndGet();
         // Collect values to be returned here
         boolean moreRows = s.next(values, SchemaMetrics.METRIC_NEXTSIZE);

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScanner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScanner.java?rev=1333122&r1=1333121&r2=1333122&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScanner.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScanner.java Wed
May  2 17:24:24 2012
@@ -23,6 +23,7 @@ import java.io.IOException;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.client.Scan;
 
 /**
  * RegionScanner describes iterators over rows in an HRegion.
@@ -52,4 +53,8 @@ public interface RegionScanner extends I
    */
   public boolean reseek(byte[] row) throws IOException;
 
+  /**
+   * @return The preferred max buffersize. See {@link Scan#setMaxResultSize(long)}
+   */
+  public long getMaxResultSize();
 }

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServer.java?rev=1333122&r1=1333121&r2=1333122&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServer.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServer.java Wed May
 2 17:24:24 2012
@@ -819,11 +819,17 @@ public abstract class RegionServer imple
                 done = true;
               }
             }
+            long maxResultSize;
+            if (scanner.getMaxResultSize() > 0) {
+              maxResultSize = scanner.getMaxResultSize();
+            } else {
+              maxResultSize = maxScannerResultSize;
+            }
 
             if (!done) {
               List<KeyValue> values = new ArrayList<KeyValue>();
               for (int i = 0; i < rows
-                  && currentScanResultSize < maxScannerResultSize; i++) {
+                  && currentScanResultSize < maxResultSize; i++) {
                 // Collect values to be returned here
                 boolean moreRows = scanner.next(values, SchemaMetrics.METRIC_NEXTSIZE);
                 if (!values.isEmpty()) {

Modified: hbase/trunk/src/main/protobuf/Client.proto
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/protobuf/Client.proto?rev=1333122&r1=1333121&r2=1333122&view=diff
==============================================================================
--- hbase/trunk/src/main/protobuf/Client.proto (original)
+++ hbase/trunk/src/main/protobuf/Client.proto Wed May  2 17:24:24 2012
@@ -194,6 +194,7 @@ message Scan {
   optional uint32 maxVersions = 7 [default = 1];
   optional bool cacheBlocks = 8 [default = true];
   optional uint32 batchSize = 9;
+  optional uint64 maxResultSize = 10;
 }
 
 /**

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java?rev=1333122&r1=1333121&r2=1333122&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
Wed May  2 17:24:24 2012
@@ -111,6 +111,11 @@ public class TestCoprocessorInterface ex
       return false;
     }
 
+    @Override
+    public long getMaxResultSize() {
+      return delegate.getMaxResultSize();
+    }
+
   }
 
   public static class CoprocessorImpl extends BaseRegionObserver {



Mime
View raw message