kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [08/50] [abbrv] kylin git commit: KYLIN-1366 simply metadata version binding
Date Thu, 10 Mar 2016 07:50:11 GMT
KYLIN-1366 simply metadata version binding

kylin 1366


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

Branch: refs/heads/master
Commit: ab9d57914a119b5b426d2bfae712ca55ff35c92a
Parents: 4c08ded
Author: honma <honma@ebay.com>
Authored: Wed Feb 24 15:58:07 2016 +0800
Committer: honma <honma@ebay.com>
Committed: Fri Feb 26 17:54:37 2016 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/common/KylinConfigBase.java   |  8 --------
 .../java/org/apache/kylin/common/KylinVersion.java |  2 +-
 .../common/persistence/RootPersistentEntity.java   | 17 +++++------------
 .../java/org/apache/kylin/cube/CubeInstance.java   |  5 ++---
 .../java/org/apache/kylin/cube/model/CubeDesc.java |  2 +-
 .../java/org/apache/kylin/dict/DictionaryInfo.java |  4 ++--
 .../apache/kylin/dict/lookup/SnapshotManager.java  |  2 +-
 .../apache/kylin/metadata/model/DataModelDesc.java |  2 +-
 .../kylin/metadata/project/ProjectInstance.java    |  2 +-
 .../kylin/metadata/project/ProjectManager.java     |  2 +-
 .../kylin/storage/hybrid/HybridInstance.java       |  2 +-
 .../org/apache/kylin/invertedindex/IIInstance.java |  2 +-
 .../kylin/rest/controller/CubeController.java      |  4 ++--
 .../storage/hbase/util/ExtendCubeToHybridCLI.java  |  4 ++--
 14 files changed, 21 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java b/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
index 5f9983a..7707684 100644
--- a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
+++ b/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
@@ -61,14 +61,6 @@ public class KylinConfigBase implements Serializable {
         return kylinHome;
     }
 
-    /**
-     * @see KylinVersion
-     * @return current kylin version
-     */
-    public static String getKylinVersion(){
-        return KylinVersion.getCurrentVersion();
-    }
-
     // ============================================================================
 
     private volatile Properties properties = new Properties();

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-common/src/main/java/org/apache/kylin/common/KylinVersion.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinVersion.java b/core-common/src/main/java/org/apache/kylin/common/KylinVersion.java
index d711b38..42cf237 100644
--- a/core-common/src/main/java/org/apache/kylin/common/KylinVersion.java
+++ b/core-common/src/main/java/org/apache/kylin/common/KylinVersion.java
@@ -21,7 +21,7 @@ package org.apache.kylin.common;
  *
  * @since 2.1
  */
