You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by "446463844@qq.com" <44...@qq.com> on 2017/09/28 07:17:16 UTC
query problem
Hi all :
there is a problem in querying result though kylin
I view the code in QueryService.java at kytlin
```
public SQLResponse doQueryWithCache(SQLRequest sqlRequest) {
// some code
SQLResponse sqlResponse = null;
boolean queryCacheEnabled = checkCondition(kylinConfig.isQueryCacheEnabled(),
"query cache disabled in KylinConfig") && //
checkCondition(!BackdoorToggles.getDisableCache(), "query cache disabled in BackdoorToggles");
if (queryCacheEnabled) {
sqlResponse = searchQueryInCache(sqlRequest);
}
try {
if (null == sqlResponse) {
sqlResponse = query(sqlRequest);
long durationThreshold = kylinConfig.getQueryDurationCacheThreshold();
long scanCountThreshold = kylinConfig.getQueryScanCountCacheThreshold();
long scanBytesThreshold = kylinConfig.getQueryScanBytesCacheThreshold();
sqlResponse.setDuration(System.currentTimeMillis() - startTime);
logger.info("Stats of SQL response: isException: {}, duration: {}, total scan count {}", //
String.valueOf(sqlResponse.getIsException()), String.valueOf(sqlResponse.getDuration()),
String.valueOf(sqlResponse.getTotalScanCount()));
if (checkCondition(queryCacheEnabled, "query cache is disabled") //
&& checkCondition(!sqlResponse.getIsException(), "query has exception") //
&& checkCondition(
sqlResponse.getDuration() > durationThreshold
|| sqlResponse.getTotalScanCount() > scanCountThreshold
|| sqlResponse.getTotalScanBytes() > scanBytesThreshold, //
"query is too lightweight with duration: {} (threshold {}), scan count: {} (threshold {}), scan bytes: {} (threshold {})",
sqlResponse.getDuration(), durationThreshold, sqlResponse.getTotalScanCount(),
scanCountThreshold, sqlResponse.getTotalScanBytes(), scanBytesThreshold)
&& checkCondition(sqlResponse.getResults().size() < kylinConfig.getLargeQueryThreshold(),
"query response is too large: {} ({})", sqlResponse.getResults().size(),
kylinConfig.getLargeQueryThreshold())) {
cacheManager.getCache(SUCCESS_QUERY_CACHE)
.put(new Element(sqlRequest.getCacheKey(), sqlResponse));
}
```
I find that set the prop 'kylin.query.cache-enabled=true' .then all the query though kylin will be cached
but I send same query twice last day and found that query do htable scanning every time.
this is conflict with the code.
why?
best wishes!
446463844@qq.com