You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2018/10/17 07:10:18 UTC

[kylin] branch master updated: KYLIN-3632 Add configuration that can switch on/off preparedStatement cache in Kylin server

This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/master by this push:
     new fb0ea36  KYLIN-3632 Add configuration that can switch on/off preparedStatement cache in Kylin server
fb0ea36 is described below

commit fb0ea363ebdc6a7e44ff37b609af273e0dd3e842
Author: Ma,Gang <ga...@ebay.com>
AuthorDate: Mon Oct 15 13:30:17 2018 +0800

    KYLIN-3632 Add configuration that can switch on/off preparedStatement cache in Kylin server
---
 .../src/main/java/org/apache/kylin/common/KylinConfigBase.java        | 4 ++++
 .../src/main/java/org/apache/kylin/rest/service/QueryService.java     | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java b/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
index 386a73c..e54d722 100644
--- a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
+++ b/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
@@ -1457,6 +1457,10 @@ abstract public class KylinConfigBase implements Serializable {
         return Integer.parseInt(this.getOptional("kylin.query.statement-cache-max-num-per-key", String.valueOf(50)));
     }
 
+    public boolean isQueryPreparedStatementCacheEnable() {
+        return Boolean.parseBoolean(this.getOptional("kylin.query.statement-cache-enabled", TRUE));
+    }
+
     public int getDimCountDistinctMaxCardinality() {
         return Integer.parseInt(getOptional("kylin.query.max-dimension-count-distinct", "5000000"));
     }
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 df0f0a7..8262472 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
@@ -587,7 +587,7 @@ public class QueryService extends BasicService {
                 long prjLastModifyTime = getProjectManager().getProject(sqlRequest.getProject()).getLastModified();
                 preparedContextKey = new PreparedContextKey(sqlRequest.getProject(), prjLastModifyTime, correctedSql);
                 PrepareSqlRequest prepareSqlRequest = (PrepareSqlRequest) sqlRequest;
-                if (prepareSqlRequest.isEnableStatementCache()) {
+                if (getConfig().isQueryPreparedStatementCacheEnable() && prepareSqlRequest.isEnableStatementCache()) {
                     try {
                         preparedContext = preparedContextPool.borrowObject(preparedContextKey);
                         borrowPrepareContext = true;