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 2020/03/27 14:09:43 UTC
[kylin] branch master updated: KYLIN-3628 Fix the silently swallow
legit exceptions and reduce code duplication
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/master by this push:
new e16a4be KYLIN-3628 Fix the silently swallow legit exceptions and reduce code duplication
e16a4be is described below
commit e16a4beeaa1c2889c55356a5283f662e908f3122
Author: yaqian.zhang <59...@qq.com>
AuthorDate: Wed Mar 18 15:18:24 2020 +0800
KYLIN-3628 Fix the silently swallow legit exceptions and reduce code duplication
---
.../java/org/apache/kylin/cube/CubeManager.java | 24 ++--------------------
1 file changed, 2 insertions(+), 22 deletions(-)
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 be127c6..61e794e 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
@@ -47,7 +47,6 @@ import org.apache.kylin.common.util.RandomUtil;
import org.apache.kylin.cube.cuboid.Cuboid;
import org.apache.kylin.cube.model.CubeDesc;
import org.apache.kylin.cube.model.CubeDescTiretreeGlobalDomainDictUtil;
-import org.apache.kylin.cube.model.DimensionDesc;
import org.apache.kylin.cube.model.SnapshotTableDesc;
import org.apache.kylin.dict.DictionaryInfo;
import org.apache.kylin.dict.DictionaryManager;
@@ -1267,7 +1266,7 @@ public class CubeManager implements IRealizationProvider {
IRealization realization = registry.getRealization(entry.getType(), entry.getRealization());
if (realization != null && realization.isReady() && realization instanceof CubeInstance) {
CubeInstance current = (CubeInstance) realization;
- if (checkMeetSnapshotTable(current, lookupTableName)) {
+ if (current.getDescriptor().findDimensionByTable(lookupTableName) != null) {
CubeSegment segment = current.getLatestReadySegment();
if (segment != null) {
long latestBuildTime = segment.getLastBuildTime();
@@ -1282,6 +1281,7 @@ public class CubeManager implements IRealizationProvider {
}
} catch (Exception e) {
logger.info("Unexpected error.", e);
+ throw e;
}
if (!cubeInstance.equals(cube)) {
logger.debug("Picked cube {} over {} as it provides a more recent snapshot of the lookup table {}", cube,
@@ -1289,24 +1289,4 @@ public class CubeManager implements IRealizationProvider {
}
return cube == null ? cubeInstance : cube;
}
-
- /**
- * check if {toCheck} has snapshot of {lookupTableName}
- * @param lookupTableName look like {SCHMEA}.{TABLE}
- */
- private boolean checkMeetSnapshotTable(CubeInstance toCheck, String lookupTableName) {
- boolean checkRes = false;
- String lookupTbl = lookupTableName;
- String[] strArr = lookupTableName.split("\\.");
- if (strArr.length > 1) {
- lookupTbl = strArr[strArr.length - 1];
- }
- for (DimensionDesc dimensionDesc : toCheck.getDescriptor().getDimensions()) {
- if (dimensionDesc.getTableRef().getTableName().equalsIgnoreCase(lookupTbl)) {
- checkRes = true;
- break;
- }
- }
- return checkRes;
- }
}