You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/05/23 13:19:48 UTC

[GitHub] [incubator-iotdb] qiaojialin opened a new pull request #1248: [IOTDB-697] add enablePartition in config

qiaojialin opened a new pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248


   Disable partition by default, then the query performance will not decrease in 0.10. 
   Also, the default concurrent write partition is set to 1.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] commented on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633057169


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] HTHou commented on a change in pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
HTHou commented on a change in pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#discussion_r429604483



##########
File path: server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
##########
@@ -37,182 +40,242 @@
 
 public class IoTDBConfigCheck {
 
+  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
+
   // this file is located in data/system/schema/system.properties
   // If user delete folder "data", system.properties can reset.
-  public static final String PROPERTIES_FILE_NAME = "system.properties";
-  public static final String SCHEMA_DIR =
-          IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
-  public static final String WAL_DIR =
-      IoTDBDescriptor.getInstance().getConfig().getWalFolder();
-  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
-  // this is a initial parameter.
-  private static String timestampPrecision = "ms";
-  private static long partitionInterval = 86400;
-  private static String tsfileFileSystem = "LOCAL";
-  private static String iotdbVersion = "0.10.0";
+  private static final String PROPERTIES_FILE_NAME = "system.properties";
+  private static final String SCHEMA_DIR = IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
+  private static final String WAL_DIR = IoTDBDescriptor.getInstance().getConfig().getWalFolder();
+
+  File propertiesFile;
+  File tmpPropertiesFile;
+
   private Properties properties = new Properties();
 
+  private Map<String, String> systemProperties = new HashMap<>();
+
+  private static final String SYSTEM_PROPERTIES_STRING = "System properties:";
+
+  private static final String TIMESTAMP_PRECISION_STRING = "timestamp_precision";
+  private static String timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+
+  private static final String PARTITION_INTERVAL_STRING = "partition_interval";
+  private static long partitionInterval = IoTDBDescriptor.getInstance().getConfig().getPartitionInterval();
+
+  private static final String TSFILE_FILE_SYSTEM_STRING = "tsfile_storage_fs";
+  private static String tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
+
+  private static final String ENABLE_PARTITION_STRING = "enable_partition";
+  private static boolean enablePartition = IoTDBDescriptor.getInstance().getConfig().isEnablePartition();
+
+  private static final String IOTDB_VERSION_STRING = "iotdb_version";
+  private static String iotdbVersion = "0.10.0";
+
   public static IoTDBConfigCheck getInstance() {
     return IoTDBConfigCheckHolder.INSTANCE;
   }
 
-  public void checkConfig() {
-    timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+  private static class IoTDBConfigCheckHolder {
+    private static final IoTDBConfigCheck INSTANCE = new IoTDBConfigCheck();
+  }
+
+  private IoTDBConfigCheck() {
+    logger.info("Starting IoTDB " + iotdbVersion);
+
+    // check whether SCHEMA_DIR exists, create if not exists
+    File dir = SystemFileFactory.INSTANCE.getFile(SCHEMA_DIR);
+    if (!dir.exists()) {
+      if (!dir.mkdirs()) {
+        logger.error("can not create schema dir: {}", SCHEMA_DIR);
+        System.exit(-1);
+      } else {
+        logger.info(" {} dir has been created.", SCHEMA_DIR);
+      }
+    }
 
     // check time stamp precision
     if (!(timestampPrecision.equals("ms") || timestampPrecision.equals("us")
-            || timestampPrecision.equals("ns"))) {
-      logger.error("Wrong timestamp precision, please set as: ms, us or ns ! Current is: "
-              + timestampPrecision);
+        || timestampPrecision.equals("ns"))) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: ms, us or ns ! Current is: "
+          + timestampPrecision);
       System.exit(-1);
     }
 
-    partitionInterval = IoTDBDescriptor.getInstance().getConfig()
-            .getPartitionInterval();
+    if (!enablePartition) {
+      partitionInterval = Long.MAX_VALUE;
+    }
 
     // check partition interval
     if (partitionInterval <= 0) {
       logger.error("Partition interval must larger than 0!");
       System.exit(-1);
     }
 
-    tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
-    createDir(SCHEMA_DIR);
-    checkFile(SCHEMA_DIR);
-    logger.info("System configuration is ok.");
-    
+    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, iotdbVersion);
   }
 
-  private void createDir(String filepath) {
-    File dir = SystemFileFactory.INSTANCE.getFile(filepath);
-    if (!dir.exists()) {
-      dir.mkdirs();
-      logger.info(" {} dir has been created.", SCHEMA_DIR);
-    }
-  }
 
