kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From luke...@apache.org
Subject [44/50] [abbrv] incubator-kylin git commit: fix cache issue
Date Thu, 15 Jan 2015 12:27:00 GMT
fix cache issue


Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/41095f08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/41095f08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/41095f08

Branch: refs/heads/inverted-index
Commit: 41095f08efd069d611af53f159e75462fad4c7d4
Parents: 4e88d7f
Author: qianhao.zhou <qianzhou@ebay.com>
Authored: Thu Jan 15 11:00:36 2015 +0800
Committer: qianhao.zhou <qianzhou@ebay.com>
Committed: Thu Jan 15 11:00:36 2015 +0800

----------------------------------------------------------------------
 .../kylinolap/invertedindex/IIDescManager.java  |  6 ++++-
 .../rest/controller/CacheController.java        | 24 ++++++++++----------
 .../kylinolap/rest/service/BasicService.java    |  5 ++++
 3 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/41095f08/invertedindex/src/main/java/com/kylinolap/invertedindex/IIDescManager.java
----------------------------------------------------------------------
diff --git a/invertedindex/src/main/java/com/kylinolap/invertedindex/IIDescManager.java b/invertedindex/src/main/java/com/kylinolap/invertedindex/IIDescManager.java
index bee55d2..8b0db25 100644
--- a/invertedindex/src/main/java/com/kylinolap/invertedindex/IIDescManager.java
+++ b/invertedindex/src/main/java/com/kylinolap/invertedindex/IIDescManager.java
@@ -111,7 +111,7 @@ public class IIDescManager {
         IIDesc ndesc = loadIIDesc(path);
 
         // Here replace the old one
-        iiDescMap.put(ndesc.getName(), ndesc);
+        iiDescMap.putLocal(ndesc.getName(), ndesc);
         return ndesc;
     }
 
@@ -166,6 +166,10 @@ public class IIDescManager {
         iiDescMap.remove(iiDesc.getName());
     }
 
+    public void removeIIDescLocal(String name) throws IOException {
+        iiDescMap.remove(name);
+    }
+
     private void reloadAllIIDesc() throws IOException {
         ResourceStore store = getStore();
         logger.info("Reloading all II desc from folder " + store.getReadableResourcePath(ResourceStore.II_DESC_RESOURCE_ROOT));

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/41095f08/server/src/main/java/com/kylinolap/rest/controller/CacheController.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/com/kylinolap/rest/controller/CacheController.java b/server/src/main/java/com/kylinolap/rest/controller/CacheController.java
index 4b62013..65fc235 100644
--- a/server/src/main/java/com/kylinolap/rest/controller/CacheController.java
+++ b/server/src/main/java/com/kylinolap/rest/controller/CacheController.java
@@ -28,7 +28,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import com.kylinolap.common.restclient.Broadcaster;
 import com.kylinolap.common.restclient.Broadcaster.EVENT;
-import com.kylinolap.metadata.MetadataConstances;
 import com.kylinolap.rest.service.CubeService;
 import com.kylinolap.rest.service.ProjectService;
 
@@ -66,7 +65,7 @@ public class CacheController extends BasicController {
         Broadcaster.TYPE wipeType = Broadcaster.TYPE.getType(type);
         EVENT wipeEvent = Broadcaster.EVENT.getEvent(event);
         final String log = "wipe cache type: " + wipeType + " event:" + wipeEvent + " name:"
+ name;
-        logger.debug(log);
+        logger.info(log);
         switch (wipeType) {
             case TABLE:
             switch (wipeEvent) {
@@ -89,11 +88,6 @@ public class CacheController extends BasicController {
             }
             break;
         case CUBE:
-            if ("ALL".equalsIgnoreCase(name.toUpperCase())) {
-                cubeMgmtService.cleanDataCache();
-                break;
-            }
-
             switch (wipeEvent) {
             case CREATE:
             case UPDATE:
@@ -104,12 +98,18 @@ public class CacheController extends BasicController {
                 break;
             }
             break;
-        case PROJECT:
-            if ("ALL".equalsIgnoreCase(name.toUpperCase())) {
-                projectService.cleanDataCache();
-                break;
+        case INVERTED_INDEX:
+            switch (wipeEvent) {
+                case CREATE:
+                case UPDATE:
+                    cubeMgmtService.getIIDescManager().reloadIIDesc(name);
+                    break;
+                case DROP:
+                    cubeMgmtService.getIIDescManager().removeIIDescLocal(name);
+                    break;
             }
-
+            break;
+        case PROJECT:
             switch (wipeEvent) {
             case CREATE:
             case UPDATE:

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/41095f08/server/src/main/java/com/kylinolap/rest/service/BasicService.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/com/kylinolap/rest/service/BasicService.java b/server/src/main/java/com/kylinolap/rest/service/BasicService.java
index 2db6e82..556ae40 100644
--- a/server/src/main/java/com/kylinolap/rest/service/BasicService.java
+++ b/server/src/main/java/com/kylinolap/rest/service/BasicService.java
@@ -23,6 +23,7 @@ import com.google.common.io.Files;
 import com.kylinolap.common.KylinConfig;
 import com.kylinolap.cube.CubeDescManager;
 import com.kylinolap.cube.CubeManager;
+import com.kylinolap.invertedindex.IIDescManager;
 import com.kylinolap.job.cube.CubingJob;
 import com.kylinolap.job.execution.ExecutableState;
 import com.kylinolap.job.impl.threadpool.AbstractExecutable;
@@ -161,6 +162,10 @@ public abstract class BasicService {
         return ExecutableManager.getInstance(getConfig());
     }
 
+    public final IIDescManager getIIDescManager() {
+        return IIDescManager.getInstance(getConfig());
+    }
+
     protected List<CubingJob> listAllCubingJobs(final String cubeName, final String
projectName, final Set<ExecutableState> statusList) {
         List<CubingJob> results = Lists.newArrayList(FluentIterable.from(getExecutableManager().getAllExecutables()).filter(new
Predicate<AbstractExecutable>() {
             @Override


Mime
View raw message