kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [11/25] incubator-kylin git commit: KYLIN-639 Get "Table 'xxxx' not found while executing SQL" error after a cube be successfully built
Date Sat, 21 Mar 2015 00:28:44 GMT
KYLIN-639 Get "Table 'xxxx' not found while executing SQL" error after a cube be successfully
built

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

Branch: refs/heads/master
Commit: 37f4132b6b72b5ab3074c35ae500a0bc7b2cba7d
Parents: fff81d3
Author: Shao Feng, Shi <shaoshi@ebay.com>
Authored: Fri Mar 13 23:08:57 2015 +0800
Committer: Shao Feng, Shi <shaoshi@ebay.com>
Committed: Fri Mar 13 23:08:57 2015 +0800

----------------------------------------------------------------------
 .../apache/kylin/common/restclient/Broadcaster.java   |  2 +-
 .../apache/kylin/metadata/project/ProjectManager.java |  2 +-
 .../org/apache/kylin/rest/service/BasicService.java   |  2 +-
 .../org/apache/kylin/rest/service/CacheService.java   | 14 ++++++++++++++
 4 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/37f4132b/common/src/main/java/org/apache/kylin/common/restclient/Broadcaster.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/kylin/common/restclient/Broadcaster.java b/common/src/main/java/org/apache/kylin/common/restclient/Broadcaster.java
index 7b56a03..4523431 100644
--- a/common/src/main/java/org/apache/kylin/common/restclient/Broadcaster.java
+++ b/common/src/main/java/org/apache/kylin/common/restclient/Broadcaster.java
@@ -57,7 +57,7 @@ public class Broadcaster {
             public void run() {
                 final String[] nodes = KylinConfig.getInstanceFromEnv().getRestServers();
                 if (nodes == null || nodes.length < 1) {//TODO if the node count is greater
than 1, it means it is a cluster
-                    logger.warn("there are no available rest servers, please check the KYLIN_REST_SERVERS
config");
+                    logger.info("There is no available rest server; check the 'kylin.rest.servers'
config");
                     return;
                 }
                 final List<RestClient> restClients = Lists.newArrayList();

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/37f4132b/metadata/src/main/java/org/apache/kylin/metadata/project/ProjectManager.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/kylin/metadata/project/ProjectManager.java
b/metadata/src/main/java/org/apache/kylin/metadata/project/ProjectManager.java
index 50b394c..33d0867 100644
--- a/metadata/src/main/java/org/apache/kylin/metadata/project/ProjectManager.java
+++ b/metadata/src/main/java/org/apache/kylin/metadata/project/ProjectManager.java
@@ -275,7 +275,7 @@ public class ProjectManager {
         clearL2Cache();
     }
 
-    private List<ProjectInstance> findProjects(RealizationType type, String realizationName)
{
+    public List<ProjectInstance> findProjects(RealizationType type, String realizationName)
{
         List<ProjectInstance> result = Lists.newArrayList();
         for (ProjectInstance prj : projectMap.values()) {
             for (RealizationEntry entry : prj.getRealizationEntries()) {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/37f4132b/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 2a5d287..c0f366d 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
@@ -88,7 +88,7 @@ public abstract class BasicService {
     public static void resetOLAPDataSources() {
         // brutal, yet simplest way
         logger.info("resetOLAPDataSources is called.");
-        olapDataSources = new ConcurrentHashMap<String, DataSource>();
+        olapDataSources.clear();
     }
 
     public DataSource getOLAPDataSource(String project) {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/37f4132b/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 7c7c014..e104897 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
@@ -23,10 +23,13 @@ import org.apache.kylin.cube.CubeDescManager;
 import org.apache.kylin.cube.CubeManager;
 import org.apache.kylin.invertedindex.IIDescManager;
 import org.apache.kylin.invertedindex.IIManager;
+import org.apache.kylin.metadata.project.ProjectInstance;
 import org.apache.kylin.metadata.project.ProjectManager;
+import org.apache.kylin.metadata.realization.RealizationType;
 import org.springframework.stereotype.Component;
 
 import java.io.IOException;
+import java.util.List;
 
 /**
  * Created by qianzhou on 1/19/15.
@@ -40,6 +43,7 @@ public class CacheService extends BasicService {
             switch (cacheType) {
                 case CUBE:
                     getCubeManager().loadCubeCache(cacheKey);
+                    cleanProjectCacheByRealization(RealizationType.CUBE, cacheKey);
                     break;
                 case CUBE_DESC:
                     getCubeDescManager().reloadCubeDesc(cacheKey);
@@ -49,6 +53,7 @@ public class CacheService extends BasicService {
                     break;
                 case INVERTED_INDEX:
                     getIIManager().loadIICache(cacheKey);
+                    cleanProjectCacheByRealization(RealizationType.INVERTED_INDEX, cacheKey);
                     break;
                 case INVERTED_INDEX_DESC:
                     getIIDescManager().reloadIIDesc(cacheKey);
@@ -70,6 +75,7 @@ public class CacheService extends BasicService {
                     IIDescManager.clearCache();
                     IIManager.clearCache();
                     ProjectManager.clearCache();
+                    BasicService.resetOLAPDataSources();
                     break;
                 default:
                     throw new RuntimeException("invalid cacheType:" + cacheType);
@@ -80,6 +86,14 @@ public class CacheService extends BasicService {
 
     }
 
+    private void cleanProjectCacheByRealization(RealizationType type, String realizationName)
throws IOException {
+        List<ProjectInstance> projectInstances = getProjectManager().findProjects(type,
realizationName);
+        for (ProjectInstance pi : projectInstances) {
+            getProjectManager().reloadProject(pi.getName());
+            removeOLAPDataSource(pi.getName());
+        }
+    }
+
     public void removeCache(Broadcaster.TYPE cacheType, String cacheKey) {
         final String log = "remove cache type: " + cacheType + " name:" + cacheKey;
         try {


Mime
View raw message