-  private void checkFile(String filepath) {
-    // create file : read timestamp precision from engine.properties, create system.properties
-    // use output stream to write timestamp precision to file.
-    File file = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    File tmpPropertiesFile = new File(file.getAbsoluteFile() + ".tmp");
-    try {
-      if (!file.exists() && !tmpPropertiesFile.exists()) {
-        file.createNewFile();
-        logger.info(" {} has been created.", file.getAbsolutePath());
-        try (FileOutputStream outputStream = new FileOutputStream(file.toString())) {
-          properties.setProperty("timestamp_precision", timestampPrecision);
-          properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-          properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-          properties.setProperty("iotdb_version", iotdbVersion);
-          properties.store(outputStream, "System properties:");
-        }
-        return;
+  /**
+   * check configuration in system.properties when starting IoTDB
+   *
+   * When init: create system.properties directly
+   *
+   * When upgrading the system.properties:
+   * (1) create system.properties.tmp
+   * (2) delete system.properties
+   * (2) rename system.properties.tmp to system.properties
+   */
+  public void checkConfig() throws IOException {
+    propertiesFile = SystemFileFactory.INSTANCE
+            .getFile(IoTDBConfigCheck.SCHEMA_DIR + File.separator + PROPERTIES_FILE_NAME);
+    tmpPropertiesFile = new File(propertiesFile.getAbsoluteFile() + ".tmp");
+
+    // system init first time, no need to check, write system.properties and return
+    if (!propertiesFile.exists() && !tmpPropertiesFile.exists()) {
+      // create system.properties
+      if (propertiesFile.createNewFile()) {
+        logger.info(" {} has been created.", propertiesFile.getAbsolutePath());
+      } else {
+        logger.error("can not create {}", propertiesFile.getAbsolutePath());
+        System.exit(-1);
       }
-      else if (!file.exists() && tmpPropertiesFile.exists()) {
-        // rename upgraded system.properties.tmp to system.properties
-        FileUtils.moveFile(tmpPropertiesFile, file);
-        logger.info(" {} has been upgraded.", file.getAbsolutePath());
-        checkProperties();
-        return;
+
+      // write properties to system.properties
+      try (FileOutputStream outputStream = new FileOutputStream(propertiesFile)) {
+        systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+        properties.store(outputStream, SYSTEM_PROPERTIES_STRING);
       }
-    } catch (IOException e) {
-      logger.error("Can not create {}.", file.getAbsolutePath(), e);
-    }
-    
-    // get existed properties from system_properties.txt
-    File inputFile = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    try (FileInputStream inputStream = new FileInputStream(inputFile.toString())) {
+      return;
+    }
+
+    if (!propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // rename tmp file to system.properties, no need to check
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
+      logger.info("rename {} to {}", tmpPropertiesFile, propertiesFile);
+      return;
+    } else if (propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // both files exist, remove tmp file
+      FileUtils.forceDeleteOnExit(tmpPropertiesFile);
+      logger.info("remove {}", tmpPropertiesFile);
+    }
+
+    // no tmp file, read properties from system.properties
+    try (FileInputStream inputStream = new FileInputStream(propertiesFile)) {
       properties.load(new InputStreamReader(inputStream, TSFileConfig.STRING_CHARSET));
-      // need to upgrade
-      if (!properties.containsKey("iotdb_version")) {
+      // need to upgrade from 0.9 to 0.10
+      if (!properties.containsKey(IOTDB_VERSION_STRING)) {
         checkUnClosedTsFileV1();
-        upgradeMlog();
-      } else {
-        checkProperties();
-        return;
+        MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
+        upgradePropertiesFile();
       }
-    } catch (IOException e) {
-      logger.error("Load system.properties from {} failed.", file.getAbsolutePath(), e);
+      checkProperties();
+    }
+  }
+
+  /**
+   * upgrade 0.9 properties to 0.10 properties
+   */
+  private void upgradePropertiesFile()
+      throws IOException {
+    // create an empty tmpPropertiesFile
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
     }
 
-    // if tmpPropertiesFile exists, remove it
-    if (tmpPropertiesFile.exists()) {
-      try {
-        Files.delete(tmpPropertiesFile.toPath());
-      } catch (IOException e) {
-        logger.error("Fail to remove broken file {}", tmpPropertiesFile);
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      properties.setProperty(PARTITION_INTERVAL_STRING, String.valueOf(partitionInterval));
+      properties.setProperty(TSFILE_FILE_SYSTEM_STRING, tsfileFileSystem);
+      properties.setProperty(IOTDB_VERSION_STRING, iotdbVersion);
+      properties.setProperty(ENABLE_PARTITION_STRING, String.valueOf(enablePartition));
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
+
+      // upgrade finished, delete old system.properties file
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
+      // rename system.properties.tmp to system.properties
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
+  }
+
+
+  /**
+   *  repair 0.10 properties
+   */
+  private void upgradePropertiesFileFromBrokenFile()
+      throws IOException {
     // create an empty tmpPropertiesFile
-    try {
-      if (tmpPropertiesFile.createNewFile()) {
-        logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
-      }
-    } catch (IOException e) {
-      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile, e);
-    }
-    // try to add the storage_group_time_range, tsfile_storage_fs 
-    // and iotdb_version property in system.properties.tmp
-    try (FileOutputStream outputStream = new FileOutputStream(tmpPropertiesFile.toString())) {
-      properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-      properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-      properties.setProperty("iotdb_version", iotdbVersion);
-      properties.store(outputStream, "System properties:");
-      checkProperties();
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
+    }
+
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
       // upgrade finished, delete old system.properties file
-      if (file.exists()) {
-        Files.delete(file.toPath());
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
       // rename system.properties.tmp to system.properties
-      FileUtils.moveFile(tmpPropertiesFile, file);
-    }  catch (IOException e) {
-      logger.error("Something went wrong while upgrading teh system.properties. The file is {}.", file.getAbsolutePath(), e);
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
-
   }
 
-  private void checkProperties() {
-    if (!properties.getProperty("timestamp_precision").equals(timestampPrecision)) {
-      logger.error("Wrong timestamp precision, please set as: " + properties
-              .getProperty("timestamp_precision") + " !");
-      System.exit(-1);
+  private void checkProperties() throws IOException {
+    for (Entry<String, String> entry : systemProperties.entrySet()) {
+      if (!properties.contains(entry.getKey())) {
+        upgradePropertiesFileFromBrokenFile();
+        logger.info("repair system.properties, lack {}", entry.getKey());
+      }
     }
-    if (!(Long.parseLong(properties.getProperty("storage_group_time_range"))
-            == partitionInterval)) {
-      logger.error("Wrong storage group time range, please set as: " + properties
-              .getProperty("storage_group_time_range") + " !");
+
+    if (!properties.getProperty(TIMESTAMP_PRECISION_STRING).equals(timestampPrecision)) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: " + properties
+          .getProperty(TIMESTAMP_PRECISION_STRING) + " !");
       System.exit(-1);
     }
-    if (!(properties.getProperty("tsfile_storage_fs").equals(tsfileFileSystem))) {
-      logger.error("Wrong tsfile file system, please set as: " + properties
-              .getProperty("tsfile_storage_fs") + " !");
+
+    if (!(Long.parseLong(properties.getProperty(PARTITION_INTERVAL_STRING))
+        == partitionInterval)) {
+      logger.error("Wrong " + PARTITION_INTERVAL_STRING + ", please set as: " + properties
+          .getProperty(PARTITION_INTERVAL_STRING) + " !");
       System.exit(-1);
     }
-  }
 
-  private void upgradeMlog() {
-    try {
-      MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
-    } catch (IOException e) {
-      logger.error("Upgrade mlog.txt from {} failed.", SCHEMA_DIR, e);
+    if (!(properties.getProperty(TSFILE_FILE_SYSTEM_STRING).equals(tsfileFileSystem))) {
+      logger.error("Wrong " + TSFILE_FILE_SYSTEM_STRING + ", please set as: " + properties
+          .getProperty(TSFILE_FILE_SYSTEM_STRING) + " !");

Review comment:
       ```suggestion
         logger.error("Wrong {}, please set as: {} !", TSFILE_FILE_SYSTEM_STRING, properties
             .getProperty(TSFILE_FILE_SYSTEM_STRING));
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
##########
@@ -37,182 +40,242 @@
 
 public class IoTDBConfigCheck {
 
+  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
+
   // this file is located in data/system/schema/system.properties
   // If user delete folder "data", system.properties can reset.
-  public static final String PROPERTIES_FILE_NAME = "system.properties";
-  public static final String SCHEMA_DIR =
-          IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
-  public static final String WAL_DIR =
-      IoTDBDescriptor.getInstance().getConfig().getWalFolder();
-  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
-  // this is a initial parameter.
-  private static String timestampPrecision = "ms";
-  private static long partitionInterval = 86400;
-  private static String tsfileFileSystem = "LOCAL";
-  private static String iotdbVersion = "0.10.0";
+  private static final String PROPERTIES_FILE_NAME = "system.properties";
+  private static final String SCHEMA_DIR = IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
+  private static final String WAL_DIR = IoTDBDescriptor.getInstance().getConfig().getWalFolder();
+
+  File propertiesFile;
+  File tmpPropertiesFile;
+
   private Properties properties = new Properties();
 
+  private Map<String, String> systemProperties = new HashMap<>();
+
+  private static final String SYSTEM_PROPERTIES_STRING = "System properties:";
+
+  private static final String TIMESTAMP_PRECISION_STRING = "timestamp_precision";
+  private static String timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+
+  private static final String PARTITION_INTERVAL_STRING = "partition_interval";
+  private static long partitionInterval = IoTDBDescriptor.getInstance().getConfig().getPartitionInterval();
+
+  private static final String TSFILE_FILE_SYSTEM_STRING = "tsfile_storage_fs";
+  private static String tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
+
+  private static final String ENABLE_PARTITION_STRING = "enable_partition";
+  private static boolean enablePartition = IoTDBDescriptor.getInstance().getConfig().isEnablePartition();
+
+  private static final String IOTDB_VERSION_STRING = "iotdb_version";
+  private static String iotdbVersion = "0.10.0";
+
   public static IoTDBConfigCheck getInstance() {
     return IoTDBConfigCheckHolder.INSTANCE;
   }
 
-  public void checkConfig() {
-    timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+  private static class IoTDBConfigCheckHolder {
+    private static final IoTDBConfigCheck INSTANCE = new IoTDBConfigCheck();
+  }
+
+  private IoTDBConfigCheck() {
+    logger.info("Starting IoTDB " + iotdbVersion);
+
+    // check whether SCHEMA_DIR exists, create if not exists
+    File dir = SystemFileFactory.INSTANCE.getFile(SCHEMA_DIR);
+    if (!dir.exists()) {
+      if (!dir.mkdirs()) {
+        logger.error("can not create schema dir: {}", SCHEMA_DIR);
+        System.exit(-1);
+      } else {
+        logger.info(" {} dir has been created.", SCHEMA_DIR);
+      }
+    }
 
     // check time stamp precision
     if (!(timestampPrecision.equals("ms") || timestampPrecision.equals("us")
-            || timestampPrecision.equals("ns"))) {
-      logger.error("Wrong timestamp precision, please set as: ms, us or ns ! Current is: "
-              + timestampPrecision);
+        || timestampPrecision.equals("ns"))) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: ms, us or ns ! Current is: "
+          + timestampPrecision);
       System.exit(-1);
     }
 
-    partitionInterval = IoTDBDescriptor.getInstance().getConfig()
-            .getPartitionInterval();
+    if (!enablePartition) {
+      partitionInterval = Long.MAX_VALUE;
+    }
 
     // check partition interval
     if (partitionInterval <= 0) {
       logger.error("Partition interval must larger than 0!");
       System.exit(-1);
     }
 
-    tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
-    createDir(SCHEMA_DIR);
-    checkFile(SCHEMA_DIR);
-    logger.info("System configuration is ok.");
-    
+    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, iotdbVersion);
   }
 
-  private void createDir(String filepath) {
-    File dir = SystemFileFactory.INSTANCE.getFile(filepath);
-    if (!dir.exists()) {
-      dir.mkdirs();
-      logger.info(" {} dir has been created.", SCHEMA_DIR);
-    }
-  }
 
-  private void checkFile(String filepath) {
-    // create file : read timestamp precision from engine.properties, create system.properties
-    // use output stream to write timestamp precision to file.
-    File file = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    File tmpPropertiesFile = new File(file.getAbsoluteFile() + ".tmp");
-    try {
-      if (!file.exists() && !tmpPropertiesFile.exists()) {
-        file.createNewFile();
-        logger.info(" {} has been created.", file.getAbsolutePath());
-        try (FileOutputStream outputStream = new FileOutputStream(file.toString())) {
-          properties.setProperty("timestamp_precision", timestampPrecision);
-          properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-          properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-          properties.setProperty("iotdb_version", iotdbVersion);
-          properties.store(outputStream, "System properties:");
-        }
-        return;
+  /**
+   * check configuration in system.properties when starting IoTDB
+   *
+   * When init: create system.properties directly
+   *
+   * When upgrading the system.properties:
+   * (1) create system.properties.tmp
+   * (2) delete system.properties
+   * (2) rename system.properties.tmp to system.properties
+   */
+  public void checkConfig() throws IOException {
+    propertiesFile = SystemFileFactory.INSTANCE
+            .getFile(IoTDBConfigCheck.SCHEMA_DIR + File.separator + PROPERTIES_FILE_NAME);
+    tmpPropertiesFile = new File(propertiesFile.getAbsoluteFile() + ".tmp");
+
+    // system init first time, no need to check, write system.properties and return
+    if (!propertiesFile.exists() && !tmpPropertiesFile.exists()) {
+      // create system.properties
+      if (propertiesFile.createNewFile()) {
+        logger.info(" {} has been created.", propertiesFile.getAbsolutePath());
+      } else {
+        logger.error("can not create {}", propertiesFile.getAbsolutePath());
+        System.exit(-1);
       }
-      else if (!file.exists() && tmpPropertiesFile.exists()) {
-        // rename upgraded system.properties.tmp to system.properties
-        FileUtils.moveFile(tmpPropertiesFile, file);
-        logger.info(" {} has been upgraded.", file.getAbsolutePath());
-        checkProperties();
-        return;
+
+      // write properties to system.properties
+      try (FileOutputStream outputStream = new FileOutputStream(propertiesFile)) {
+        systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+        properties.store(outputStream, SYSTEM_PROPERTIES_STRING);
       }
-    } catch (IOException e) {
-      logger.error("Can not create {}.", file.getAbsolutePath(), e);
-    }
-    
-    // get existed properties from system_properties.txt
-    File inputFile = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    try (FileInputStream inputStream = new FileInputStream(inputFile.toString())) {
+      return;
+    }
+
+    if (!propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // rename tmp file to system.properties, no need to check
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
+      logger.info("rename {} to {}", tmpPropertiesFile, propertiesFile);
+      return;
+    } else if (propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // both files exist, remove tmp file
+      FileUtils.forceDeleteOnExit(tmpPropertiesFile);
+      logger.info("remove {}", tmpPropertiesFile);
+    }
+
+    // no tmp file, read properties from system.properties
+    try (FileInputStream inputStream = new FileInputStream(propertiesFile)) {
       properties.load(new InputStreamReader(inputStream, TSFileConfig.STRING_CHARSET));
-      // need to upgrade
-      if (!properties.containsKey("iotdb_version")) {
+      // need to upgrade from 0.9 to 0.10
+      if (!properties.containsKey(IOTDB_VERSION_STRING)) {
         checkUnClosedTsFileV1();
-        upgradeMlog();
-      } else {
-        checkProperties();
-        return;
+        MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
+        upgradePropertiesFile();
       }
-    } catch (IOException e) {
-      logger.error("Load system.properties from {} failed.", file.getAbsolutePath(), e);
+      checkProperties();
+    }
+  }
+
+  /**
+   * upgrade 0.9 properties to 0.10 properties
+   */
+  private void upgradePropertiesFile()
+      throws IOException {
+    // create an empty tmpPropertiesFile
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
     }
 
-    // if tmpPropertiesFile exists, remove it
-    if (tmpPropertiesFile.exists()) {
-      try {
-        Files.delete(tmpPropertiesFile.toPath());
-      } catch (IOException e) {
-        logger.error("Fail to remove broken file {}", tmpPropertiesFile);
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      properties.setProperty(PARTITION_INTERVAL_STRING, String.valueOf(partitionInterval));
+      properties.setProperty(TSFILE_FILE_SYSTEM_STRING, tsfileFileSystem);
+      properties.setProperty(IOTDB_VERSION_STRING, iotdbVersion);
+      properties.setProperty(ENABLE_PARTITION_STRING, String.valueOf(enablePartition));
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
+
+      // upgrade finished, delete old system.properties file
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
+      // rename system.properties.tmp to system.properties
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
+  }
+
+
+  /**
+   *  repair 0.10 properties
+   */
+  private void upgradePropertiesFileFromBrokenFile()
+      throws IOException {
     // create an empty tmpPropertiesFile
-    try {
-      if (tmpPropertiesFile.createNewFile()) {
-        logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
-      }
-    } catch (IOException e) {
-      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile, e);
-    }
-    // try to add the storage_group_time_range, tsfile_storage_fs 
-    // and iotdb_version property in system.properties.tmp
-    try (FileOutputStream outputStream = new FileOutputStream(tmpPropertiesFile.toString())) {
-      properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-      properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-      properties.setProperty("iotdb_version", iotdbVersion);
-      properties.store(outputStream, "System properties:");
-      checkProperties();
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
+    }
+
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
       // upgrade finished, delete old system.properties file
-      if (file.exists()) {
-        Files.delete(file.toPath());
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
       // rename system.properties.tmp to system.properties
-      FileUtils.moveFile(tmpPropertiesFile, file);
-    }  catch (IOException e) {
-      logger.error("Something went wrong while upgrading teh system.properties. The file is {}.", file.getAbsolutePath(), e);
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
-
   }
 
-  private void checkProperties() {
-    if (!properties.getProperty("timestamp_precision").equals(timestampPrecision)) {
-      logger.error("Wrong timestamp precision, please set as: " + properties
-              .getProperty("timestamp_precision") + " !");
-      System.exit(-1);
+  private void checkProperties() throws IOException {
+    for (Entry<String, String> entry : systemProperties.entrySet()) {
+      if (!properties.contains(entry.getKey())) {
+        upgradePropertiesFileFromBrokenFile();
+        logger.info("repair system.properties, lack {}", entry.getKey());
+      }
     }
-    if (!(Long.parseLong(properties.getProperty("storage_group_time_range"))
-            == partitionInterval)) {
-      logger.error("Wrong storage group time range, please set as: " + properties
-              .getProperty("storage_group_time_range") + " !");
+
+    if (!properties.getProperty(TIMESTAMP_PRECISION_STRING).equals(timestampPrecision)) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: " + properties
+          .getProperty(TIMESTAMP_PRECISION_STRING) + " !");
       System.exit(-1);
     }
-    if (!(properties.getProperty("tsfile_storage_fs").equals(tsfileFileSystem))) {
-      logger.error("Wrong tsfile file system, please set as: " + properties
-              .getProperty("tsfile_storage_fs") + " !");
+
+    if (!(Long.parseLong(properties.getProperty(PARTITION_INTERVAL_STRING))
+        == partitionInterval)) {

Review comment:
       ```suggestion
       if (Long.parseLong(properties.getProperty(PARTITION_INTERVAL_STRING))
           != partitionInterval) {
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
##########
@@ -37,182 +40,242 @@
 
 public class IoTDBConfigCheck {
 
+  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
+
   // this file is located in data/system/schema/system.properties
   // If user delete folder "data", system.properties can reset.
-  public static final String PROPERTIES_FILE_NAME = "system.properties";
-  public static final String SCHEMA_DIR =
-          IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
-  public static final String WAL_DIR =
-      IoTDBDescriptor.getInstance().getConfig().getWalFolder();
-  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
-  // this is a initial parameter.
-  private static String timestampPrecision = "ms";
-  private static long partitionInterval = 86400;
-  private static String tsfileFileSystem = "LOCAL";
-  private static String iotdbVersion = "0.10.0";
+  private static final String PROPERTIES_FILE_NAME = "system.properties";
+  private static final String SCHEMA_DIR = IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
+  private static final String WAL_DIR = IoTDBDescriptor.getInstance().getConfig().getWalFolder();
+
+  File propertiesFile;
+  File tmpPropertiesFile;
+
   private Properties properties = new Properties();
 
+  private Map<String, String> systemProperties = new HashMap<>();
+
+  private static final String SYSTEM_PROPERTIES_STRING = "System properties:";
+
+  private static final String TIMESTAMP_PRECISION_STRING = "timestamp_precision";
+  private static String timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+
+  private static final String PARTITION_INTERVAL_STRING = "partition_interval";
+  private static long partitionInterval = IoTDBDescriptor.getInstance().getConfig().getPartitionInterval();
+
+  private static final String TSFILE_FILE_SYSTEM_STRING = "tsfile_storage_fs";
+  private static String tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
+
+  private static final String ENABLE_PARTITION_STRING = "enable_partition";
+  private static boolean enablePartition = IoTDBDescriptor.getInstance().getConfig().isEnablePartition();
+
+  private static final String IOTDB_VERSION_STRING = "iotdb_version";
+  private static String iotdbVersion = "0.10.0";
+
   public static IoTDBConfigCheck getInstance() {
     return IoTDBConfigCheckHolder.INSTANCE;
   }
 
-  public void checkConfig() {
-    timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+  private static class IoTDBConfigCheckHolder {
+    private static final IoTDBConfigCheck INSTANCE = new IoTDBConfigCheck();
+  }
+
+  private IoTDBConfigCheck() {
+    logger.info("Starting IoTDB " + iotdbVersion);
+
+    // check whether SCHEMA_DIR exists, create if not exists
+    File dir = SystemFileFactory.INSTANCE.getFile(SCHEMA_DIR);
+    if (!dir.exists()) {
+      if (!dir.mkdirs()) {
+        logger.error("can not create schema dir: {}", SCHEMA_DIR);
+        System.exit(-1);
+      } else {
+        logger.info(" {} dir has been created.", SCHEMA_DIR);
+      }
+    }
 
     // check time stamp precision
     if (!(timestampPrecision.equals("ms") || timestampPrecision.equals("us")
-            || timestampPrecision.equals("ns"))) {
-      logger.error("Wrong timestamp precision, please set as: ms, us or ns ! Current is: "
-              + timestampPrecision);
+        || timestampPrecision.equals("ns"))) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: ms, us or ns ! Current is: "
+          + timestampPrecision);
       System.exit(-1);
     }
 
-    partitionInterval = IoTDBDescriptor.getInstance().getConfig()
-            .getPartitionInterval();
+    if (!enablePartition) {
+      partitionInterval = Long.MAX_VALUE;
+    }
 
     // check partition interval
     if (partitionInterval <= 0) {
       logger.error("Partition interval must larger than 0!");
       System.exit(-1);
     }
 
-    tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
-    createDir(SCHEMA_DIR);
-    checkFile(SCHEMA_DIR);
-    logger.info("System configuration is ok.");
-    
+    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, iotdbVersion);
   }
 
-  private void createDir(String filepath) {
-    File dir = SystemFileFactory.INSTANCE.getFile(filepath);
-    if (!dir.exists()) {
-      dir.mkdirs();
-      logger.info(" {} dir has been created.", SCHEMA_DIR);
-    }
-  }
 
-  private void checkFile(String filepath) {
-    // create file : read timestamp precision from engine.properties, create system.properties
-    // use output stream to write timestamp precision to file.
-    File file = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    File tmpPropertiesFile = new File(file.getAbsoluteFile() + ".tmp");
-    try {
-      if (!file.exists() && !tmpPropertiesFile.exists()) {
-        file.createNewFile();
-        logger.info(" {} has been created.", file.getAbsolutePath());
-        try (FileOutputStream outputStream = new FileOutputStream(file.toString())) {
-          properties.setProperty("timestamp_precision", timestampPrecision);
-          properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-          properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-          properties.setProperty("iotdb_version", iotdbVersion);
-          properties.store(outputStream, "System properties:");
-        }
-        return;
+  /**
+   * check configuration in system.properties when starting IoTDB
+   *
+   * When init: create system.properties directly
+   *
+   * When upgrading the system.properties:
+   * (1) create system.properties.tmp
+   * (2) delete system.properties
+   * (2) rename system.properties.tmp to system.properties
+   */
+  public void checkConfig() throws IOException {
+    propertiesFile = SystemFileFactory.INSTANCE
+            .getFile(IoTDBConfigCheck.SCHEMA_DIR + File.separator + PROPERTIES_FILE_NAME);
+    tmpPropertiesFile = new File(propertiesFile.getAbsoluteFile() + ".tmp");
+
+    // system init first time, no need to check, write system.properties and return
+    if (!propertiesFile.exists() && !tmpPropertiesFile.exists()) {
+      // create system.properties
+      if (propertiesFile.createNewFile()) {
+        logger.info(" {} has been created.", propertiesFile.getAbsolutePath());
+      } else {
+        logger.error("can not create {}", propertiesFile.getAbsolutePath());
+        System.exit(-1);
       }
-      else if (!file.exists() && tmpPropertiesFile.exists()) {
-        // rename upgraded system.properties.tmp to system.properties
-        FileUtils.moveFile(tmpPropertiesFile, file);
-        logger.info(" {} has been upgraded.", file.getAbsolutePath());
-        checkProperties();
-        return;
+
+      // write properties to system.properties
+      try (FileOutputStream outputStream = new FileOutputStream(propertiesFile)) {
+        systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+        properties.store(outputStream, SYSTEM_PROPERTIES_STRING);
       }
-    } catch (IOException e) {
-      logger.error("Can not create {}.", file.getAbsolutePath(), e);
-    }
-    
-    // get existed properties from system_properties.txt
-    File inputFile = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    try (FileInputStream inputStream = new FileInputStream(inputFile.toString())) {
+      return;
+    }
+
+    if (!propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // rename tmp file to system.properties, no need to check
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
+      logger.info("rename {} to {}", tmpPropertiesFile, propertiesFile);
+      return;
+    } else if (propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // both files exist, remove tmp file
+      FileUtils.forceDeleteOnExit(tmpPropertiesFile);
+      logger.info("remove {}", tmpPropertiesFile);
+    }
+
+    // no tmp file, read properties from system.properties
+    try (FileInputStream inputStream = new FileInputStream(propertiesFile)) {
       properties.load(new InputStreamReader(inputStream, TSFileConfig.STRING_CHARSET));
-      // need to upgrade
-      if (!properties.containsKey("iotdb_version")) {
+      // need to upgrade from 0.9 to 0.10
+      if (!properties.containsKey(IOTDB_VERSION_STRING)) {
         checkUnClosedTsFileV1();
-        upgradeMlog();
-      } else {
-        checkProperties();
-        return;
+        MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
+        upgradePropertiesFile();
       }
-    } catch (IOException e) {
-      logger.error("Load system.properties from {} failed.", file.getAbsolutePath(), e);
+      checkProperties();
+    }
+  }
+
+  /**
+   * upgrade 0.9 properties to 0.10 properties
+   */
+  private void upgradePropertiesFile()
+      throws IOException {
+    // create an empty tmpPropertiesFile
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
     }
 
-    // if tmpPropertiesFile exists, remove it
-    if (tmpPropertiesFile.exists()) {
-      try {
-        Files.delete(tmpPropertiesFile.toPath());
-      } catch (IOException e) {
-        logger.error("Fail to remove broken file {}", tmpPropertiesFile);
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      properties.setProperty(PARTITION_INTERVAL_STRING, String.valueOf(partitionInterval));
+      properties.setProperty(TSFILE_FILE_SYSTEM_STRING, tsfileFileSystem);
+      properties.setProperty(IOTDB_VERSION_STRING, iotdbVersion);
+      properties.setProperty(ENABLE_PARTITION_STRING, String.valueOf(enablePartition));
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
+
+      // upgrade finished, delete old system.properties file
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
+      // rename system.properties.tmp to system.properties
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
+  }
+
+
+  /**
+   *  repair 0.10 properties
+   */
+  private void upgradePropertiesFileFromBrokenFile()
+      throws IOException {
     // create an empty tmpPropertiesFile
-    try {
-      if (tmpPropertiesFile.createNewFile()) {
-        logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
-      }
-    } catch (IOException e) {
-      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile, e);
-    }
-    // try to add the storage_group_time_range, tsfile_storage_fs 
-    // and iotdb_version property in system.properties.tmp
-    try (FileOutputStream outputStream = new FileOutputStream(tmpPropertiesFile.toString())) {
-      properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-      properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-      properties.setProperty("iotdb_version", iotdbVersion);
-      properties.store(outputStream, "System properties:");
-      checkProperties();
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
+    }
+
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
       // upgrade finished, delete old system.properties file
-      if (file.exists()) {
-        Files.delete(file.toPath());
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
       // rename system.properties.tmp to system.properties
-      FileUtils.moveFile(tmpPropertiesFile, file);
-    }  catch (IOException e) {
-      logger.error("Something went wrong while upgrading teh system.properties. The file is {}.", file.getAbsolutePath(), e);
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
-
   }
 
-  private void checkProperties() {
-    if (!properties.getProperty("timestamp_precision").equals(timestampPrecision)) {
-      logger.error("Wrong timestamp precision, please set as: " + properties
-              .getProperty("timestamp_precision") + " !");
-      System.exit(-1);
+  private void checkProperties() throws IOException {
+    for (Entry<String, String> entry : systemProperties.entrySet()) {
+      if (!properties.contains(entry.getKey())) {
+        upgradePropertiesFileFromBrokenFile();
+        logger.info("repair system.properties, lack {}", entry.getKey());
+      }
     }
-    if (!(Long.parseLong(properties.getProperty("storage_group_time_range"))
-            == partitionInterval)) {
-      logger.error("Wrong storage group time range, please set as: " + properties
-              .getProperty("storage_group_time_range") + " !");
+
+    if (!properties.getProperty(TIMESTAMP_PRECISION_STRING).equals(timestampPrecision)) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: " + properties
+          .getProperty(TIMESTAMP_PRECISION_STRING) + " !");

Review comment:
       ```suggestion
         logger.error("Wrong {}, please set as: {} !", TIMESTAMP_PRECISION_STRING, properties
             .getProperty(TIMESTAMP_PRECISION_STRING));
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] removed a comment on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633176447


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [16 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] removed a comment on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633057169


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#discussion_r429612795



##########
File path: server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
##########
@@ -37,182 +40,242 @@
 
 public class IoTDBConfigCheck {
 
+  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
+
   // this file is located in data/system/schema/system.properties
   // If user delete folder "data", system.properties can reset.
-  public static final String PROPERTIES_FILE_NAME = "system.properties";
-  public static final String SCHEMA_DIR =
-          IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
-  public static final String WAL_DIR =
-      IoTDBDescriptor.getInstance().getConfig().getWalFolder();
-  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
-  // this is a initial parameter.
-  private static String timestampPrecision = "ms";
-  private static long partitionInterval = 86400;
-  private static String tsfileFileSystem = "LOCAL";
-  private static String iotdbVersion = "0.10.0";
+  private static final String PROPERTIES_FILE_NAME = "system.properties";
+  private static final String SCHEMA_DIR = IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
+  private static final String WAL_DIR = IoTDBDescriptor.getInstance().getConfig().getWalFolder();
+
+  File propertiesFile;
+  File tmpPropertiesFile;
+
   private Properties properties = new Properties();
 
+  private Map<String, String> systemProperties = new HashMap<>();
+
+  private static final String SYSTEM_PROPERTIES_STRING = "System properties:";
+
+  private static final String TIMESTAMP_PRECISION_STRING = "timestamp_precision";
+  private static String timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+
+  private static final String PARTITION_INTERVAL_STRING = "partition_interval";
+  private static long partitionInterval = IoTDBDescriptor.getInstance().getConfig().getPartitionInterval();
+
+  private static final String TSFILE_FILE_SYSTEM_STRING = "tsfile_storage_fs";
+  private static String tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
+
+  private static final String ENABLE_PARTITION_STRING = "enable_partition";
+  private static boolean enablePartition = IoTDBDescriptor.getInstance().getConfig().isEnablePartition();
+
+  private static final String IOTDB_VERSION_STRING = "iotdb_version";
+  private static String iotdbVersion = "0.10.0";
+
   public static IoTDBConfigCheck getInstance() {
     return IoTDBConfigCheckHolder.INSTANCE;
   }
 
-  public void checkConfig() {
-    timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+  private static class IoTDBConfigCheckHolder {
+    private static final IoTDBConfigCheck INSTANCE = new IoTDBConfigCheck();
+  }
+
+  private IoTDBConfigCheck() {
+    logger.info("Starting IoTDB " + iotdbVersion);
+
+    // check whether SCHEMA_DIR exists, create if not exists
+    File dir = SystemFileFactory.INSTANCE.getFile(SCHEMA_DIR);
+    if (!dir.exists()) {
+      if (!dir.mkdirs()) {
+        logger.error("can not create schema dir: {}", SCHEMA_DIR);
+        System.exit(-1);
+      } else {
+        logger.info(" {} dir has been created.", SCHEMA_DIR);
+      }
+    }
 
     // check time stamp precision
     if (!(timestampPrecision.equals("ms") || timestampPrecision.equals("us")
-            || timestampPrecision.equals("ns"))) {
-      logger.error("Wrong timestamp precision, please set as: ms, us or ns ! Current is: "
-              + timestampPrecision);
+        || timestampPrecision.equals("ns"))) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: ms, us or ns ! Current is: "
+          + timestampPrecision);
       System.exit(-1);
     }
 
-    partitionInterval = IoTDBDescriptor.getInstance().getConfig()
-            .getPartitionInterval();
+    if (!enablePartition) {
+      partitionInterval = Long.MAX_VALUE;
+    }
 
     // check partition interval
     if (partitionInterval <= 0) {
       logger.error("Partition interval must larger than 0!");
       System.exit(-1);
     }
 
-    tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
-    createDir(SCHEMA_DIR);
-    checkFile(SCHEMA_DIR);
-    logger.info("System configuration is ok.");
-    
+    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, iotdbVersion);
   }
 
-  private void createDir(String filepath) {
-    File dir = SystemFileFactory.INSTANCE.getFile(filepath);
-    if (!dir.exists()) {
-      dir.mkdirs();
-      logger.info(" {} dir has been created.", SCHEMA_DIR);
-    }
-  }
 
-  private void checkFile(String filepath) {
-    // create file : read timestamp precision from engine.properties, create system.properties
-    // use output stream to write timestamp precision to file.
-    File file = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    File tmpPropertiesFile = new File(file.getAbsoluteFile() + ".tmp");
-    try {
-      if (!file.exists() && !tmpPropertiesFile.exists()) {
-        file.createNewFile();
-        logger.info(" {} has been created.", file.getAbsolutePath());
-        try (FileOutputStream outputStream = new FileOutputStream(file.toString())) {
-          properties.setProperty("timestamp_precision", timestampPrecision);
-          properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-          properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-          properties.setProperty("iotdb_version", iotdbVersion);
-          properties.store(outputStream, "System properties:");
-        }
-        return;
+  /**
+   * check configuration in system.properties when starting IoTDB
+   *
+   * When init: create system.properties directly
+   *
+   * When upgrading the system.properties:
+   * (1) create system.properties.tmp
+   * (2) delete system.properties
+   * (2) rename system.properties.tmp to system.properties
+   */
+  public void checkConfig() throws IOException {
+    propertiesFile = SystemFileFactory.INSTANCE
+            .getFile(IoTDBConfigCheck.SCHEMA_DIR + File.separator + PROPERTIES_FILE_NAME);
+    tmpPropertiesFile = new File(propertiesFile.getAbsoluteFile() + ".tmp");
+
+    // system init first time, no need to check, write system.properties and return
+    if (!propertiesFile.exists() && !tmpPropertiesFile.exists()) {
+      // create system.properties
+      if (propertiesFile.createNewFile()) {
+        logger.info(" {} has been created.", propertiesFile.getAbsolutePath());
+      } else {
+        logger.error("can not create {}", propertiesFile.getAbsolutePath());
+        System.exit(-1);
       }
-      else if (!file.exists() && tmpPropertiesFile.exists()) {
-        // rename upgraded system.properties.tmp to system.properties
-        FileUtils.moveFile(tmpPropertiesFile, file);
-        logger.info(" {} has been upgraded.", file.getAbsolutePath());
-        checkProperties();
-        return;
+
+      // write properties to system.properties
+      try (FileOutputStream outputStream = new FileOutputStream(propertiesFile)) {
+        systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+        properties.store(outputStream, SYSTEM_PROPERTIES_STRING);
       }
-    } catch (IOException e) {
-      logger.error("Can not create {}.", file.getAbsolutePath(), e);
-    }
-    
-    // get existed properties from system_properties.txt
-    File inputFile = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    try (FileInputStream inputStream = new FileInputStream(inputFile.toString())) {
+      return;
+    }
+
+    if (!propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // rename tmp file to system.properties, no need to check
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
+      logger.info("rename {} to {}", tmpPropertiesFile, propertiesFile);
+      return;
+    } else if (propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // both files exist, remove tmp file
+      FileUtils.forceDeleteOnExit(tmpPropertiesFile);
+      logger.info("remove {}", tmpPropertiesFile);
+    }
+
+    // no tmp file, read properties from system.properties
+    try (FileInputStream inputStream = new FileInputStream(propertiesFile)) {
       properties.load(new InputStreamReader(inputStream, TSFileConfig.STRING_CHARSET));
-      // need to upgrade
-      if (!properties.containsKey("iotdb_version")) {
+      // need to upgrade from 0.9 to 0.10
+      if (!properties.containsKey(IOTDB_VERSION_STRING)) {
         checkUnClosedTsFileV1();
-        upgradeMlog();
-      } else {
-        checkProperties();
-        return;
+        MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
+        upgradePropertiesFile();
       }
-    } catch (IOException e) {
-      logger.error("Load system.properties from {} failed.", file.getAbsolutePath(), e);
+      checkProperties();
+    }
+  }
+
+  /**
+   * upgrade 0.9 properties to 0.10 properties
+   */
+  private void upgradePropertiesFile()
+      throws IOException {
+    // create an empty tmpPropertiesFile
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
     }
 
-    // if tmpPropertiesFile exists, remove it
-    if (tmpPropertiesFile.exists()) {
-      try {
-        Files.delete(tmpPropertiesFile.toPath());
-      } catch (IOException e) {
-        logger.error("Fail to remove broken file {}", tmpPropertiesFile);
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      properties.setProperty(PARTITION_INTERVAL_STRING, String.valueOf(partitionInterval));
+      properties.setProperty(TSFILE_FILE_SYSTEM_STRING, tsfileFileSystem);
+      properties.setProperty(IOTDB_VERSION_STRING, iotdbVersion);
+      properties.setProperty(ENABLE_PARTITION_STRING, String.valueOf(enablePartition));
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
+
+      // upgrade finished, delete old system.properties file
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
+      // rename system.properties.tmp to system.properties
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
+  }
+
+
+  /**
+   *  repair 0.10 properties
+   */
+  private void upgradePropertiesFileFromBrokenFile()
+      throws IOException {
     // create an empty tmpPropertiesFile
-    try {
-      if (tmpPropertiesFile.createNewFile()) {
-        logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
-      }
-    } catch (IOException e) {
-      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile, e);
-    }
-    // try to add the storage_group_time_range, tsfile_storage_fs 
-    // and iotdb_version property in system.properties.tmp
-    try (FileOutputStream outputStream = new FileOutputStream(tmpPropertiesFile.toString())) {
-      properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-      properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-      properties.setProperty("iotdb_version", iotdbVersion);
-      properties.store(outputStream, "System properties:");
-      checkProperties();
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
+    }
+
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
       // upgrade finished, delete old system.properties file
-      if (file.exists()) {
-        Files.delete(file.toPath());
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
       // rename system.properties.tmp to system.properties
-      FileUtils.moveFile(tmpPropertiesFile, file);
-    }  catch (IOException e) {
-      logger.error("Something went wrong while upgrading teh system.properties. The file is {}.", file.getAbsolutePath(), e);
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
-
   }
 
-  private void checkProperties() {
-    if (!properties.getProperty("timestamp_precision").equals(timestampPrecision)) {
-      logger.error("Wrong timestamp precision, please set as: " + properties
-              .getProperty("timestamp_precision") + " !");
-      System.exit(-1);
+  private void checkProperties() throws IOException {
+    for (Entry<String, String> entry : systemProperties.entrySet()) {
+      if (!properties.contains(entry.getKey())) {
+        upgradePropertiesFileFromBrokenFile();
+        logger.info("repair system.properties, lack {}", entry.getKey());
+      }
     }
-    if (!(Long.parseLong(properties.getProperty("storage_group_time_range"))
-            == partitionInterval)) {
-      logger.error("Wrong storage group time range, please set as: " + properties
-              .getProperty("storage_group_time_range") + " !");
+
+    if (!properties.getProperty(TIMESTAMP_PRECISION_STRING).equals(timestampPrecision)) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: " + properties
+          .getProperty(TIMESTAMP_PRECISION_STRING) + " !");
       System.exit(-1);
     }
-    if (!(properties.getProperty("tsfile_storage_fs").equals(tsfileFileSystem))) {
-      logger.error("Wrong tsfile file system, please set as: " + properties
-              .getProperty("tsfile_storage_fs") + " !");
+
+    if (!(Long.parseLong(properties.getProperty(PARTITION_INTERVAL_STRING))
+        == partitionInterval)) {
+      logger.error("Wrong " + PARTITION_INTERVAL_STRING + ", please set as: " + properties
+          .getProperty(PARTITION_INTERVAL_STRING) + " !");
       System.exit(-1);
     }
-  }
 
-  private void upgradeMlog() {
-    try {
-      MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
-    } catch (IOException e) {
-      logger.error("Upgrade mlog.txt from {} failed.", SCHEMA_DIR, e);
+    if (!(properties.getProperty(TSFILE_FILE_SYSTEM_STRING).equals(tsfileFileSystem))) {
+      logger.error("Wrong " + TSFILE_FILE_SYSTEM_STRING + ", please set as: " + properties
+          .getProperty(TSFILE_FILE_SYSTEM_STRING) + " !");

Review comment:
       fixed

##########
File path: server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
##########
@@ -37,182 +40,242 @@
 
 public class IoTDBConfigCheck {
 
+  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
+
   // this file is located in data/system/schema/system.properties
   // If user delete folder "data", system.properties can reset.
-  public static final String PROPERTIES_FILE_NAME = "system.properties";
-  public static final String SCHEMA_DIR =
-          IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
-  public static final String WAL_DIR =
-      IoTDBDescriptor.getInstance().getConfig().getWalFolder();
-  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
-  // this is a initial parameter.
-  private static String timestampPrecision = "ms";
-  private static long partitionInterval = 86400;
-  private static String tsfileFileSystem = "LOCAL";
-  private static String iotdbVersion = "0.10.0";
+  private static final String PROPERTIES_FILE_NAME = "system.properties";
+  private static final String SCHEMA_DIR = IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
+  private static final String WAL_DIR = IoTDBDescriptor.getInstance().getConfig().getWalFolder();
+
+  File propertiesFile;
+  File tmpPropertiesFile;
+
   private Properties properties = new Properties();
 
+  private Map<String, String> systemProperties = new HashMap<>();
+
+  private static final String SYSTEM_PROPERTIES_STRING = "System properties:";
+
+  private static final String TIMESTAMP_PRECISION_STRING = "timestamp_precision";
+  private static String timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+
+  private static final String PARTITION_INTERVAL_STRING = "partition_interval";
+  private static long partitionInterval = IoTDBDescriptor.getInstance().getConfig().getPartitionInterval();
+
+  private static final String TSFILE_FILE_SYSTEM_STRING = "tsfile_storage_fs";
+  private static String tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
+
+  private static final String ENABLE_PARTITION_STRING = "enable_partition";
+  private static boolean enablePartition = IoTDBDescriptor.getInstance().getConfig().isEnablePartition();
+
+  private static final String IOTDB_VERSION_STRING = "iotdb_version";
+  private static String iotdbVersion = "0.10.0";
+
   public static IoTDBConfigCheck getInstance() {
     return IoTDBConfigCheckHolder.INSTANCE;
   }
 
-  public void checkConfig() {
-    timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+  private static class IoTDBConfigCheckHolder {
+    private static final IoTDBConfigCheck INSTANCE = new IoTDBConfigCheck();
+  }
+
+  private IoTDBConfigCheck() {
+    logger.info("Starting IoTDB " + iotdbVersion);
+
+    // check whether SCHEMA_DIR exists, create if not exists
+    File dir = SystemFileFactory.INSTANCE.getFile(SCHEMA_DIR);
+    if (!dir.exists()) {
+      if (!dir.mkdirs()) {
+        logger.error("can not create schema dir: {}", SCHEMA_DIR);
+        System.exit(-1);
+      } else {
+        logger.info(" {} dir has been created.", SCHEMA_DIR);
+      }
+    }
 
     // check time stamp precision
     if (!(timestampPrecision.equals("ms") || timestampPrecision.equals("us")
-            || timestampPrecision.equals("ns"))) {
-      logger.error("Wrong timestamp precision, please set as: ms, us or ns ! Current is: "
-              + timestampPrecision);
+        || timestampPrecision.equals("ns"))) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: ms, us or ns ! Current is: "
+          + timestampPrecision);
       System.exit(-1);
     }
 
-    partitionInterval = IoTDBDescriptor.getInstance().getConfig()
-            .getPartitionInterval();
+    if (!enablePartition) {
+      partitionInterval = Long.MAX_VALUE;
+    }
 
     // check partition interval
     if (partitionInterval <= 0) {
       logger.error("Partition interval must larger than 0!");
       System.exit(-1);
     }
 
-    tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
-    createDir(SCHEMA_DIR);
-    checkFile(SCHEMA_DIR);
-    logger.info("System configuration is ok.");
-    
+    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, iotdbVersion);
   }
 
-  private void createDir(String filepath) {
-    File dir = SystemFileFactory.INSTANCE.getFile(filepath);
-    if (!dir.exists()) {
-      dir.mkdirs();
-      logger.info(" {} dir has been created.", SCHEMA_DIR);
-    }
-  }
 
-  private void checkFile(String filepath) {
-    // create file : read timestamp precision from engine.properties, create system.properties
-    // use output stream to write timestamp precision to file.
-    File file = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    File tmpPropertiesFile = new File(file.getAbsoluteFile() + ".tmp");
-    try {
-      if (!file.exists() && !tmpPropertiesFile.exists()) {
-        file.createNewFile();
-        logger.info(" {} has been created.", file.getAbsolutePath());
-        try (FileOutputStream outputStream = new FileOutputStream(file.toString())) {
-          properties.setProperty("timestamp_precision", timestampPrecision);
-          properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-          properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-          properties.setProperty("iotdb_version", iotdbVersion);
-          properties.store(outputStream, "System properties:");
-        }
-        return;
+  /**
+   * check configuration in system.properties when starting IoTDB
+   *
+   * When init: create system.properties directly
+   *
+   * When upgrading the system.properties:
+   * (1) create system.properties.tmp
+   * (2) delete system.properties
+   * (2) rename system.properties.tmp to system.properties
+   */
+  public void checkConfig() throws IOException {
+    propertiesFile = SystemFileFactory.INSTANCE
+            .getFile(IoTDBConfigCheck.SCHEMA_DIR + File.separator + PROPERTIES_FILE_NAME);
+    tmpPropertiesFile = new File(propertiesFile.getAbsoluteFile() + ".tmp");
+
+    // system init first time, no need to check, write system.properties and return
+    if (!propertiesFile.exists() && !tmpPropertiesFile.exists()) {
+      // create system.properties
+      if (propertiesFile.createNewFile()) {
+        logger.info(" {} has been created.", propertiesFile.getAbsolutePath());
+      } else {
+        logger.error("can not create {}", propertiesFile.getAbsolutePath());
+        System.exit(-1);
       }
-      else if (!file.exists() && tmpPropertiesFile.exists()) {
-        // rename upgraded system.properties.tmp to system.properties
-        FileUtils.moveFile(tmpPropertiesFile, file);
-        logger.info(" {} has been upgraded.", file.getAbsolutePath());
-        checkProperties();
-        return;
+
+      // write properties to system.properties
+      try (FileOutputStream outputStream = new FileOutputStream(propertiesFile)) {
+        systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+        properties.store(outputStream, SYSTEM_PROPERTIES_STRING);
       }
-    } catch (IOException e) {
-      logger.error("Can not create {}.", file.getAbsolutePath(), e);
-    }
-    
-    // get existed properties from system_properties.txt
-    File inputFile = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    try (FileInputStream inputStream = new FileInputStream(inputFile.toString())) {
+      return;
+    }
+
+    if (!propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // rename tmp file to system.properties, no need to check
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
+      logger.info("rename {} to {}", tmpPropertiesFile, propertiesFile);
+      return;
+    } else if (propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // both files exist, remove tmp file
+      FileUtils.forceDeleteOnExit(tmpPropertiesFile);
+      logger.info("remove {}", tmpPropertiesFile);
+    }
+
+    // no tmp file, read properties from system.properties
+    try (FileInputStream inputStream = new FileInputStream(propertiesFile)) {
       properties.load(new InputStreamReader(inputStream, TSFileConfig.STRING_CHARSET));
-      // need to upgrade
-      if (!properties.containsKey("iotdb_version")) {
+      // need to upgrade from 0.9 to 0.10
+      if (!properties.containsKey(IOTDB_VERSION_STRING)) {
         checkUnClosedTsFileV1();
-        upgradeMlog();
-      } else {
-        checkProperties();
-        return;
+        MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
+        upgradePropertiesFile();
       }
-    } catch (IOException e) {
-      logger.error("Load system.properties from {} failed.", file.getAbsolutePath(), e);
+      checkProperties();
+    }
+  }
+
+  /**
+   * upgrade 0.9 properties to 0.10 properties
+   */
+  private void upgradePropertiesFile()
+      throws IOException {
+    // create an empty tmpPropertiesFile
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
     }
 
-    // if tmpPropertiesFile exists, remove it
-    if (tmpPropertiesFile.exists()) {
-      try {
-        Files.delete(tmpPropertiesFile.toPath());
-      } catch (IOException e) {
-        logger.error("Fail to remove broken file {}", tmpPropertiesFile);
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      properties.setProperty(PARTITION_INTERVAL_STRING, String.valueOf(partitionInterval));
+      properties.setProperty(TSFILE_FILE_SYSTEM_STRING, tsfileFileSystem);
+      properties.setProperty(IOTDB_VERSION_STRING, iotdbVersion);
+      properties.setProperty(ENABLE_PARTITION_STRING, String.valueOf(enablePartition));
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
+
+      // upgrade finished, delete old system.properties file
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
+      // rename system.properties.tmp to system.properties
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
+  }
+
+
+  /**
+   *  repair 0.10 properties
+   */
+  private void upgradePropertiesFileFromBrokenFile()
+      throws IOException {
     // create an empty tmpPropertiesFile
-    try {
-      if (tmpPropertiesFile.createNewFile()) {
-        logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
-      }
-    } catch (IOException e) {
-      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile, e);
-    }
-    // try to add the storage_group_time_range, tsfile_storage_fs 
-    // and iotdb_version property in system.properties.tmp
-    try (FileOutputStream outputStream = new FileOutputStream(tmpPropertiesFile.toString())) {
-      properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-      properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-      properties.setProperty("iotdb_version", iotdbVersion);
-      properties.store(outputStream, "System properties:");
-      checkProperties();
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
+    }
+
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
       // upgrade finished, delete old system.properties file
-      if (file.exists()) {
-        Files.delete(file.toPath());
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
       // rename system.properties.tmp to system.properties
-      FileUtils.moveFile(tmpPropertiesFile, file);
-    }  catch (IOException e) {
-      logger.error("Something went wrong while upgrading teh system.properties. The file is {}.", file.getAbsolutePath(), e);
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
-
   }
 
-  private void checkProperties() {
-    if (!properties.getProperty("timestamp_precision").equals(timestampPrecision)) {
-      logger.error("Wrong timestamp precision, please set as: " + properties
-              .getProperty("timestamp_precision") + " !");
-      System.exit(-1);
+  private void checkProperties() throws IOException {
+    for (Entry<String, String> entry : systemProperties.entrySet()) {
+      if (!properties.contains(entry.getKey())) {
+        upgradePropertiesFileFromBrokenFile();
+        logger.info("repair system.properties, lack {}", entry.getKey());
+      }
     }
-    if (!(Long.parseLong(properties.getProperty("storage_group_time_range"))
-            == partitionInterval)) {
-      logger.error("Wrong storage group time range, please set as: " + properties
-              .getProperty("storage_group_time_range") + " !");
+
+    if (!properties.getProperty(TIMESTAMP_PRECISION_STRING).equals(timestampPrecision)) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: " + properties
+          .getProperty(TIMESTAMP_PRECISION_STRING) + " !");
       System.exit(-1);
     }
-    if (!(properties.getProperty("tsfile_storage_fs").equals(tsfileFileSystem))) {
-      logger.error("Wrong tsfile file system, please set as: " + properties
-              .getProperty("tsfile_storage_fs") + " !");
+
+    if (!(Long.parseLong(properties.getProperty(PARTITION_INTERVAL_STRING))
+        == partitionInterval)) {

Review comment:
       fixed

##########
File path: server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
##########
@@ -37,182 +40,242 @@
 
 public class IoTDBConfigCheck {
 
+  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
+
   // this file is located in data/system/schema/system.properties
   // If user delete folder "data", system.properties can reset.
-  public static final String PROPERTIES_FILE_NAME = "system.properties";
-  public static final String SCHEMA_DIR =
-          IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
-  public static final String WAL_DIR =
-      IoTDBDescriptor.getInstance().getConfig().getWalFolder();
-  private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
-  // this is a initial parameter.
-  private static String timestampPrecision = "ms";
-  private static long partitionInterval = 86400;
-  private static String tsfileFileSystem = "LOCAL";
-  private static String iotdbVersion = "0.10.0";
+  private static final String PROPERTIES_FILE_NAME = "system.properties";
+  private static final String SCHEMA_DIR = IoTDBDescriptor.getInstance().getConfig().getSchemaDir();
+  private static final String WAL_DIR = IoTDBDescriptor.getInstance().getConfig().getWalFolder();
+
+  File propertiesFile;
+  File tmpPropertiesFile;
+
   private Properties properties = new Properties();
 
+  private Map<String, String> systemProperties = new HashMap<>();
+
+  private static final String SYSTEM_PROPERTIES_STRING = "System properties:";
+
+  private static final String TIMESTAMP_PRECISION_STRING = "timestamp_precision";
+  private static String timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+
+  private static final String PARTITION_INTERVAL_STRING = "partition_interval";
+  private static long partitionInterval = IoTDBDescriptor.getInstance().getConfig().getPartitionInterval();
+
+  private static final String TSFILE_FILE_SYSTEM_STRING = "tsfile_storage_fs";
+  private static String tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
+
+  private static final String ENABLE_PARTITION_STRING = "enable_partition";
+  private static boolean enablePartition = IoTDBDescriptor.getInstance().getConfig().isEnablePartition();
+
+  private static final String IOTDB_VERSION_STRING = "iotdb_version";
+  private static String iotdbVersion = "0.10.0";
+
   public static IoTDBConfigCheck getInstance() {
     return IoTDBConfigCheckHolder.INSTANCE;
   }
 
-  public void checkConfig() {
-    timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+  private static class IoTDBConfigCheckHolder {
+    private static final IoTDBConfigCheck INSTANCE = new IoTDBConfigCheck();
+  }
+
+  private IoTDBConfigCheck() {
+    logger.info("Starting IoTDB " + iotdbVersion);
+
+    // check whether SCHEMA_DIR exists, create if not exists
+    File dir = SystemFileFactory.INSTANCE.getFile(SCHEMA_DIR);
+    if (!dir.exists()) {
+      if (!dir.mkdirs()) {
+        logger.error("can not create schema dir: {}", SCHEMA_DIR);
+        System.exit(-1);
+      } else {
+        logger.info(" {} dir has been created.", SCHEMA_DIR);
+      }
+    }
 
     // check time stamp precision
     if (!(timestampPrecision.equals("ms") || timestampPrecision.equals("us")
-            || timestampPrecision.equals("ns"))) {
-      logger.error("Wrong timestamp precision, please set as: ms, us or ns ! Current is: "
-              + timestampPrecision);
+        || timestampPrecision.equals("ns"))) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: ms, us or ns ! Current is: "
+          + timestampPrecision);
       System.exit(-1);
     }
 
-    partitionInterval = IoTDBDescriptor.getInstance().getConfig()
-            .getPartitionInterval();
+    if (!enablePartition) {
+      partitionInterval = Long.MAX_VALUE;
+    }
 
     // check partition interval
     if (partitionInterval <= 0) {
       logger.error("Partition interval must larger than 0!");
       System.exit(-1);
     }
 
-    tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();
-    createDir(SCHEMA_DIR);
-    checkFile(SCHEMA_DIR);
-    logger.info("System configuration is ok.");
-    
+    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, iotdbVersion);
   }
 
-  private void createDir(String filepath) {
-    File dir = SystemFileFactory.INSTANCE.getFile(filepath);
-    if (!dir.exists()) {
-      dir.mkdirs();
-      logger.info(" {} dir has been created.", SCHEMA_DIR);
-    }
-  }
 
-  private void checkFile(String filepath) {
-    // create file : read timestamp precision from engine.properties, create system.properties
-    // use output stream to write timestamp precision to file.
-    File file = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    File tmpPropertiesFile = new File(file.getAbsoluteFile() + ".tmp");
-    try {
-      if (!file.exists() && !tmpPropertiesFile.exists()) {
-        file.createNewFile();
-        logger.info(" {} has been created.", file.getAbsolutePath());
-        try (FileOutputStream outputStream = new FileOutputStream(file.toString())) {
-          properties.setProperty("timestamp_precision", timestampPrecision);
-          properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-          properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-          properties.setProperty("iotdb_version", iotdbVersion);
-          properties.store(outputStream, "System properties:");
-        }
-        return;
+  /**
+   * check configuration in system.properties when starting IoTDB
+   *
+   * When init: create system.properties directly
+   *
+   * When upgrading the system.properties:
+   * (1) create system.properties.tmp
+   * (2) delete system.properties
+   * (2) rename system.properties.tmp to system.properties
+   */
+  public void checkConfig() throws IOException {
+    propertiesFile = SystemFileFactory.INSTANCE
+            .getFile(IoTDBConfigCheck.SCHEMA_DIR + File.separator + PROPERTIES_FILE_NAME);
+    tmpPropertiesFile = new File(propertiesFile.getAbsoluteFile() + ".tmp");
+
+    // system init first time, no need to check, write system.properties and return
+    if (!propertiesFile.exists() && !tmpPropertiesFile.exists()) {
+      // create system.properties
+      if (propertiesFile.createNewFile()) {
+        logger.info(" {} has been created.", propertiesFile.getAbsolutePath());
+      } else {
+        logger.error("can not create {}", propertiesFile.getAbsolutePath());
+        System.exit(-1);
       }
-      else if (!file.exists() && tmpPropertiesFile.exists()) {
-        // rename upgraded system.properties.tmp to system.properties
-        FileUtils.moveFile(tmpPropertiesFile, file);
-        logger.info(" {} has been upgraded.", file.getAbsolutePath());
-        checkProperties();
-        return;
+
+      // write properties to system.properties
+      try (FileOutputStream outputStream = new FileOutputStream(propertiesFile)) {
+        systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+        properties.store(outputStream, SYSTEM_PROPERTIES_STRING);
       }
-    } catch (IOException e) {
-      logger.error("Can not create {}.", file.getAbsolutePath(), e);
-    }
-    
-    // get existed properties from system_properties.txt
-    File inputFile = SystemFileFactory.INSTANCE
-            .getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
-    try (FileInputStream inputStream = new FileInputStream(inputFile.toString())) {
+      return;
+    }
+
+    if (!propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // rename tmp file to system.properties, no need to check
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
+      logger.info("rename {} to {}", tmpPropertiesFile, propertiesFile);
+      return;
+    } else if (propertiesFile.exists() && tmpPropertiesFile.exists()) {
+      // both files exist, remove tmp file
+      FileUtils.forceDeleteOnExit(tmpPropertiesFile);
+      logger.info("remove {}", tmpPropertiesFile);
+    }
+
+    // no tmp file, read properties from system.properties
+    try (FileInputStream inputStream = new FileInputStream(propertiesFile)) {
       properties.load(new InputStreamReader(inputStream, TSFileConfig.STRING_CHARSET));
-      // need to upgrade
-      if (!properties.containsKey("iotdb_version")) {
+      // need to upgrade from 0.9 to 0.10
+      if (!properties.containsKey(IOTDB_VERSION_STRING)) {
         checkUnClosedTsFileV1();
-        upgradeMlog();
-      } else {
-        checkProperties();
-        return;
+        MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
+        upgradePropertiesFile();
       }
-    } catch (IOException e) {
-      logger.error("Load system.properties from {} failed.", file.getAbsolutePath(), e);
+      checkProperties();
+    }
+  }
+
+  /**
+   * upgrade 0.9 properties to 0.10 properties
+   */
+  private void upgradePropertiesFile()
+      throws IOException {
+    // create an empty tmpPropertiesFile
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
     }
 
-    // if tmpPropertiesFile exists, remove it
-    if (tmpPropertiesFile.exists()) {
-      try {
-        Files.delete(tmpPropertiesFile.toPath());
-      } catch (IOException e) {
-        logger.error("Fail to remove broken file {}", tmpPropertiesFile);
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      properties.setProperty(PARTITION_INTERVAL_STRING, String.valueOf(partitionInterval));
+      properties.setProperty(TSFILE_FILE_SYSTEM_STRING, tsfileFileSystem);
+      properties.setProperty(IOTDB_VERSION_STRING, iotdbVersion);
+      properties.setProperty(ENABLE_PARTITION_STRING, String.valueOf(enablePartition));
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
+
+      // upgrade finished, delete old system.properties file
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
+      // rename system.properties.tmp to system.properties
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
+  }
+
+
+  /**
+   *  repair 0.10 properties
+   */
+  private void upgradePropertiesFileFromBrokenFile()
+      throws IOException {
     // create an empty tmpPropertiesFile
-    try {
-      if (tmpPropertiesFile.createNewFile()) {
-        logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
-      }
-    } catch (IOException e) {
-      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile, e);
-    }
-    // try to add the storage_group_time_range, tsfile_storage_fs 
-    // and iotdb_version property in system.properties.tmp
-    try (FileOutputStream outputStream = new FileOutputStream(tmpPropertiesFile.toString())) {
-      properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
-      properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
-      properties.setProperty("iotdb_version", iotdbVersion);
-      properties.store(outputStream, "System properties:");
-      checkProperties();
+    if (tmpPropertiesFile.createNewFile()) {
+      logger.info("Create system.properties.tmp {}.", tmpPropertiesFile);
+    } else {
+      logger.error("Create system.properties.tmp {} failed.", tmpPropertiesFile);
+      System.exit(-1);
+    }
+
+    try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
+      systemProperties.forEach((k, v) -> properties.setProperty(k, v));
+
+      properties.store(tmpFOS, SYSTEM_PROPERTIES_STRING);
       // upgrade finished, delete old system.properties file
-      if (file.exists()) {
-        Files.delete(file.toPath());
+      if (propertiesFile.exists()) {
+        Files.delete(propertiesFile.toPath());
       }
       // rename system.properties.tmp to system.properties
-      FileUtils.moveFile(tmpPropertiesFile, file);
-    }  catch (IOException e) {
-      logger.error("Something went wrong while upgrading teh system.properties. The file is {}.", file.getAbsolutePath(), e);
+      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
-
   }
 
-  private void checkProperties() {
-    if (!properties.getProperty("timestamp_precision").equals(timestampPrecision)) {
-      logger.error("Wrong timestamp precision, please set as: " + properties
-              .getProperty("timestamp_precision") + " !");
-      System.exit(-1);
+  private void checkProperties() throws IOException {
+    for (Entry<String, String> entry : systemProperties.entrySet()) {
+      if (!properties.contains(entry.getKey())) {
+        upgradePropertiesFileFromBrokenFile();
+        logger.info("repair system.properties, lack {}", entry.getKey());
+      }
     }
-    if (!(Long.parseLong(properties.getProperty("storage_group_time_range"))
-            == partitionInterval)) {
-      logger.error("Wrong storage group time range, please set as: " + properties
-              .getProperty("storage_group_time_range") + " !");
+
+    if (!properties.getProperty(TIMESTAMP_PRECISION_STRING).equals(timestampPrecision)) {
+      logger.error("Wrong " + TIMESTAMP_PRECISION_STRING + ", please set as: " + properties
+          .getProperty(TIMESTAMP_PRECISION_STRING) + " !");

Review comment:
       fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] commented on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633198816


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [9 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] removed a comment on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633053368


   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B.png' alt='B' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] samperson1997 commented on a change in pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
samperson1997 commented on a change in pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#discussion_r429553263



##########
File path: server/src/assembly/resources/conf/iotdb-engine.properties
##########
@@ -212,7 +216,7 @@ chunk_buffer_pool_enable=false
 # For example, your partitionInterval is 86400 and you want to insert data in 5 different days,
 # you should set this param >= 5
 # default number is 5

Review comment:
       ```suggestion
   # default number is 1
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] qiaojialin merged pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
qiaojialin merged pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] commented on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633176382


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [16 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] commented on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633176447


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [16 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] removed a comment on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633176382


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [16 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] commented on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633053368


   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B.png' alt='B' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#discussion_r429597172



##########
File path: server/src/assembly/resources/conf/iotdb-engine.properties
##########
@@ -212,7 +216,7 @@ chunk_buffer_pool_enable=false
 # For example, your partitionInterval is 86400 and you want to insert data in 5 different days,
 # you should set this param >= 5
 # default number is 5

Review comment:
       fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] removed a comment on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633180369


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [14 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] qiaojialin commented on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633176010


   > The line 519 in `IoTDBConfig.java` is `private int concurrentWritingTimePartition = 10;`.
   > Shouldn't we change the number to 1?
   
   Yes, fixed


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] sonarcloud[bot] commented on pull request #1248: [IOTDB-697] add enablePartition in config

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #1248:
URL: https://github.com/apache/incubator-iotdb/pull/1248#issuecomment-633180369


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL) [14 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=1248&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=1248&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org