-class KylinVersion {
+public class KylinVersion {
     /**
      * Require MANUAL updating kylin version per ANY upgrading.
      */

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-common/src/main/java/org/apache/kylin/common/persistence/RootPersistentEntity.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/persistence/RootPersistentEntity.java
b/core-common/src/main/java/org/apache/kylin/common/persistence/RootPersistentEntity.java
index 327ddcc..c46abe7 100644
--- a/core-common/src/main/java/org/apache/kylin/common/persistence/RootPersistentEntity.java
+++ b/core-common/src/main/java/org/apache/kylin/common/persistence/RootPersistentEntity.java
@@ -26,11 +26,11 @@ import java.util.Date;
 import java.util.UUID;
 
 import org.apache.commons.lang.time.FastDateFormat;
+import org.apache.kylin.common.KylinVersion;
 
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
 import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.kylin.common.KylinConfig;
 
 /**
  * Marks the root entity of JSON persistence. Unit of read, write, cache, and
@@ -80,14 +80,14 @@ abstract public class RootPersistentEntity implements AclEntity, Serializable
{
      * For example: 2.1
      */
     @JsonProperty("version")
-    protected String version;
+    protected String version = KylinVersion.getCurrentVersion();
 
     public String getVersion() {
-      return version;
+        return version;
     }
 
     public void setVersion(String version) {
-      this.version = version;
+        this.version = version;
     }
 
     public String getUuid() {
@@ -110,14 +110,7 @@ abstract public class RootPersistentEntity implements AclEntity, Serializable
{
         this.lastModified = lastModified;
     }
 
-    /**
-     * Update entity's "model_version" with current kylin version and "uuid" with random
UUID
-     *
-     * @see KylinConfig#getKylinVersion()
-     * @see UUID#randomUUID()
-     */
-    public void updateVersionAndRandomUuid() {
-        setVersion(KylinConfig.getKylinVersion());
+    public void updateRandomUuid() {
         setUuid(UUID.randomUUID().toString());
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-cube/src/main/java/org/apache/kylin/cube/CubeInstance.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeInstance.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeInstance.java
index c26e2d2..2862d4f 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/CubeInstance.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeInstance.java
@@ -63,7 +63,7 @@ public class CubeInstance extends RootPersistentEntity implements IRealization,
         cubeInstance.setCreateTimeUTC(System.currentTimeMillis());
         cubeInstance.setSegments(new ArrayList<CubeSegment>());
         cubeInstance.setStatus(RealizationStatusEnum.DISABLED);
-        cubeInstance.updateVersionAndRandomUuid();
+        cubeInstance.updateRandomUuid();
 
         return cubeInstance;
     }
@@ -427,10 +427,9 @@ public class CubeInstance extends RootPersistentEntity implements IRealization,
         newCube.setConfig(cubeInstance.getConfig());
         newCube.setStatus(cubeInstance.getStatus());
         newCube.setOwner(cubeInstance.getOwner());
-        newCube.setVersion(cubeInstance.getVersion());
         newCube.setCost(cubeInstance.getCost());
         newCube.setCreateTimeUTC(System.currentTimeMillis());
-        newCube.updateVersionAndRandomUuid();
+        newCube.updateRandomUuid();
         return newCube;
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java b/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
index de73399..49f70f8 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
@@ -998,7 +998,7 @@ public class CubeDesc extends RootPersistentEntity {
         newCubeDesc.setStorageType(cubeDesc.getStorageType());
         newCubeDesc.setAggregationGroups(cubeDesc.getAggregationGroups());
         newCubeDesc.setConfig(cubeDesc.getConfig());
-        newCubeDesc.updateVersionAndRandomUuid();
+        newCubeDesc.updateRandomUuid();
         return newCubeDesc;
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfo.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfo.java b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfo.java
index 8e41abf..4fba59a 100644
--- a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfo.java
+++ b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfo.java
@@ -53,7 +53,7 @@ public class DictionaryInfo extends RootPersistentEntity {
 
     public DictionaryInfo(String sourceTable, String sourceColumn, int sourceColumnIndex,
String dataType, TableSignature input) {
 
-        this.updateVersionAndRandomUuid();
+        this.updateRandomUuid();
 
         this.sourceTable = sourceTable;
         this.sourceColumn = sourceColumn;
@@ -64,7 +64,7 @@ public class DictionaryInfo extends RootPersistentEntity {
 
     public DictionaryInfo(DictionaryInfo other) {
 
-        this.updateVersionAndRandomUuid();
+        this.updateRandomUuid();
 
         this.sourceTable = other.sourceTable;
         this.sourceColumn = other.sourceColumn;

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotManager.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotManager.java
b/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotManager.java
index ccdc79d..53bf60d 100644
--- a/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotManager.java
+++ b/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotManager.java
@@ -87,7 +87,7 @@ public class SnapshotManager {
 
     public SnapshotTable buildSnapshot(ReadableTable table, TableDesc tableDesc) throws IOException
{
         SnapshotTable snapshot = new SnapshotTable(table);
-        snapshot.updateVersionAndRandomUuid();
+        snapshot.updateRandomUuid();
 
         String dup = checkDupByInfo(snapshot);
         if (dup != null) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
b/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
index c042138..1647707 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
@@ -348,7 +348,7 @@ public class DataModelDesc extends RootPersistentEntity {
         newDataModelDesc.setLookups(dataModelDesc.getLookups());
         newDataModelDesc.setMetrics(dataModelDesc.getMetrics());
         newDataModelDesc.setPartitionDesc(PartitionDesc.getCopyOf(dataModelDesc.getPartitionDesc()));
-        newDataModelDesc.updateVersionAndRandomUuid();
+        newDataModelDesc.updateRandomUuid();
         return newDataModelDesc;
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectInstance.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectInstance.java
b/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectInstance.java
index 20741ee..e0ed3d9 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectInstance.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectInstance.java
@@ -92,7 +92,7 @@ public class ProjectInstance extends RootPersistentEntity {
     public static ProjectInstance create(String name, String owner, String description, List<RealizationEntry>
realizationEntries, List<String> models) {
         ProjectInstance projectInstance = new ProjectInstance();
 
-        projectInstance.updateVersionAndRandomUuid();
+        projectInstance.updateRandomUuid();
         projectInstance.setName(name);
         projectInstance.setOwner(owner);
         projectInstance.setDescription(description);

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-metadata/src/main/java/org/apache/kylin/metadata/project/ProjectManager.java
----------------------------------------------------------------------
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 f73239c..b6e99b3 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
@@ -197,7 +197,7 @@ public class ProjectManager {
             project.setDescription(newDesc);
 
             if (project.getUuid() == null)
-                project.updateVersionAndRandomUuid();
+                project.updateRandomUuid();
 
             updateProject(project);
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/core-storage/src/main/java/org/apache/kylin/storage/hybrid/HybridInstance.java
----------------------------------------------------------------------
diff --git a/core-storage/src/main/java/org/apache/kylin/storage/hybrid/HybridInstance.java
b/core-storage/src/main/java/org/apache/kylin/storage/hybrid/HybridInstance.java
index 090efce..251f7c9 100644
--- a/core-storage/src/main/java/org/apache/kylin/storage/hybrid/HybridInstance.java
+++ b/core-storage/src/main/java/org/apache/kylin/storage/hybrid/HybridInstance.java
@@ -85,7 +85,7 @@ public class HybridInstance extends RootPersistentEntity implements IRealization
         hybridInstance.setConfig(config);
         hybridInstance.setName(name);
         hybridInstance.setRealizationEntries(realizationEntries);
-        hybridInstance.updateVersionAndRandomUuid();
+        hybridInstance.updateRandomUuid();
 
         return hybridInstance;
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/invertedindex/src/main/java/org/apache/kylin/invertedindex/IIInstance.java
----------------------------------------------------------------------
diff --git a/invertedindex/src/main/java/org/apache/kylin/invertedindex/IIInstance.java b/invertedindex/src/main/java/org/apache/kylin/invertedindex/IIInstance.java
index 117bc02..9b56c88 100644
--- a/invertedindex/src/main/java/org/apache/kylin/invertedindex/IIInstance.java
+++ b/invertedindex/src/main/java/org/apache/kylin/invertedindex/IIInstance.java
@@ -60,7 +60,7 @@ public class IIInstance extends RootPersistentEntity implements IRealization,
IB
         iii.setDescName(iiDesc.getName());
         iii.setCreateTimeUTC(System.currentTimeMillis());
         iii.setStatus(RealizationStatusEnum.DISABLED);
-        iii.updateVersionAndRandomUuid();
+        iii.updateRandomUuid();
 
         return iii;
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/server/src/main/java/org/apache/kylin/rest/controller/CubeController.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/kylin/rest/controller/CubeController.java b/server/src/main/java/org/apache/kylin/rest/controller/CubeController.java
index 4741cef..9afa750 100644
--- a/server/src/main/java/org/apache/kylin/rest/controller/CubeController.java
+++ b/server/src/main/java/org/apache/kylin/rest/controller/CubeController.java
@@ -308,7 +308,7 @@ public class CubeController extends BasicController {
                 isStreamingCube = true;
                 newStreamingConfig = streamingConfigs.get(0).clone();
                 newStreamingConfig.setName(newCubeName + "_STREAMING");
-                newStreamingConfig.updateVersionAndRandomUuid();
+                newStreamingConfig.updateRandomUuid();
                 newStreamingConfig.setLastModified(0);
                 newStreamingConfig.setCubeName(newCubeName);
                 try {
@@ -327,7 +327,7 @@ public class CubeController extends BasicController {
                         newKafkaConfig = kafkaConfig.clone();
                         newKafkaConfig.setName(newStreamingConfig.getName());
                         newKafkaConfig.setLastModified(0);
-                        newKafkaConfig.updateVersionAndRandomUuid();
+                        newKafkaConfig.updateRandomUuid();
                     }
                 } catch (IOException e) {
                     throw new InternalErrorException("Failed to get kafka config info. ",
e);

http://git-wip-us.apache.org/repos/asf/kylin/blob/ab9d5791/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ExtendCubeToHybridCLI.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ExtendCubeToHybridCLI.java
b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ExtendCubeToHybridCLI.java
index 1f46369..c55bde4 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ExtendCubeToHybridCLI.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ExtendCubeToHybridCLI.java
@@ -147,7 +147,7 @@ public class ExtendCubeToHybridCLI {
         CubeInstance newCubeInstance = CubeInstance.getCopyOf(cubeInstance);
         newCubeInstance.setName(newCubeInstanceName);
         newCubeInstance.setDescName(newCubeDescName);
-        newCubeInstance.updateVersionAndRandomUuid();
+        newCubeInstance.updateRandomUuid();
         Iterator<CubeSegment> segmentIterator = newCubeInstance.getSegments().iterator();
         CubeSegment currentSeg = null;
         while (segmentIterator.hasNext()) {
@@ -170,7 +170,7 @@ public class ExtendCubeToHybridCLI {
         // create new cube for old segments
         CubeDesc newCubeDesc = CubeDesc.getCopyOf(cubeDesc);
         newCubeDesc.setName(newCubeDescName);
-        newCubeDesc.updateVersionAndRandomUuid();
+        newCubeDesc.updateRandomUuid();
         newCubeDesc.init(kylinConfig, metadataManager.getAllTablesMap());
         newCubeDesc.setPartitionDateEnd(partitionDate);
         newCubeDesc.calculateSignature();


Mime
View raw message