You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2018/06/16 06:52:30 UTC

[kylin] branch v2.4.0-release updated (6d8892d -> 89f3ce7)

This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a change to branch v2.4.0-release
in repository https://gitbox.apache.org/repos/asf/kylin.git.


    from 6d8892d  KYLIN-3404 The last optimized time not showing up on cube planner tab
     new efe0a07  KYLIN-3386 adjust TopN measure validation code
     new 111cb28  KYLIN-3400 wipeCache and createCubeDesc make deadlock
     new b7d0e47  KYLIN-3408 update web links from front end
     new 89f3ce7  Revert "KYLIN-3250 Upgrade jetty version to 9.3.22.v20171030"

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/resources/kylin-defaults.properties   | 16 ++---
 .../org/apache/kylin/cube/CubeDescManager.java     |  2 +-
 .../java/org/apache/kylin/cube/CubeManager.java    | 22 ++++---
 .../cube/model/validation/rule/FunctionRule.java   | 24 --------
 .../apache/kylin/measure/topn/TopNMeasureType.java |  4 ++
 .../kylin/metadata/TableMetadataManager.java       | 22 +++----
 .../kylin/metadata/project/ProjectL2Cache.java     |  4 ++
 .../kylin/metadata/project/ProjectManager.java     | 68 ++++++++++++----------
 .../template/cube_desc/kylin_sales_cube.json       |  4 +-
 pom.xml                                            |  2 +-
 .../apache/kylin/rest/service/CacheService.java    |  2 +-
 .../kylin/rest/service/AdminServiceTest.java       | 10 ++--
 12 files changed, 87 insertions(+), 93 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
shaofengshi@apache.org.

[kylin] 04/04: Revert "KYLIN-3250 Upgrade jetty version to 9.3.22.v20171030"

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch v2.4.0-release
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 89f3ce7a828d1e04c11fcc8dcde3bf6cb8b6c169
Author: shaofengshi <sh...@apache.org>
AuthorDate: Sat Jun 16 14:14:30 2018 +0800

    Revert "KYLIN-3250 Upgrade jetty version to 9.3.22.v20171030"
    
    This reverts commit 999f1f0089baf41bf4e3b546abe0af6384ab1b25.
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index bfcbcb2..54ef7eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,7 +90,7 @@
         <mrunit.version>1.1.0</mrunit.version>
         <dbunit.version>2.5.4</dbunit.version>
         <h2.version>1.4.196</h2.version>
-        <jetty.version>9.3.22.v20171030</jetty.version>
+        <jetty.version>9.2.20.v20161216</jetty.version>
         <jamm.version>0.3.1</jamm.version>
         <mockito.version>2.7.14</mockito.version>
         <powermock.version>1.7.0</powermock.version>

-- 
To stop receiving notification emails like this one, please contact
shaofengshi@apache.org.

[kylin] 03/04: KYLIN-3408 update web links from front end

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch v2.4.0-release
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit b7d0e4786ca90e74cfbf33a8661f4404b8214ac3
Author: shaofengshi <sh...@apache.org>
AuthorDate: Sat Jun 16 14:13:17 2018 +0800

    KYLIN-3408 update web links from front end
---
 core-common/src/main/resources/kylin-defaults.properties | 16 ++++++++--------
 .../sample_cube/template/cube_desc/kylin_sales_cube.json |  4 +++-
 .../org/apache/kylin/rest/service/AdminServiceTest.java  | 10 +++++-----
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/core-common/src/main/resources/kylin-defaults.properties b/core-common/src/main/resources/kylin-defaults.properties
index 37520ef..a69f4ea 100644
--- a/core-common/src/main/resources/kylin-defaults.properties
+++ b/core-common/src/main/resources/kylin-defaults.properties
@@ -66,11 +66,11 @@ kylin.engine.default=2
 kylin.storage.default=2
 kylin.web.hive-limit=20
 kylin.web.help.length=4
