You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ni...@apache.org on 2020/05/06 05:53:09 UTC

[kylin] 02/04: KYLIN-4406 QueryRequestLimits limit should consider the queries hit/wait cache

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

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

commit d3788e08a20b61cf981b7949c3a204d7aaf1a415
Author: Ma Gang <mg...@163.com>
AuthorDate: Tue Mar 10 12:04:04 2020 +0800

    KYLIN-4406 QueryRequestLimits limit should consider the queries hit/wait cache
---
 .../apache/kylin/rest/service/QueryService.java    | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

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 652cbfc..de101d9 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
@@ -421,22 +421,22 @@ public class QueryService extends BasicService {
             sql = result.getSecond();
             sqlRequest.setSql(sql);
 
-            // try some cheap executions
-            if (sqlResponse == null && isQueryInspect) {
-                sqlResponse = new SQLResponse(null, null, 0, false, sqlRequest.getSql());
-            }
+            try (QueryRequestLimits limit = new QueryRequestLimits(sqlRequest.getProject())) {
+                // try some cheap executions
+                if (sqlResponse == null && isQueryInspect) {
+                    sqlResponse = new SQLResponse(null, null, 0, false, sqlRequest.getSql());
+                }
 
-            if (sqlResponse == null && isCreateTempStatement) {
-                sqlResponse = new SQLResponse(null, null, 0, false, null);
-            }
+                if (sqlResponse == null && isCreateTempStatement) {
+                    sqlResponse = new SQLResponse(null, null, 0, false, null);
+                }
 
-            if (sqlResponse == null && isQueryCacheEnabled) {
-                sqlResponse = searchQueryInCache(sqlRequest);
-            }
+                if (sqlResponse == null && isQueryCacheEnabled) {
+                    sqlResponse = searchQueryInCache(sqlRequest);
+                }
 
-            // real execution if required
-            if (sqlResponse == null) {
-                try (QueryRequestLimits limit = new QueryRequestLimits(sqlRequest.getProject())) {
+                // real execution if required
+                if (sqlResponse == null) {
                     sqlResponse = queryAndUpdateCache(sqlRequest, isQueryCacheEnabled);
                 }
             }