[ 
https://issues.apache.org/jira/browse/HBASE-11876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14118934#comment-14118934
 ] 

Srikanth Srungarapu commented on HBASE-11876:
---------------------------------------------

Sry messed with the code block. This is the one I'm referring to
{code}
                 synchronized(scanner) {
                 boolean stale = (region.getRegionInfo().getReplicaId() != 0);
-                for (; i < rows
-                    && currentScanResultSize < maxResultSize; ) {
+                for (; i < rows; i++) {
+                  // Stop collecting results if maxScannerResultSize is set 
and we have exceeded it
+                  if ((maxScannerResultSize < Long.MAX_VALUE) &&
+                      (currentScanResultSize >= maxResultSize)) {
+                    break;
+                  }
                   // Collect values to be returned here
                   boolean moreRows = scanner.nextRaw(values);
                   if (!values.isEmpty()) {
-                    if (maxScannerResultSize < Long.MAX_VALUE){
-                      for (Cell kv : values) {
-                        currentScanResultSize += 
KeyValueUtil.ensureKeyValue(kv).heapSize();
-                      }
+                    for (Cell cell : values) {
+                      KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
+                      currentScanResultSize += kv.heapSize();
+                      totalKvSize += kv.getLength();
                     }
                     results.add(Result.create(values, null, stale));
-                    i++;
                   }
{code}

> RegionScanner.nextRaw(...) should not update metrics
> ----------------------------------------------------
>
>                 Key: HBASE-11876
>                 URL: https://issues.apache.org/jira/browse/HBASE-11876
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.98.6
>            Reporter: Lars Hofhansl
>            Assignee: Andrew Purtell
>             Fix For: 0.99.0, 2.0.0, 0.98.6
>
>         Attachments: HBASE-11876.patch
>
>
> I added the RegionScanner.nextRaw(...) to allow "smart" client to avoid some 
> of the default work that HBase is doing, such as {start|stop}RegionOperation 
> and synchronized(scanner) for each row.
> Metrics should follow the same approach. Collecting them per row is expensive 
> and a caller should have the option to collect those later or to avoid 
> collecting them completely.
> We can also save some cycles in RSRcpServices.scan(...) if we updated the 
> metric only once/batch instead of each row.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to