-kylin.web.help.0=start|Getting Started|http://kylin.apache.org/docs21/tutorial/kylin_sample.html
-kylin.web.help.1=odbc|ODBC Driver|http://kylin.apache.org/docs21/tutorial/odbc.html
-kylin.web.help.2=tableau|Tableau Guide|http://kylin.apache.org/docs21/tutorial/tableau_91.html
-kylin.web.help.3=onboard|Cube Design Tutorial|http://kylin.apache.org/docs21/howto/howto_optimize_cubes.html
-kylin.web.link-streaming-guide=http://kylin.apache.org/
+kylin.web.help.0=start|Getting Started|http://kylin.apache.org/docs/tutorial/kylin_sample.html
+kylin.web.help.1=odbc|ODBC Driver|http://kylin.apache.org/docs/tutorial/odbc.html
+kylin.web.help.2=tableau|Tableau Guide|http://kylin.apache.org/docs/tutorial/tableau_91.html
+kylin.web.help.3=onboard|Cube Design Tutorial|http://kylin.apache.org/docs/tutorial/create_cube.html
+kylin.web.link-streaming-guide=https://kylin.apache.org/docs/tutorial/cube_streaming.html
 kylin.htrace.show-gui-trace-toggle=false
 kylin.web.link-hadoop=
 kylin.web.link-diagnostic=
@@ -303,9 +303,9 @@ kylin.engine.spark-conf.spark.hadoop.yarn.timeline-service.enabled=false
 #kylin.engine.spark-conf.spark.io.compression.codec=org.apache.spark.io.SnappyCompressionCodec
 
 # uncomment for HDP
-#kylin.engine.spark-conf.spark.driver.extraJavaOptions=-Dhdp.version=current
-#kylin.engine.spark-conf.spark.yarn.am.extraJavaOptions=-Dhdp.version=current
-#kylin.engine.spark-conf.spark.executor.extraJavaOptions=-Dhdp.version=current
+kylin.engine.spark-conf.spark.driver.extraJavaOptions=-Dhdp.version=current
+kylin.engine.spark-conf.spark.yarn.am.extraJavaOptions=-Dhdp.version=current
+kylin.engine.spark-conf.spark.executor.extraJavaOptions=-Dhdp.version=current
 
 
 ### QUERY PUSH DOWN ###
diff --git a/examples/sample_cube/template/cube_desc/kylin_sales_cube.json b/examples/sample_cube/template/cube_desc/kylin_sales_cube.json
index 124fc73..230623f 100644
--- a/examples/sample_cube/template/cube_desc/kylin_sales_cube.json
+++ b/examples/sample_cube/template/cube_desc/kylin_sales_cube.json
@@ -275,7 +275,9 @@
   "engine_type" : %default_engine_type%,
   "storage_type" : %default_storage_type%,
   "override_kylin_properties" : {
-    "kylin.cube.aggrgroup.is-mandatory-only-valid" : "true"
+    "kylin.cube.aggrgroup.is-mandatory-only-valid" : "true",
+    "kylin.cube.size-estimate-ratio": "0.01",
+    "kylin.engine.spark.rdd-partition-cut-mb": "50"
   },
   "cuboid_black_list" : [ ],
   "parent_forward" : 3,
