You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2016/12/27 14:16:26 UTC
[10/12] kylin git commit: KYLIN-2318 bug fix
KYLIN-2318 bug fix
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/5c75380f
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/5c75380f
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/5c75380f
Branch: refs/heads/mhb-master
Commit: 5c75380f0d7bf873e07e7504ae4d407fa8a77f7c
Parents: 24db7c1
Author: Hongbin Ma <ma...@apache.org>
Authored: Tue Dec 27 12:47:08 2016 +0800
Committer: Hongbin Ma <ma...@apache.org>
Committed: Tue Dec 27 22:15:44 2016 +0800
----------------------------------------------------------------------
.../org/apache/kylin/common/debug/BackdoorToggles.java | 10 ++++++++++
.../java/org/apache/kylin/rest/service/QueryService.java | 1 +
2 files changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/5c75380f/core-common/src/main/java/org/apache/kylin/common/debug/BackdoorToggles.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/debug/BackdoorToggles.java b/core-common/src/main/java/org/apache/kylin/common/debug/BackdoorToggles.java
index 8109cf2..95d5d62 100644
--- a/core-common/src/main/java/org/apache/kylin/common/debug/BackdoorToggles.java
+++ b/core-common/src/main/java/org/apache/kylin/common/debug/BackdoorToggles.java
@@ -23,6 +23,8 @@ import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.kylin.common.util.Pair;
+import com.google.common.collect.Maps;
+
/**
* BackdoorToggles and QueryContext are similar because they're both hosting per-query thread local variables.
* The difference is that BackdoorToggles are specified by user input and work for debug purpose. QueryContext
@@ -38,6 +40,14 @@ public class BackdoorToggles {
_backdoorToggles.set(toggles);
}
+ public static void addToggles(Map<String, String> toggles) {
+ Map<String, String> map = _backdoorToggles.get();
+ if (map == null) {
+ setToggles(Maps.<String, String> newHashMap());
+ }
+ _backdoorToggles.get().putAll(toggles);
+ }
+
public static String getCoprocessorBehavior() {
return getString(DEBUG_TOGGLE_COPROCESSOR_BEHAVIOR);
}
http://git-wip-us.apache.org/repos/asf/kylin/blob/5c75380f/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java b/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
index bb0342f..de28b17 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
@@ -327,6 +327,7 @@ public class QueryService extends BasicService {
}
final String queryId = UUID.randomUUID().toString();
+ BackdoorToggles.addToggles(sqlRequest.getBackdoorToggles());
QueryContext.setQueryId(queryId);
try (SetThreadName ignored = new SetThreadName("Query %s", queryId)) {