Apache9 commented on a change in pull request #4106:
URL: https://github.com/apache/hbase/pull/4106#discussion_r835750626
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncClientScanner.java
##########
@@ -140,26 +159,36 @@ public OpenScannerResponse(HRegionLocation loc, boolean
isRegionServerRemote, In
private CompletableFuture<OpenScannerResponse>
callOpenScanner(HBaseRpcController controller,
HRegionLocation loc, ClientService.Interface stub) {
- boolean isRegionServerRemote = isRemote(loc.getHostname());
- incRPCCallsMetrics(scanMetrics, isRegionServerRemote);
- if (openScannerTries.getAndIncrement() > 1) {
- incRPCRetriesMetrics(scanMetrics, isRegionServerRemote);
+ try (Scope ignored = span.makeCurrent()) {
+ boolean isRegionServerRemote = isRemote(loc.getHostname());
+ incRPCCallsMetrics(scanMetrics, isRegionServerRemote);
+ if (openScannerTries.getAndIncrement() > 1) {
+ incRPCRetriesMetrics(scanMetrics, isRegionServerRemote);
+ }
+ CompletableFuture<OpenScannerResponse> future = new
CompletableFuture<>();
+ try {
+ ScanRequest request = RequestConverter.buildScanRequest(
+ loc.getRegion().getRegionName(), scan, scan.getCaching(), false);
+ stub.scan(controller, request, resp -> {
+ try (Scope ignored1 = span.makeCurrent()) {
+ if (controller.failed()) {
+ final IOException e = controller.getFailed();
+ future.completeExceptionally(e);
+ TraceUtil.setError(span, e);
+ span.end();
+ return;
+ }
+ future.complete(new OpenScannerResponse(
+ loc, isRegionServerRemote, stub, controller, resp));
+ }
+ });
+ } catch (IOException e) {
+ TraceUtil.setError(span, e);
+ span.end();
Review comment:
I do not think we need to call span.end here. This method in called in
openScanner, we will add a listener to the returned CompletableFuture and when
there is an error, we will also call span.end().
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncClientScanner.java
##########
@@ -112,6 +116,21 @@ public AsyncClientScanner(Scan scan,
AdvancedScanResultConsumer consumer, TableN
} else {
this.scanMetrics = null;
}
+
+ /*
+ * Assumes that the `start()` method is called immediately after
construction. If this is no
Review comment:
Good.
--
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]