Apache9 commented on a change in pull request #4106:
URL: https://github.com/apache/hbase/pull/4106#discussion_r806793992



##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncClientScanner.java
##########
@@ -202,18 +208,24 @@ private long getPrimaryTimeoutNs() {
   private void openScanner() {
     incRegionCountMetrics(scanMetrics);
     openScannerTries.set(1);
+    final Context context = Context.current();
     addListener(timelineConsistentRead(conn.getLocator(), tableName, scan, 
scan.getStartRow(),
       getLocateType(scan), this::openScanner, rpcTimeoutNs, 
getPrimaryTimeoutNs(), retryTimer,
       conn.getConnectionMetrics()), (resp, error) -> {
-        if (error != null) {
-          consumer.onError(error);
-          return;
+        try (Scope ignored = context.makeCurrent()) {
+          if (error != null) {
+            consumer.onError(error);
+            return;
+          }
+          startScan(resp);
         }
-        startScan(resp);
       });
   }
 
   public void start() {
-    openScanner();
+    final Supplier<Span> spanSupplier = new TableOperationSpanBuilder(conn)
+      .setTableName(tableName)
+      .setOperation(scan);
+    TraceUtil.trace(() -> openScanner(), spanSupplier);

Review comment:
       So here, openScanner just returns void instead of a CompletableFuture, 
so after the openScanner call returns, we will end the span? I do not think 
this is the expected behavior? As in openScanner, we will store the current 
context and use the span in the context for all later callbacks?




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