This is an automated email from the ASF dual-hosted git repository.
larsh pushed a commit to branch 4.x-HBase-1.4
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.x-HBase-1.4 by this push:
new e48e208 PHOENIX-5106 Avoid getting an explain plan for each query
(even without tracing).
e48e208 is described below
commit e48e2087df7ccb83401376ea0fb460410f109642
Author: Lars Hofhansl <[email protected]>
AuthorDate: Wed Jan 30 15:40:33 2019 -0800
PHOENIX-5106 Avoid getting an explain plan for each query (even without
tracing).
---
.../main/java/org/apache/phoenix/execute/BaseQueryPlan.java | 10 ++++++----
.../src/main/java/org/apache/phoenix/trace/util/Tracing.java | 7 +++++++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git
a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
index 25980b9..55dbfae 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
@@ -367,10 +367,12 @@ public abstract class BaseQueryPlan implements QueryPlan {
}
// wrap the iterator so we start/end tracing as we expect
- TraceScope scope =
- Tracing.startNewSpan(context.getConnection(), "Creating basic
query for "
- + getPlanSteps(iterator));
- return (scope.getSpan() != null) ? new TracingIterator(scope,
iterator) : iterator;
+ if (Tracing.isTracing()) {
+ TraceScope scope = Tracing.startNewSpan(context.getConnection(),
+ "Creating basic query for " + getPlanSteps(iterator));
+ if (scope.getSpan() != null) return new TracingIterator(scope,
iterator);
+ }
+ return iterator;
}
private void serializeIndexMaintainerIntoScan(Scan scan, PTable dataTable)
throws SQLException {
diff --git
a/phoenix-core/src/main/java/org/apache/phoenix/trace/util/Tracing.java
b/phoenix-core/src/main/java/org/apache/phoenix/trace/util/Tracing.java
index 35cc6dc..616ad30 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/trace/util/Tracing.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/trace/util/Tracing.java
@@ -300,4 +300,11 @@ public class Tracing {
}
}
+ /**
+ * Check whether tracing is generally enabled.
+ * @return true If tracing is enabled, false otherwise
+ */
+ public static boolean isTracing() {
+ return Trace.isTracing();
+ }
}