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:30:55 UTC

[incubator-iotdb] 01/01: add tag size in config check

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

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

commit d74adcc5c6723619a4d25586fc23c0641bae5c4d
Author: qiaojialin <64...@qq.com>
AuthorDate: Wed Jun 17 09:30:57 2020 +0800

    add tag size in config check
---
 .../org/apache/iotdb/db/conf/IoTDBConfigCheck.java | 30 +++++++++++++++++-----
 1 file changed, 23 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..4e52099 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
@@ -69,8 +69,13 @@ 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 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 +117,12 @@ 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);
   }
 
 
@@ -195,6 +201,7 @@ 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.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
 
       // upgrade finished, delete old system.properties file
@@ -237,6 +244,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 +256,26 @@ 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);
     }
   }