bbeaudreault commented on code in PR #4967:
URL: https://github.com/apache/hbase/pull/4967#discussion_r1082509664


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java:
##########
@@ -3616,8 +3620,9 @@ public ScanResponse scan(final RpcController controller, 
final ScanRequest reque
         if (region.getCoprocessorHost() != null) {
           Boolean bypass = region.getCoprocessorHost().preScannerNext(scanner, 
results, rows);
           if (!results.isEmpty()) {
+            Object lastBlock = null;
             for (Result r : results) {
-              lastBlock.setValue(addSize(rpcCall, r, lastBlock.getValue()));
+              lastBlock = addSize(rpcCall, r, lastBlock);

Review Comment:
   Right, so these `results` here come from a coprocessor. We still want to 
count the size of those, and the coprocessor does not have access to the 
scanner context.
   
   The way addSize works is it keeps track of the last block and only 
increments if `block != lastBlock`. This approach is ok for the coprocessor 
results.
   
   Previously the `lastBlock` value was kept and then passed into the 
downstream `scan(..)` method in the MutableObject.  Then where you commented 
before (line 3401) we would call addSize again, and the passed in `lastBlock` 
value would be used for that equality check.
   
   Now that we use ScannerContext for the accounting of the actual scans, we no 
longer need the addSize call on line 3401. So I removed that and the 
MutableObject.
   
   But we still need lastBlock for checking the coprocessor results, since the 
way addSize works is to keep track of a lastBlock across invocations. `addSize` 
is also still used by Get/Multiget (though I hope to unify those in a later 
issue).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to