[ 
https://issues.apache.org/jira/browse/KYLIN-3632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653094#comment-16653094
 ] 

ASF GitHub Bot commented on KYLIN-3632:
---------------------------------------

shaofengshi closed pull request #290: KYLIN-3632 Add configuration that can 
switch on/off preparedStatement cache
URL: https://github.com/apache/kylin/pull/290
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 386a73ca6f..e54d72257b 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 @@ public int getQueryMaxCacheStatementInstancePerKey() {
         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 df0f0a79c4..82624723dd 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 @@ private SQLResponse queryWithSqlMassage(SQLRequest 
sqlRequest) throws Exception
                 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;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add configuration that can switch on/off preparedStatement cache in Kylin 
> server
> --------------------------------------------------------------------------------
>
>                 Key: KYLIN-3632
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3632
>             Project: Kylin
>          Issue Type: Improvement
>          Components: Query Engine
>            Reporter: Ma Gang
>            Assignee: Ma Gang
>            Priority: Minor
>             Fix For: v2.5.1
>
>
> From Kylin 2.5 we introduce preparedStatement cache feature, it can be turn 
> on/off for each request by adding a new field "enableStatementCache" in the 
> query request, by default it is on. We need to add a switch in server level, 
> the preparedStatement cache can take effective only when the switch is on, by 
> default, it will be set to false.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to