diff --git a/server/src/test/java/org/apache/kylin/rest/service/AdminServiceTest.java b/server/src/test/java/org/apache/kylin/rest/service/AdminServiceTest.java
index cc0421a..600897a 100644
--- a/server/src/test/java/org/apache/kylin/rest/service/AdminServiceTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/service/AdminServiceTest.java
@@ -49,7 +49,7 @@ public class AdminServiceTest extends ServiceTestBase {
         KylinConfig config = KylinConfig.createInstanceFromUri(path);
         try (SetAndUnsetThreadLocalConfig autoUnset = KylinConfig.setAndUnsetThreadLocalConfig(config)) {
         
-            String expected = "kylin.web.link-streaming-guide=http://kylin.apache.org/\n" +
+            String expected = "kylin.web.link-streaming-guide=https://kylin.apache.org/docs/tutorial/cube_streaming.html\n" +
                     "kylin.web.dashboard-enabled=\n" +
                     "kylin.web.contact-mail=\n" +
                     "kylin.query.cache-enabled=true\n" +
@@ -69,10 +69,10 @@ public class AdminServiceTest extends ServiceTestBase {
                     "kylin.env=QA\n" +
                     "kylin.web.hive-limit=20\n" +
                     "kylin.engine.default=2\n" +
-                    "kylin.web.help.3=onboard|Cube Design Tutorial|http://kylin.apache.org/docs21/howto/howto_optimize_cubes.html\n" +
-                    "kylin.web.help.2=tableau|Tableau Guide|http://kylin.apache.org/docs21/tutorial/tableau_91.html\n" +
-                    "kylin.web.help.1=odbc|ODBC Driver|http://kylin.apache.org/docs21/tutorial/odbc.html\n" +
-                    "kylin.web.help.0=start|Getting Started|http://kylin.apache.org/docs21/tutorial/kylin_sample.html\n" +
+                    "kylin.web.help.3=onboard|Cube Design Tutorial|http://kylin.apache.org/docs/tutorial/create_cube.html\n" +
+                    "kylin.web.help.2=tableau|Tableau Guide|http://kylin.apache.org/docs/tutorial/tableau_91.html\n" +
+                    "kylin.web.help.1=odbc|ODBC Driver|http://kylin.apache.org/docs/tutorial/odbc.html\n" +
+                    "kylin.web.help.0=start|Getting Started|http://kylin.apache.org/docs/tutorial/kylin_sample.html\n" +
                     "kylin.security.profile=testing\n";
             Assert.assertEquals(expected, adminService.getPublicConfig());
         }

-- 
To stop receiving notification emails like this one, please contact
shaofengshi@apache.org.

[kylin] 01/04: KYLIN-3386 adjust TopN measure validation code

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch v2.4.0-release
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit efe0a07a10698fe1006494d029c8b7da47bc1175
Author: Yifei Wu <va...@gmail.com>
AuthorDate: Mon Jan 29 19:06:47 2018 +0800

    KYLIN-3386 adjust TopN measure validation code
    
    Signed-off-by: shaofengshi <sh...@apache.org>
---
 .../cube/model/validation/rule/FunctionRule.java   | 24 ----------------------
 .../apache/kylin/measure/topn/TopNMeasureType.java |  4 ++++
 2 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/FunctionRule.java b/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/FunctionRule.java
index 36631ce..64179e9 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/FunctionRule.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/FunctionRule.java
@@ -26,18 +26,14 @@ import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.kylin.cube.model.CubeDesc;
-import org.apache.kylin.cube.model.DimensionDesc;
 import org.apache.kylin.cube.model.validation.IValidatorRule;
 import org.apache.kylin.cube.model.validation.ResultLevel;
 import org.apache.kylin.cube.model.validation.ValidateContext;
-import org.apache.kylin.measure.topn.TopNMeasureType;
 import org.apache.kylin.metadata.model.DataModelDesc;
 import org.apache.kylin.metadata.model.FunctionDesc;
 import org.apache.kylin.metadata.model.MeasureDesc;
 import org.apache.kylin.metadata.model.ParameterDesc;
 
-import com.google.common.collect.Lists;
-
 /**
  * Validate function parameter.
  * <p/>
@@ -105,26 +101,6 @@ public class FunctionRule implements IValidatorRule<CubeDesc> {
 
             if (func.isCount())
                 countFuncs.add(func);
-
-            if (TopNMeasureType.FUNC_TOP_N.equalsIgnoreCase(func.getExpression())) {
-                if (parameter.getNextParameter() == null) {
-                    context.addResult(ResultLevel.ERROR, "Must define at least 2 parameters for function " + func.getExpression() + " in " + measure.getName());
-                    return;
-                }
-
-                ParameterDesc groupByCol = parameter.getNextParameter();
-                List<String> duplicatedCol = Lists.newArrayList();
-                while (groupByCol != null) {
-                    String embeded_groupby = groupByCol.getValue();
-                    for (DimensionDesc dimensionDesc : cube.getDimensions()) {
-                        if (dimensionDesc.getColumn() != null && dimensionDesc.getColumn().equalsIgnoreCase(embeded_groupby)) {
-                            duplicatedCol.add(embeded_groupby);
-                        }
-                    }
-                    groupByCol = groupByCol.getNextParameter();
-                }
-
-            }
         }
 
         if (countFuncs.size() != 1) {
diff --git a/core-metadata/src/main/java/org/apache/kylin/measure/topn/TopNMeasureType.java b/core-metadata/src/main/java/org/apache/kylin/measure/topn/TopNMeasureType.java
index 6b4c5b7..d095596 100644
--- a/core-metadata/src/main/java/org/apache/kylin/measure/topn/TopNMeasureType.java
+++ b/core-metadata/src/main/java/org/apache/kylin/measure/topn/TopNMeasureType.java
@@ -97,6 +97,10 @@ public class TopNMeasureType extends MeasureType<TopNCounter<ByteArray>> {
 
     public void validate(FunctionDesc functionDesc) throws IllegalArgumentException {
         validate(functionDesc.getExpression(), functionDesc.getReturnDataType(), true);
+
+        if (functionDesc.getParameter() == null || functionDesc.getParameter().getNextParameter() == null) {
+            throw new IllegalArgumentException("Must define at least 2 parameters for function " + functionDesc.getExpression());
+        }
     }
 
     private void validate(String funcName, DataType dataType, boolean checkDataType) {

-- 
To stop receiving notification emails like this one, please contact
shaofengshi@apache.org.

[kylin] 02/04: KYLIN-3400 wipeCache and createCubeDesc make deadlock

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch v2.4.0-release
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 111cb284d04ddb7574a4630ee6a97b94e63a02e1
Author: shaofengshi <sh...@apache.org>
AuthorDate: Sat Jun 16 14:10:53 2018 +0800

    KYLIN-3400 wipeCache and createCubeDesc make deadlock
---
 .../org/apache/kylin/cube/CubeDescManager.java     |  2 +-
 .../java/org/apache/kylin/cube/CubeManager.java    | 22 ++++---
 .../kylin/metadata/TableMetadataManager.java       | 22 +++----
 .../kylin/metadata/project/ProjectL2Cache.java     |  4 ++
 .../kylin/metadata/project/ProjectManager.java     | 68 ++++++++++++----------
 .../apache/kylin/rest/service/CacheService.java    |  2 +-
 6 files changed, 66 insertions(+), 54 deletions(-)

diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeDescManager.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeDescManager.java
index 78c71b7..67c54f5 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/CubeDescManager.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeDescManager.java
@@ -152,7 +152,7 @@ public class CubeDescManager {
     }
     
     public CubeDesc reloadCubeDescQuietly(String name) {
-        try (AutoLock lock = descMapLock.lockForWrite()) {
+        try {
             return reloadCubeDescLocal(name);
         } catch (Exception e) {
             logger.error("Failed to reload CubeDesc " + name, e);
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java
index 3f4c576..fcec14e 100755
--- a/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java
@@ -32,7 +32,6 @@ import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import com.google.common.collect.Maps;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.common.persistence.JsonSerializer;
@@ -82,6 +81,7 @@ import org.slf4j.LoggerFactory;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 
 /**
@@ -205,18 +205,16 @@ public class CubeManager implements IRealizationProvider {
      * @return
      */
     public List<CubeInstance> getCubesByDesc(String descName) {
-        try (AutoLock lock = cubeMapLock.lockForRead()) {
-            List<CubeInstance> list = listAllCubes();
-            List<CubeInstance> result = new ArrayList<CubeInstance>();
-            Iterator<CubeInstance> it = list.iterator();
-            while (it.hasNext()) {
-                CubeInstance ci = it.next();
-                if (descName.equalsIgnoreCase(ci.getDescName())) {
-                    result.add(ci);
-                }
+        List<CubeInstance> list = listAllCubes();
+        List<CubeInstance> result = new ArrayList<CubeInstance>();
+        Iterator<CubeInstance> it = list.iterator();
+        while (it.hasNext()) {
+            CubeInstance ci = it.next();
+            if (descName.equalsIgnoreCase(ci.getDescName())) {
+                result.add(ci);
             }
-            return result;
         }
+        return result;
     }
 
     public CubeInstance createCube(String cubeName, String projectName, CubeDesc desc, String owner)
@@ -401,7 +399,7 @@ public class CubeManager implements IRealizationProvider {
         }
 
         //this is a duplicate call to take care of scenarios where REST cache service unavailable
-        ProjectManager.getInstance(cube.getConfig()).clearL2Cache();
+        ProjectManager.getInstance(config).clearL2Cache(cube.getProject());
 
         return cube;
     }
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/TableMetadataManager.java b/core-metadata/src/main/java/org/apache/kylin/metadata/TableMetadataManager.java
index 116e210..19adcb9 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/TableMetadataManager.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/TableMetadataManager.java
@@ -158,7 +158,7 @@ public class TableMetadataManager {
     }
 
     public List<TableDesc> listAllTables(String prj) {
-        try (AutoLock lock = srcTableMapLock.lockForWrite()) {
+        try (AutoLock lock = srcTableMapLock.lockForRead()) {
             return Lists.newArrayList(getAllTablesMap(prj).values());
         }
     }
@@ -166,22 +166,24 @@ public class TableMetadataManager {
     public Map<String, TableDesc> getAllTablesMap(String prj) {
         // avoid cyclic locks
         ProjectInstance project = (prj == null) ? null : ProjectManager.getInstance(config).getProject(prj);
-        
-        try (AutoLock lock = srcTableMapLock.lockForWrite()) {
-            //TODO prj == null case is now only used by test case and CubeMetaIngester
-            //should refactor these test case and tool ASAP and stop supporting null case
-            if (prj == null) {
-                Map<String, TableDesc> globalTables = new LinkedHashMap<>();
 
+        //TODO prj == null case is now only used by test case and CubeMetaIngester
+        //should refactor these test case and tool ASAP and stop supporting null case
+        if (prj == null) {
+            Map<String, TableDesc> globalTables = new LinkedHashMap<>();
+
+            try (AutoLock lock = srcTableMapLock.lockForRead()) {
                 for (TableDesc t : srcTableMap.values()) {
                     globalTables.put(t.getIdentity(), t);
                 }
-                return globalTables;
             }
+            return globalTables;
+        }
 
-            Set<String> prjTableNames = project.getTables();
+        Set<String> prjTableNames = project.getTables();
 
-            Map<String, TableDesc> ret = new LinkedHashMap<>();
+        Map<String, TableDesc> ret = new LinkedHashMap<>();
+        try (AutoLock lock = srcTableMapLock.lockForWrite()) {
             for (String tableName : prjTableNames) {
                 String tableIdentity = getTableIdentity(tableName);
                 ret.put(tableIdentity, getProjectSpecificTableDesc(tableIdentity, prj));
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectL2Cache.java b/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectL2Cache.java
index 1663c8d..cb31107 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectL2Cache.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectL2Cache.java
@@ -63,6 +63,10 @@ class ProjectL2Cache {
         projectCaches.clear();
     }
 
+    public void clear(String projectName) {
+        projectCaches.remove(projectName);
+    }
+
     public ExternalFilterDesc getExternalFilterDesc(String project, String extFilterName) {
         ProjectCache prjCache = getCache(project);
         return prjCache.extFilters.get(extFilterName);
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectManager.java b/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectManager.java
index aae692d..545875c 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectManager.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectManager.java
@@ -113,10 +113,16 @@ public class ProjectManager {
         }
     }
 
+    public void clearL2Cache(String projectName) {
+        l2Cache.clear(projectName);
+    }
+
+
     public void clearL2Cache() {
         l2Cache.clear();
     }
 
+    @Deprecated
     public void reloadProjectL2Cache(String project) {
         l2Cache.reloadCacheByProject(project);
     }
@@ -124,7 +130,7 @@ public class ProjectManager {
     public ProjectInstance reloadProjectQuietly(String project) throws IOException {
         try (AutoLock lock = prjMapLock.lockForWrite()) {
             ProjectInstance prj = crud.reloadQuietly(project);
-            reloadProjectL2Cache(project);
+            clearL2Cache(project);
             return prj;
         }
     }
@@ -157,17 +163,17 @@ public class ProjectManager {
 
     public ProjectInstance createProject(String projectName, String owner, String description,
             LinkedHashMap<String, String> overrideProps) throws IOException {
-        try (AutoLock lock = prjMapLock.lockForWrite()) {
-            logger.info("Creating project " + projectName);
 
-            ProjectInstance currentProject = getProject(projectName);
-            if (currentProject == null) {
-                currentProject = ProjectInstance.create(projectName, owner, description, overrideProps, null, null);
-            } else {
-                throw new IllegalStateException("The project named " + projectName + "already exists");
-            }
-            checkOverrideProps(currentProject);
+        ProjectInstance currentProject = getProject(projectName);
+        if (currentProject != null) {
+            throw new IllegalStateException("The project named " + projectName + "already exists");
+        }
+
+        currentProject = ProjectInstance.create(projectName, owner, description, overrideProps, null, null);
+        checkOverrideProps(currentProject);
 
+        try (AutoLock lock = prjMapLock.lockForWrite()) {
+            logger.info("Creating project " + projectName);
             return save(currentProject);
         }
     }
@@ -189,27 +195,27 @@ public class ProjectManager {
     }
 
     public ProjectInstance dropProject(String projectName) throws IOException {
-        try (AutoLock lock = prjMapLock.lockForWrite()) {
-            if (projectName == null)
-                throw new IllegalArgumentException("Project name not given");
+        if (projectName == null)
+            throw new IllegalArgumentException("Project name not given");
 
-            ProjectInstance projectInstance = getProject(projectName);
+        ProjectInstance projectInstance = getProject(projectName);
 
-            if (projectInstance == null) {
-                throw new IllegalStateException("The project named " + projectName + " does not exist");
-            }
+        if (projectInstance == null) {
+            throw new IllegalStateException("The project named " + projectName + " does not exist");
+        }
 
-            if (projectInstance.getRealizationCount(null) != 0) {
-                throw new IllegalStateException("The project named " + projectName
-                        + " can not be deleted because there's still realizations in it. Delete them first.");
-            }
+        if (projectInstance.getRealizationCount(null) != 0) {
+            throw new IllegalStateException("The project named " + projectName
+                    + " can not be deleted because there's still realizations in it. Delete them first.");
+        }
 
+        try (AutoLock lock = prjMapLock.lockForWrite()) {
             logger.info("Dropping project '" + projectInstance.getName() + "'");
 
             crud.delete(projectInstance);
             BadQueryHistoryManager.getInstance(config).removeBadQueryHistory(projectName);
 
-            clearL2Cache();
+            clearL2Cache(projectInstance.getName());
             return projectInstance;
         }
     }
@@ -217,8 +223,8 @@ public class ProjectManager {
     // update project itself
     public ProjectInstance updateProject(ProjectInstance project, String newName, String newDesc,
             LinkedHashMap<String, String> overrideProps) throws IOException {
+        Preconditions.checkArgument(project.getName().equals(newName));
         try (AutoLock lock = prjMapLock.lockForWrite()) {
-            Preconditions.checkArgument(project.getName().equals(newName));
             project.setName(newName);
             project.setDescription(newDesc);
             project.setOverrideKylinProps(overrideProps);
@@ -233,7 +239,7 @@ public class ProjectManager {
     public void removeProjectLocal(String proj) {
         try (AutoLock lock = prjMapLock.lockForWrite()) {
             projectMap.removeLocal(proj);
-            clearL2Cache();
+            clearL2Cache(proj);
         }
     }
 
@@ -252,8 +258,9 @@ public class ProjectManager {
     }
 
     public void removeModelFromProjects(String modelName) throws IOException {
+        final List<ProjectInstance> projects = findProjectsByModel(modelName);
         try (AutoLock lock = prjMapLock.lockForWrite()) {
-            for (ProjectInstance projectInstance : findProjectsByModel(modelName)) {
+            for (ProjectInstance projectInstance : projects) {
                 projectInstance.removeModel(modelName);
                 save(projectInstance);
             }
@@ -287,8 +294,9 @@ public class ProjectManager {
     }
 
     public void removeRealizationsFromProjects(RealizationType type, String realizationName) throws IOException {
+        final List<ProjectInstance> projects = findProjects(type, realizationName);
         try (AutoLock lock = prjMapLock.lockForWrite()) {
-            for (ProjectInstance projectInstance : findProjects(type, realizationName)) {
+            for (ProjectInstance projectInstance : projects) {
                 projectInstance.removeRealization(type, realizationName);
                 save(projectInstance);
             }
@@ -358,7 +366,7 @@ public class ProjectManager {
     
     private ProjectInstance save(ProjectInstance prj) throws IOException {
         crud.save(prj);
-        clearL2Cache();
+        clearL2Cache(prj.getName());
         return prj;
     }
 
@@ -373,7 +381,7 @@ public class ProjectManager {
     }
 
     public List<ProjectInstance> findProjects(RealizationType type, String realizationName) {
-        try (AutoLock lock = prjMapLock.lockForWrite()) {
+        try (AutoLock lock = prjMapLock.lockForRead()) {
             List<ProjectInstance> result = Lists.newArrayList();
             for (ProjectInstance prj : projectMap.values()) {
                 for (RealizationEntry entry : prj.getRealizationEntries()) {
@@ -388,7 +396,7 @@ public class ProjectManager {
     }
 
     public List<ProjectInstance> findProjectsByModel(String modelName) {
-        try (AutoLock lock = prjMapLock.lockForWrite()) {
+        try (AutoLock lock = prjMapLock.lockForRead()) {
             List<ProjectInstance> projects = new ArrayList<ProjectInstance>();
             for (ProjectInstance projectInstance : projectMap.values()) {
                 if (projectInstance.containsModel(modelName)) {
@@ -400,7 +408,7 @@ public class ProjectManager {
     }
 
     public List<ProjectInstance> findProjectsByTable(String tableIdentity) {
-        try (AutoLock lock = prjMapLock.lockForWrite()) {
+        try (AutoLock lock = prjMapLock.lockForRead()) {
             List<ProjectInstance> projects = new ArrayList<ProjectInstance>();
             for (ProjectInstance projectInstance : projectMap.values()) {
                 if (projectInstance.containsTable(tableIdentity)) {
diff --git a/server-base/src/main/java/org/apache/kylin/rest/service/CacheService.java b/server-base/src/main/java/org/apache/kylin/rest/service/CacheService.java
index 10ab90b..4fc0913 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/CacheService.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/CacheService.java
@@ -161,7 +161,7 @@ public class CacheService extends BasicService implements InitializingBean {
         logger.info("reload cube cache done");
 
         //reload project l2cache again after cube cache, because the project L2 cache relay on latest cube cache
-        getProjectManager().reloadProjectL2Cache(project);
+        getProjectManager().clearL2Cache(project);
         logger.info("reload project l2cache done");
     }
 

-- 
To stop receiving notification emails like this one, please contact
shaofengshi@apache.org.