Skip to content

Commit

Permalink
PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ndimiduk committed Mar 14, 2022
1 parent 893f640 commit 46d6e8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ private void startScan(OpenScannerResponse resp) {
}

private CompletableFuture<OpenScannerResponse> openScanner(int replicaId) {
try (Scope ignored = span.makeCurrent()) {
final Span localSpan = span;
try (Scope ignored = localSpan.makeCurrent()) {
return conn.callerFactory.<OpenScannerResponse> single().table(tableName)
.row(scan.getStartRow()).replicaId(replicaId).locateType(getLocateType(scan))
.priority(scan.getPriority())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import org.apache.hadoop.hbase.io.TimeRange;
import org.apache.hadoop.hbase.util.FutureUtils;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.protobuf.RpcChannel;

/**
Expand All @@ -44,6 +46,7 @@
*/
@InterfaceAudience.Private
class AsyncTableImpl implements AsyncTable<ScanResultConsumer> {
private static final Logger logger = LoggerFactory.getLogger(AsyncTableImpl.class);

private final RawAsyncTableImpl rawTable;

Expand Down Expand Up @@ -236,6 +239,12 @@ private void scan0(Scan scan, ScanResultConsumer consumer) {
Span span = null;
try (AsyncTableResultScanner scanner = rawTable.getScanner(scan)) {
span = scanner.getSpan();
if (span == null) {
final String msg = "Breach of scan continuity detected. Parent span is not correct.";
logger.debug(msg);
span = Span.current(); // attach to whatever context we have
span.addEvent(msg);
}
try (Scope ignored = span.makeCurrent()) {
consumer.onScanMetricsCreated(scanner.getScanMetrics());
for (Result result; (result = scanner.next()) != null; ) {
Expand Down

0 comments on commit 46d6e8f

Please sign in to comment.