bharathv commented on a change in pull request #2585:
URL: https://github.com/apache/hbase/pull/2585#discussion_r514885630



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
##########
@@ -1254,8 +1255,10 @@ private boolean processAllResponses(final Connection 
connection) throws IOExcept
           if (call == null) {
             return true;
           }
+          metrics.removeCallFromResponseQueue(call.response.getRemaining());

Review comment:
       Oh I see, you only want to account for the ones that are actually 
queued. Ok.

##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
##########
@@ -1254,8 +1255,10 @@ private boolean processAllResponses(final Connection 
connection) throws IOExcept
           if (call == null) {
             return true;
           }
+          metrics.removeCallFromResponseQueue(call.response.getRemaining());
           if (!processResponse(call)) {
             connection.responseQueue.addFirst(call);
+            metrics.addCallToResponseQueue(call.response.getRemaining());

Review comment:
       Isn't the right way to do this something like..
   
   ```
    before = call.response.getRemaining();  <=== 1
     if (!processResponse(call)) {
      after = call.response.getRemaining();
      metrics.decr(after-before);  <=== 2
   } else {
      metrics.decr(before);
   }
   
   ```
   The difference is you are not decrementing until the bytes are actually 
flushed, otherwise if a metrics poller polls between (1) and (2), there is some 
weird state in between, perhaps ^^ is more desirable for you.




----------------------------------------------------------------
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.

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


Reply via email to