Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KYLIN-4667] Automatically set kylin.query.cache-signature-enabled to… #1540

Merged
merged 1 commit into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1960,8 +1960,12 @@ public boolean isQueryIgnoreUnknownFunction() {
return Boolean.parseBoolean(this.getOptional("kylin.query.ignore-unknown-function", FALSE));
}

public boolean isMemcachedEnabled() {
return !StringUtil.isEmpty(getMemCachedHosts());
}

public String getMemCachedHosts() {
return getRequired("kylin.cache.memcached.hosts");
return getOptional("kylin.cache.memcached.hosts", null);
}

public boolean isQuerySegmentCacheEnabled() {
Expand Down Expand Up @@ -2139,7 +2143,8 @@ public String getSQLResponseSignatureClass() {
}

public boolean isQueryCacheSignatureEnabled() {
return Boolean.parseBoolean(this.getOptional("kylin.query.cache-signature-enabled", FALSE));
return Boolean.parseBoolean(
this.getOptional("kylin.query.cache-signature-enabled", String.valueOf(isMemcachedEnabled())));
}

public int getFlatFilterMaxChildrenSize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.cache.CacheManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import net.sf.ehcache.CacheManager;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why chenge to another org.springframework.cache.CacheManager.CacheManager, could you please explain ?


/**
*/
Expand Down Expand Up @@ -121,7 +121,7 @@ public void cleanDataCache(String project) {
logger.info("cleaning cache for project " + project + " (currently remove nothing)");
} else {
logger.info("cleaning cache for project " + project + " (currently remove all entries)");
cacheManager.getCache(QueryService.QUERY_CACHE).removeAll();
cacheManager.getCache(QueryService.QUERY_CACHE).clear();
}
} else {
logger.warn("skip cleaning cache for project " + project);
Expand All @@ -131,7 +131,10 @@ public void cleanDataCache(String project) {
protected void cleanAllDataCache() {
if (cacheManager != null) {
logger.warn("cleaning all storage cache");
cacheManager.clearAll();
for (String cacheName : cacheManager.getCacheNames()) {
logger.warn("cleaning storage cache for {}", cacheName);
cacheManager.getCache(cacheName).clear();
}
} else {
logger.warn("skip cleaning all storage cache");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ private boolean isSegmentLevelCacheEnabled() {
return false;
}
try {
if (KylinConfig.getInstanceFromEnv().getMemCachedHosts() == null) {
if (!KylinConfig.getInstanceFromEnv().isMemcachedEnabled()) {
return false;
}
} catch (Exception e) {
Expand Down