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

commit de86ed61271e1cddb98ddfb29639f757823f0b2a
Author: Zhong <nju_y...@apache.org>
AuthorDate: Tue Oct 23 19:47:57 2018 +0800

    KYLIN-2898 If a distributed cache is adopted, small query results are also 
better to be put into the cache.
---
 server-base/pom.xml                                                   | 4 ++++
 .../src/main/java/org/apache/kylin/rest/service/QueryService.java     | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/server-base/pom.xml b/server-base/pom.xml
index 0a09b43..4454881 100644
--- a/server-base/pom.xml
+++ b/server-base/pom.xml
@@ -72,6 +72,10 @@
             <groupId>org.apache.kylin</groupId>
             <artifactId>kylin-source-kafka</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.kylin</groupId>
+            <artifactId>kylin-cache</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>net.sf.ehcache</groupId>
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 78068eb..d8e397e 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
@@ -62,6 +62,7 @@ import org.apache.commons.pool2.PooledObject;
 import org.apache.commons.pool2.impl.DefaultPooledObject;
 import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
 import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig;
+import org.apache.kylin.cache.cachemanager.MemcachedCacheManager;
 import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.common.QueryContext;
 import org.apache.kylin.common.QueryContextFacade;
@@ -479,7 +480,8 @@ public class QueryService extends BasicService {
                                     && (isSelect == false || 
kylinConfig.isPushdownQueryCacheEnabled() == false)),
                             "query is executed with pushdown, but it is 
non-select, or the cache for pushdown is disabled") //
                     && checkCondition(
-                            sqlResponse.getDuration() > durationThreshold
+                            cacheManager.getCache(QUERY_CACHE) instanceof 
MemcachedCacheManager.MemCachedCacheAdaptor
+                                    || sqlResponse.getDuration() > 
durationThreshold
                                     || sqlResponse.getTotalScanCount() > 
scanCountThreshold
                                     || sqlResponse.getTotalScanBytes() > 
scanBytesThreshold, //
                             "query is too lightweight with duration: {} 
(threshold {}), scan count: {} (threshold {}), scan bytes: {} (threshold {})",

Reply via email to