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:
[email protected]


With regards,
Apache Git Services

Reply via email to