kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaofeng...@apache.org
Subject incubator-kylin git commit: KYLIN-867 fix a NPE in CacheServiceTest
Date Wed, 08 Jul 2015 10:02:42 GMT
Repository: incubator-kylin
Updated Branches:
  refs/heads/0.8 5e7c23505 -> 9b2848c99


KYLIN-867 fix a NPE in CacheServiceTest

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

Branch: refs/heads/0.8
Commit: 9b2848c99280b09ec7381305e9d28243a4d9dd9a
Parents: 5e7c235
Author: shaofengshi <shaofengshi@apache.org>
Authored: Wed Jul 8 18:02:32 2015 +0800
Committer: shaofengshi <shaofengshi@apache.org>
Committed: Wed Jul 8 18:02:32 2015 +0800

----------------------------------------------------------------------
 .../test_kylin_cube_without_slr_desc.json          |  2 +-
 .../apache/kylin/rest/service/CacheService.java    |  5 ++++-
 .../org/apache/kylin/rest/service/CubeService.java |  4 ++--
 .../kylin/rest/service/CacheServiceTest.java       | 17 +++++++++++++++++
 .../kylin/storage/hybrid/HybridInstance.java       |  2 +-
 5 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/9b2848c9/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_desc.json
----------------------------------------------------------------------
diff --git a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_desc.json
b/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_desc.json
index 14e0555..567a099 100644
--- a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_desc.json
+++ b/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_desc.json
@@ -172,7 +172,7 @@
       "dictionary" : "true",
       "mandatory" : false
     } ],
-    "aggregation_groups" : [ [ "lstg_format_name", "lstg_site_id", "slr_segment_cd" ], [
"leaf_categ_id", "meta_categ_name", "categ_lvl3_name", "categ_lvl2_name", ] ]
+    "aggregation_groups" : [ [ "lstg_format_name", "lstg_site_id", "slr_segment_cd" ], [
"leaf_categ_id", "meta_categ_name", "categ_lvl3_name", "categ_lvl2_name" ] ]
   },
   "last_modified" : 1422435345362,
   "model_name" : "test_kylin_inner_join_model_desc",

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/9b2848c9/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 ba3f990..14f0a43 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
@@ -49,7 +49,6 @@ public class CacheService extends BasicService {
     @Autowired
     private CacheUpdater cacheUpdater;
 
-
     @Autowired
     private CubeService cubeService;
 
@@ -63,6 +62,10 @@ public class CacheService extends BasicService {
         AbstractRestCache.setCacheUpdater(cacheUpdater);
     }
 
+    public void setCubeService(CubeService cubeService) {
+        this.cubeService = cubeService;
+    }
+
     private static final Logger logger = LoggerFactory.getLogger(CacheService.class);
 
     public void rebuildCache(Broadcaster.TYPE cacheType, String cacheKey) {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/9b2848c9/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 7ec210c..43ecfd5 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
@@ -76,7 +76,7 @@ public class CubeService extends BasicService {
 
     private static final Logger logger = LoggerFactory.getLogger(CubeService.class);
 
-    private static WeakHashMap<String, HBaseResponse> htableInfoCache = new WeakHashMap<>();
+    private WeakHashMap<String, HBaseResponse> htableInfoCache = new WeakHashMap<>();
 
     @Autowired
     private AccessService accessService;
@@ -580,7 +580,7 @@ public class CubeService extends BasicService {
             CubeSegment newSeg;
             CubeInstance cube = getCubeManager().getCube(cubeName);
             if (cube.needAutoMerge()) {
-                synchronized (CacheService.class) {
+                synchronized (CubeService.class) {
                     try {
                         newSeg = getCubeManager().autoMergeCubeSegments(cube);
                         if (newSeg != null) {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/9b2848c9/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java b/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java
index 9f1549e..8860d22 100644
--- a/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java
@@ -86,8 +86,25 @@ public class CacheServiceTest extends LocalFileMetadataTestCase {
             }
         };
 
+
+        final CubeService cubeServiceA = new CubeService() {
+            @Override
+            public KylinConfig getConfig() {
+                return configA;
+            }
+        };
+        final CubeService cubeServiceB = new CubeService() {
+            @Override
+            public KylinConfig getConfig() {
+                return configB;
+            }
+        };
+
+
         serviceA.initCacheUpdater(new RemoteCacheUpdater());
+        serviceA.setCubeService(cubeServiceA);
         serviceB.initCacheUpdater(new RemoteCacheUpdater());
+        serviceB.setCubeService(cubeServiceB);
 
         context.addServlet(new ServletHolder(new BroadcasterReceiveServlet(new BroadcasterReceiveServlet.BroadcasterHandler()
{
             @Override

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/9b2848c9/storage/src/main/java/org/apache/kylin/storage/hybrid/HybridInstance.java
----------------------------------------------------------------------
diff --git a/storage/src/main/java/org/apache/kylin/storage/hybrid/HybridInstance.java b/storage/src/main/java/org/apache/kylin/storage/hybrid/HybridInstance.java
index d1f5700..fee3bab 100644
--- a/storage/src/main/java/org/apache/kylin/storage/hybrid/HybridInstance.java
+++ b/storage/src/main/java/org/apache/kylin/storage/hybrid/HybridInstance.java
@@ -70,7 +70,7 @@ public class HybridInstance extends RootPersistentEntity implements IRealization
             for (int i = 0; i < realizationEntries.size(); i++) {
                 IRealization realization = registry.getRealization(realizationEntries.get(i).getType(),
realizationEntries.get(i).getRealization());
                 if (realization == null) {
-                    logger.error("Realization '" + realization.getName() + " is not found,
remove from Hybrid '" + this.getName() + "'");
+                    logger.error("Realization '" + realizationEntries.get(i) + " is not found,
remove from Hybrid '" + this.getName() + "'");
                     continue;
                 }
                 if (realization.isReady() == false) {


Mime
View raw message