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/06/17 01:54:23 UTC

[incubator-iotdb] branch rel/0.10 updated: [IOTDB-773] add tag attribute size in config check (#1381)

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

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


The following commit(s) were added to refs/heads/rel/0.10 by this push:
     new 86c5386  [IOTDB-773] add tag attribute size in config check (#1381)
86c5386 is described below

commit 86c5386d5ee247f38a6836fde95b130edbd03139
Author: Jialin Qiao <qj...@mails.tsinghua.edu.cn>
AuthorDate: Wed Jun 17 09:54:16 2020 +0800

    [IOTDB-773] add tag attribute size in config check (#1381)
    
    * add tag size and max node degree size in config check
---
 .../org/apache/iotdb/db/conf/IoTDBConfigCheck.java | 42 ++++++++++++++++++----
 1 file changed, 35 insertions(+), 7 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
index 37a8f6a..807c5e2 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
@@ -28,6 +28,7 @@ import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.metadata.MLogWriter;
 import org.apache.iotdb.db.metadata.MetadataConstant;
 import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
 import org.slf4j.Logger;
@@ -69,8 +70,16 @@ public class IoTDBConfigCheck {
   private static final String ENABLE_PARTITION_STRING = "enable_partition";
   private static boolean enablePartition = IoTDBDescriptor.getInstance().getConfig().isEnablePartition();
 
+  private static final String TAG_ATTRIBUTE_SIZE_STRING = "tag_attribute_total_size";
+  private static final String tagAttributeTotalSize = String.valueOf(IoTDBDescriptor.getInstance().getConfig().getTagAttributeTotalSize());
+
+  private static final String MAX_DEGREE_OF_INDEX_STRING = "max_degree_of_index_node";
+  private static final String maxDegreeOfIndexNode = String.valueOf(TSFileDescriptor.getInstance().getConfig().getMaxDegreeOfIndexNode());
+
   private static final String IOTDB_VERSION_STRING = "iotdb_version";
 
+  private static final String ERROR_LOG = "Wrong %s, please set as: %s !";
+
 
   public static IoTDBConfigCheck getInstance() {
     return IoTDBConfigCheckHolder.INSTANCE;
@@ -112,11 +121,13 @@ public class IoTDBConfigCheck {
       System.exit(-1);
     }
 
+    systemProperties.put(IOTDB_VERSION_STRING, IoTDBConstant.VERSION);
     systemProperties.put(TIMESTAMP_PRECISION_STRING, timestampPrecision);
     systemProperties.put(PARTITION_INTERVAL_STRING, String.valueOf(partitionInterval));
     systemProperties.put(TSFILE_FILE_SYSTEM_STRING, tsfileFileSystem);
     systemProperties.put(ENABLE_PARTITION_STRING, String.valueOf(enablePartition));
-    systemProperties.put(IOTDB_VERSION_STRING, IoTDBConstant.VERSION);
+    systemProperties.put(TAG_ATTRIBUTE_SIZE_STRING, tagAttributeTotalSize);
+    systemProperties.put(MAX_DEGREE_OF_INDEX_STRING, maxDegreeOfIndexNode);
   }
 
 
@@ -195,6 +206,8 @@ public class IoTDBConfigCheck {
       properties.setProperty(TSFILE_FILE_SYSTEM_STRING, tsfileFileSystem);
       properties.setProperty(IOTDB_VERSION_STRING, IoTDBConstant.VERSION);
       properties.setProperty(ENABLE_PARTITION_STRING, String.valueOf(enablePartition));
+      properties.setProperty(TAG_ATTRIBUTE_SIZE_STRING, tagAttributeTotalSize);
+      properties.setProperty(MAX_DEGREE_OF_INDEX_STRING, maxDegreeOfIndexNode);
       properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
 
       // upgrade finished, delete old system.properties file
@@ -237,6 +250,9 @@ public class IoTDBConfigCheck {
     }
   }
 
+  /**
+   * Check all immutable properties
+   */
   private void checkProperties() throws IOException {
     for (Entry<String, String> entry : systemProperties.entrySet()) {
       if (!properties.containsKey(entry.getKey())) {
@@ -246,20 +262,32 @@ public class IoTDBConfigCheck {
     }
 
     if (!properties.getProperty(TIMESTAMP_PRECISION_STRING).equals(timestampPrecision)) {
-      logger.error("Wrong {}, please set as: {} !", TIMESTAMP_PRECISION_STRING, properties
-          .getProperty(TIMESTAMP_PRECISION_STRING));
+      logger.error(String.format(ERROR_LOG, TIMESTAMP_PRECISION_STRING, properties
+          .getProperty(TIMESTAMP_PRECISION_STRING)));
       System.exit(-1);
     }
 
     if (Long.parseLong(properties.getProperty(PARTITION_INTERVAL_STRING)) != partitionInterval) {
-      logger.error("Wrong {}, please set as: {} !", PARTITION_INTERVAL_STRING, properties
-          .getProperty(PARTITION_INTERVAL_STRING));
+      logger.error(String.format(ERROR_LOG, PARTITION_INTERVAL_STRING, properties
+          .getProperty(PARTITION_INTERVAL_STRING)));
       System.exit(-1);
     }
 
     if (!(properties.getProperty(TSFILE_FILE_SYSTEM_STRING).equals(tsfileFileSystem))) {
-      logger.error("Wrong {}, please set as: {} !", TSFILE_FILE_SYSTEM_STRING, properties
-          .getProperty(TSFILE_FILE_SYSTEM_STRING));
+      logger.error(String.format(ERROR_LOG, TSFILE_FILE_SYSTEM_STRING, properties
+          .getProperty(TSFILE_FILE_SYSTEM_STRING)));
+      System.exit(-1);
+    }
+
+    if (!(properties.getProperty(TAG_ATTRIBUTE_SIZE_STRING).equals(tagAttributeTotalSize))) {
+      logger.error(String.format(ERROR_LOG, TAG_ATTRIBUTE_SIZE_STRING, properties
+          .getProperty(TAG_ATTRIBUTE_SIZE_STRING)));
+      System.exit(-1);
+    }
+
+    if (!(properties.getProperty(MAX_DEGREE_OF_INDEX_STRING).equals(maxDegreeOfIndexNode))) {
+      logger.error(String.format(ERROR_LOG, MAX_DEGREE_OF_INDEX_STRING, properties
+          .getProperty(MAX_DEGREE_OF_INDEX_STRING)));
       System.exit(-1);
     }
   }