You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ma...@apache.org on 2015/07/03 08:57:09 UTC
[3/3] incubator-kylin git commit: KYLIN-865 correct wrong static
field autowiring
KYLIN-865 correct wrong static field autowiring
Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/63312373
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/63312373
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/63312373
Branch: refs/heads/0.8
Commit: 6331237320e547f09cc21727038a55c28197180c
Parents: 96b9aac
Author: honma <ho...@ebay.com>
Authored: Fri Jul 3 13:34:29 2015 +0800
Committer: honma <ho...@ebay.com>
Committed: Fri Jul 3 14:56:19 2015 +0800
----------------------------------------------------------------------
.../kylin/rest/controller/QueryController.java | 29 ++++++++------------
.../apache/kylin/rest/service/BasicService.java | 13 +++++++--
.../apache/kylin/rest/service/CacheService.java | 4 +--
.../apache/kylin/rest/service/CubeService.java | 6 ----
.../kylin/rest/service/ServiceTestBase.java | 1 -
5 files changed, 23 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/63312373/server/src/main/java/org/apache/kylin/rest/controller/QueryController.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/kylin/rest/controller/QueryController.java b/server/src/main/java/org/apache/kylin/rest/controller/QueryController.java
index 1945041..ca27b20 100644
--- a/server/src/main/java/org/apache/kylin/rest/controller/QueryController.java
+++ b/server/src/main/java/org/apache/kylin/rest/controller/QueryController.java
@@ -18,20 +18,11 @@
package org.apache.kylin.rest.controller;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-import javax.servlet.http.HttpServletResponse;
-
+import com.codahale.metrics.annotation.Timed;
+import com.google.common.base.Preconditions;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
-
import org.apache.commons.io.IOUtils;
import org.apache.kylin.common.KylinConfig;
import org.apache.kylin.common.debug.BackdoorToggles;
@@ -57,17 +48,19 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
import org.supercsv.io.CsvListWriter;
import org.supercsv.io.ICsvListWriter;
import org.supercsv.prefs.CsvPreference;
-import com.codahale.metrics.annotation.Timed;
-import com.google.common.base.Preconditions;
+import javax.annotation.PostConstruct;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
/**
* Handle query requests.
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/63312373/server/src/main/java/org/apache/kylin/rest/service/BasicService.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/kylin/rest/service/BasicService.java b/server/src/main/java/org/apache/kylin/rest/service/BasicService.java
index 272007f..23705da 100644
--- a/server/src/main/java/org/apache/kylin/rest/service/BasicService.java
+++ b/server/src/main/java/org/apache/kylin/rest/service/BasicService.java
@@ -66,7 +66,7 @@ public abstract class BasicService {
private static ConcurrentMap<String, DataSource> olapDataSources = new ConcurrentHashMap<String, DataSource>();
@Autowired
- private static CacheManager cacheManager;
+ private CacheManager cacheManager;
// @Autowired
// protected JdbcTemplate jdbcTemplate;
@@ -77,13 +77,20 @@ public abstract class BasicService {
protected void cleanDataCache(String storageUUID) {
if (cacheManager != null && cacheManager.getCache(storageUUID) != null) {
+ logger.info("cleaning cache for " + storageUUID);
cacheManager.getCache(storageUUID).removeAll();
+ } else {
+ logger.warn("skip cleaning cache for " + storageUUID);
}
}
- public static void cleanAllDataCache() {
- if (cacheManager != null)
+ protected void cleanAllDataCache() {
+ if (cacheManager != null) {
+ logger.warn("cleaning all storage cache");
cacheManager.clearAll();
+ } else {
+ logger.warn("skip cleaning all storage cache");
+ }
}
public void removeOLAPDataSource(String project) {
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/63312373/server/src/main/java/org/apache/kylin/rest/service/CacheService.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/kylin/rest/service/CacheService.java b/server/src/main/java/org/apache/kylin/rest/service/CacheService.java
index 57e469a..d20751f 100644
--- a/server/src/main/java/org/apache/kylin/rest/service/CacheService.java
+++ b/server/src/main/java/org/apache/kylin/rest/service/CacheService.java
@@ -75,7 +75,7 @@ public class CacheService extends BasicService {
getProjectManager().clearL2Cache();
//clean query related cache first
super.cleanDataCache(newCube.getUuid());
- //move this logic to other place
+ //TODO: move this logic to other place
mergeCubeOnNewSegmentReady(cacheKey);
break;
case CUBE_DESC:
@@ -111,7 +111,7 @@ public class CacheService extends BasicService {
IIManager.clearCache();
RealizationRegistry.clearCache();
ProjectManager.clearCache();
- BasicService.cleanAllDataCache();
+ super.cleanAllDataCache();
BasicService.removeAllOLAPDataSources();
break;
default:
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/63312373/server/src/main/java/org/apache/kylin/rest/service/CubeService.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/kylin/rest/service/CubeService.java b/server/src/main/java/org/apache/kylin/rest/service/CubeService.java
index f4f237b..e771350 100644
--- a/server/src/main/java/org/apache/kylin/rest/service/CubeService.java
+++ b/server/src/main/java/org/apache/kylin/rest/service/CubeService.java
@@ -313,9 +313,6 @@ public class CubeService extends BasicService {
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#cube, 'ADMINISTRATION') or hasPermission(#cube, 'OPERATION') or hasPermission(#cube, 'MANAGEMENT')")
public CubeInstance purgeCube(CubeInstance cube) throws IOException, JobException {
- //clean query related cache first
- super.cleanDataCache(cube.getUuid());
-
String cubeName = cube.getName();
RealizationStatusEnum ostatus = cube.getStatus();
if (null != ostatus && !RealizationStatusEnum.DISABLED.equals(ostatus)) {
@@ -341,9 +338,6 @@ public class CubeService extends BasicService {
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#cube, 'ADMINISTRATION') or hasPermission(#cube, 'OPERATION') or hasPermission(#cube, 'MANAGEMENT')")
public CubeInstance disableCube(CubeInstance cube) throws IOException, JobException {
- //clean query related cache first
- super.cleanDataCache(cube.getUuid());
-
String cubeName = cube.getName();
RealizationStatusEnum ostatus = cube.getStatus();
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/63312373/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java b/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java
index c2ba897..1645c7a 100644
--- a/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java
+++ b/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java
@@ -65,7 +65,6 @@ public class ServiceTestBase extends LocalFileMetadataTestCase {
IIManager.clearCache();
RealizationRegistry.clearCache();
ProjectManager.clearCache();
- BasicService.cleanAllDataCache();
BasicService.removeAllOLAPDataSources();
}