You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/04/30 01:59:35 UTC

[incubator-iotdb] branch master updated: [IOTDB-625] Change default storage group level number (#1121)

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

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 03c2305  [IOTDB-625] Change default storage group level number (#1121)
03c2305 is described below

commit 03c2305a31ca1bd9be9025010d8219a487b0edbd
Author: Haonan <hh...@outlook.com>
AuthorDate: Thu Apr 30 09:59:27 2020 +0800

    [IOTDB-625] Change default storage group level number (#1121)
    
    * fix init sg level
---
 docs/UserGuide/6-System Tools/8-Load External Tsfile.md             | 4 ++--
 docs/zh/UserGuide/6-System Tools/8-Load External Tsfile.md          | 4 ++--
 server/src/assembly/resources/conf/iotdb-engine.properties          | 4 ++--
 server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java      | 2 +-
 server/src/main/java/org/apache/iotdb/db/metadata/MetaUtils.java    | 6 +++---
 .../org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java  | 6 +++---
 .../src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java | 6 +++---
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/docs/UserGuide/6-System Tools/8-Load External Tsfile.md b/docs/UserGuide/6-System Tools/8-Load External Tsfile.md
index 9790209..c25c1f9 100644
--- a/docs/UserGuide/6-System Tools/8-Load External Tsfile.md	
+++ b/docs/UserGuide/6-System Tools/8-Load External Tsfile.md	
@@ -38,7 +38,7 @@ Examples:
     * `load /Users/Desktop/data/1575028885956-101-0.tsfile`
     * `load /Users/Desktop/data/1575028885956-101-0.tsfile false`
     * `load /Users/Desktop/data/1575028885956-101-0.tsfile true`
-    * `load /Users/Desktop/data/1575028885956-101-0.tsfile true 2`
+    * `load /Users/Desktop/data/1575028885956-101-0.tsfile true 1`
 
 2. Load a batch of files by specifying a folder path (absolute path). 
 The second parameter indicates the path of the tsfile to be loaded and the name of the tsfiles need to conform to the tsfile naming convention, that is, `{systemTime}-{versionNum}-{mergeNum} .tsfile`. The third and fourth parameters are optional. When the metadata corresponding to the time series in the tsfile to be loaded does not exist, you can choose whether to create the schema automatically. If the third parameter is true, the schema will be created automatically. If the third param [...]
@@ -47,7 +47,7 @@ Examples:
     * `load /Users/Desktop/data`
     * `load /Users/Desktop/data false`
     * `load /Users/Desktop/data true`
-    * `load /Users/Desktop/data true 2`
+    * `load /Users/Desktop/data true 1`
 
 ## remove a tsfile
 The command to delete a tsfile is: `remove <path>`.
diff --git a/docs/zh/UserGuide/6-System Tools/8-Load External Tsfile.md b/docs/zh/UserGuide/6-System Tools/8-Load External Tsfile.md
index dfc90a9..e1b59ce 100644
--- a/docs/zh/UserGuide/6-System Tools/8-Load External Tsfile.md	
+++ b/docs/zh/UserGuide/6-System Tools/8-Load External Tsfile.md	
@@ -47,7 +47,7 @@
     * `load /Users/Desktop/data/1575028885956-101-0.tsfile`
     * `load /Users/Desktop/data/1575028885956-101-0.tsfile false`
     * `load /Users/Desktop/data/1575028885956-101-0.tsfile true`
-    * `load /Users/Desktop/data/1575028885956-101-0.tsfile true 2`
+    * `load /Users/Desktop/data/1575028885956-101-0.tsfile true 1`
 
 
 2. 通过指定文件夹路径(绝对路径)批量加载文件。
@@ -56,7 +56,7 @@
     * `load /Users/Desktop/data`
     * `load /Users/Desktop/data false`
     * `load /Users/Desktop/data true`
-    * `load /Users/Desktop/data true 2`
+    * `load /Users/Desktop/data true 1`
 
 ## 删除tsfile文件
 删除tsfile文件的指令为:`remove <path>`
diff --git a/server/src/assembly/resources/conf/iotdb-engine.properties b/server/src/assembly/resources/conf/iotdb-engine.properties
index 9b68c3f..986cec9 100644
--- a/server/src/assembly/resources/conf/iotdb-engine.properties
+++ b/server/src/assembly/resources/conf/iotdb-engine.properties
@@ -397,8 +397,8 @@ enable_auto_create_schema=true
 
 # Storage group level when creating schema automatically is enabled
 # e.g. root.sg0.d1.s2
-#      we will set root.sg0 as the storage group if storage group level is 2
-default_storage_group_level=2
+#      we will set root.sg0 as the storage group if storage group level is 1
+default_storage_group_level=1
 
 # BOOLEAN encoding when creating schema automatically is enabled
 default_boolean_encoding=RLE
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index c1b3350..1c42f0f 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -365,7 +365,7 @@ public class IoTDBConfig {
   /**
    * Storage group level when creating schema automatically is enabled
    */
-  private int defaultStorageGroupLevel = 2;
+  private int defaultStorageGroupLevel = 1;
 
   /**
    * BOOLEAN encoding when creating schema automatically is enabled
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MetaUtils.java b/server/src/main/java/org/apache/iotdb/db/metadata/MetaUtils.java
index 290b742..de3e9c1 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MetaUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MetaUtils.java
@@ -59,18 +59,18 @@ class MetaUtils {
   /**
    * Get storage group name when creating schema automatically is enable
    *
-   * e.g., path = root.a.b.c and level = 2, return root.a
+   * e.g., path = root.a.b.c and level = 1, return root.a
    *
    * @param path path
    * @param level level
    */
   public static String getStorageGroupNameByLevel(String path, int level) throws MetadataException {
     String[] nodeNames = MetaUtils.getNodeNames(path);
-    if (nodeNames.length < level || !nodeNames[0].equals(IoTDBConstant.PATH_ROOT)) {
+    if (nodeNames.length <= level || !nodeNames[0].equals(IoTDBConstant.PATH_ROOT)) {
       throw new IllegalPathException(path);
     }
     StringBuilder storageGroupName = new StringBuilder(nodeNames[0]);
-    for (int i = 1; i < level; i++) {
+    for (int i = 1; i <= level; i++) {
       storageGroupName.append(IoTDBConstant.PATH_SEPARATOR).append(nodeNames[i]);
     }
     return storageGroupName.toString();
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
index 1427340..dff350c 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
@@ -408,7 +408,7 @@ public class IoTDBLoadExternalTsfileIT {
       // test wrong statement
       boolean hasError = false;
       try {
-        statement.execute(String.format("load %s true1 2", tmpDir.getAbsolutePath()));
+        statement.execute(String.format("load %s true1 1", tmpDir.getAbsolutePath()));
       } catch (Exception e) {
         hasError = true;
         Assert.assertEquals(
@@ -420,7 +420,7 @@ public class IoTDBLoadExternalTsfileIT {
       // test not load metadata automatically, it will occur errors.
       hasError = false;
       try {
-        statement.execute(String.format("load %s false 2", tmpDir.getAbsolutePath()));
+        statement.execute(String.format("load %s false 1", tmpDir.getAbsolutePath()));
       } catch (Exception e) {
         hasError = true;
       }
@@ -428,7 +428,7 @@ public class IoTDBLoadExternalTsfileIT {
 
       // test load metadata automatically, it will succeed.
       tmpDir = tmpDir.getParentFile().getParentFile();
-      statement.execute(String.format("load %s true 2", tmpDir.getAbsolutePath()));
+      statement.execute(String.format("load %s true 1", tmpDir.getAbsolutePath()));
       resources = new ArrayList<>(
           StorageEngine.getInstance().getProcessor("root.vehicle")
               .getSequenceFileTreeSet());
diff --git a/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java b/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java
index ac4fb6b..33f1a69 100644
--- a/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java
@@ -699,21 +699,21 @@ public class PhysicalPlanTest {
     Planner processor = new Planner();
     OperateFilePlan plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
     assertEquals(String.format(
-        "OperateFilePlan{file=%s, targetDir=null, autoCreateSchema=true, sgLevel=2, operatorType=LOAD_FILES}",
+        "OperateFilePlan{file=%s, targetDir=null, autoCreateSchema=true, sgLevel=1, operatorType=LOAD_FILES}",
         filePath), plan.toString());
 
     metadata = String.format("load %s true", filePath);
     processor = new Planner();
     plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
     assertEquals(String.format(
-        "OperateFilePlan{file=%s, targetDir=null, autoCreateSchema=true, sgLevel=2, operatorType=LOAD_FILES}",
+        "OperateFilePlan{file=%s, targetDir=null, autoCreateSchema=true, sgLevel=1, operatorType=LOAD_FILES}",
         filePath), plan.toString());
 
     metadata = String.format("load %s false", filePath);
     processor = new Planner();
     plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
     assertEquals(String.format(
-        "OperateFilePlan{file=%s, targetDir=null, autoCreateSchema=false, sgLevel=2, operatorType=LOAD_FILES}",
+        "OperateFilePlan{file=%s, targetDir=null, autoCreateSchema=false, sgLevel=1, operatorType=LOAD_FILES}",
         filePath), plan.toString());
 
     metadata = String.format("load %s true 3", filePath);