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


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncClientScanner.java:
##########
@@ -172,6 +172,7 @@ private CompletableFuture<OpenScannerResponse> 
callOpenScanner(HBaseRpcControlle
       }
       CompletableFuture<OpenScannerResponse> future = new 
CompletableFuture<>();
       try {
+        controller.setTableName(loc.getRegion().getTable());

Review Comment:
   I'm pretty sure this is unnecessary. This `callOpenScanner` ends up getting 
called via AsyncSingleRequestRpcRetryingCaller, which does `resetCallTimeout()` 
before calling the callable. So the change you made in that method should 
handle this case



##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRpcRetryingCaller.java:
##########
@@ -121,7 +121,11 @@ protected final void resetCallTimeout() {
     } else {
       callTimeoutNs = rpcTimeoutNs;
     }
-    resetController(controller, callTimeoutNs, priority);
+    if (getTableName().isPresent()) {

Review Comment:
   could be simplified to one call, with `getTableName().orElse(null)`



##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java:
##########
@@ -753,6 +787,40 @@ public void updateRpc(MethodDescriptor method, Message 
param, CallStats stats, T
     updateRpcGeneric(methodName.toString(), stats);
   }
 
+  /** Report table rpc context to metrics system. */
+  private void updateTableMetric(String methodName, TableName tableName,
+    HBaseProtos.RegionSpecifier regionSpecifier, Message param, CallStats 
stats, Throwable e) {
+    if (tableMetricsEnabled) {
+      if (methodName != null) {
+        String table;
+        if (tableName == null || 
StringUtils.isEmpty(tableName.getNameAsString())) {
+          // Fallback to get table name from region specifier.

Review Comment:
   i think we can simplify this whole method (and above calls) now. I'm not 
sure we need to handle fallback, since all cases should have a TableName in the 
controller now. So we don't need to extract the region in updateRpc above, nor 
do we have to to parse the tablename from the region here.
   
   if we missed a spot, i think we'd consider that a bug and fix it.  maybe you 
could add end-to-end tests to ensure that each of the request types updates a 
table metric?



-- 
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: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to