You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/12/15 12:20:42 UTC

[iotdb] 02/03: Last WAL UT

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

jackietien pushed a commit to branch DeleteStaleQueryCode
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 61c2ca51a0c858efcaca81a5d83dbcb52199dc0d
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Thu Dec 15 18:25:59 2022 +0800

    Last WAL UT
---
 .../storagegroup/StorageGroupSchemaManager.java    |    2 +-
 .../db/mpp/plan/execution/QueryExecution.java      |   27 +-
 .../db/mpp/plan/scheduler/StandaloneScheduler.java |  222 ----
 .../iotdb/db/engine/cache/ChunkCacheTest.java      |   19 -
 .../InnerSeqCompactionWithFastPerformerTest.java   |   17 -
 .../InnerUnseqCompactionWithFastPerformerTest.java |   19 -
 .../LocalConfigNodeMultiDataRegionTest.java        |   94 --
 .../apache/iotdb/db/metadata/SchemaBasicTest.java  | 1199 --------------------
 .../db/metadata/multimode/SchemaDiskModeTest.java  |   42 -
 .../metadata/multimode/SchemaFullMemoryTest.java   |   29 -
 .../metadata/multimode/SchemaMemoryModeTest.java   |   35 -
 .../db/metadata/multimode/SchemaNonMemoryTest.java |   29 -
 .../multimode/SchemaPartialMemoryTest.java         |   28 -
 .../plan/scheduler/StandaloneSchedulerTest.java    |  547 ---------
 .../apache/iotdb/db/utils/EnvironmentUtils.java    |   22 +
 15 files changed, 32 insertions(+), 2299 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/storagegroup/StorageGroupSchemaManager.java b/server/src/main/java/org/apache/iotdb/db/metadata/storagegroup/StorageGroupSchemaManager.java
index d6689f794a..eb8373a962 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/storagegroup/StorageGroupSchemaManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/storagegroup/StorageGroupSchemaManager.java
@@ -58,7 +58,7 @@ public class StorageGroupSchemaManager implements IStorageGroupSchemaManager {
 
     mtree = new ConfigMTree();
 
-    recoverLog();
+    //    recoverLog();
   }
 
   public void recoverLog() throws IOException {
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
index 7cfa0a3fa1..99a7f606c7 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
@@ -51,7 +51,6 @@ import org.apache.iotdb.db.mpp.plan.planner.plan.LogicalQueryPlan;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNodeUtil;
 import org.apache.iotdb.db.mpp.plan.scheduler.ClusterScheduler;
 import org.apache.iotdb.db.mpp.plan.scheduler.IScheduler;
-import org.apache.iotdb.db.mpp.plan.scheduler.StandaloneScheduler;
 import org.apache.iotdb.db.mpp.plan.scheduler.load.LoadTsFileScheduler;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
 import org.apache.iotdb.db.mpp.plan.statement.crud.InsertBaseStatement;
@@ -268,23 +267,15 @@ public class QueryExecution implements IQueryExecution {
     }
     // TODO: (xingtanzjr) initialize the query scheduler according to configuration
     this.scheduler =
-        config.isClusterMode()
-            ? new ClusterScheduler(
-                context,
-                stateMachine,
-                distributedPlan.getInstances(),
-                context.getQueryType(),
-                executor,
-                writeOperationExecutor,
-                scheduledExecutor,
-                internalServiceClientManager)
-            : new StandaloneScheduler(
-                context,
-                stateMachine,
-                distributedPlan.getInstances(),
-                context.getQueryType(),
-                scheduledExecutor,
-                internalServiceClientManager);
+        new ClusterScheduler(
+            context,
+            stateMachine,
+            distributedPlan.getInstances(),
+            context.getQueryType(),
+            executor,
+            writeOperationExecutor,
+            scheduledExecutor,
+            internalServiceClientManager);
     this.scheduler.start();
   }
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneScheduler.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneScheduler.java
deleted file mode 100644
index 7e06bd5e38..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneScheduler.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.mpp.plan.scheduler;
-
-import org.apache.iotdb.common.rpc.thrift.TEndPoint;
-import org.apache.iotdb.common.rpc.thrift.TSStatus;
-import org.apache.iotdb.commons.client.IClientManager;
-import org.apache.iotdb.commons.client.sync.SyncDataNodeInternalServiceClient;
-import org.apache.iotdb.commons.conf.CommonDescriptor;
-import org.apache.iotdb.commons.consensus.ConsensusGroupId;
-import org.apache.iotdb.commons.consensus.DataRegionId;
-import org.apache.iotdb.commons.consensus.SchemaRegionId;
-import org.apache.iotdb.db.engine.StorageEngine;
-import org.apache.iotdb.db.engine.storagegroup.DataRegion;
-import org.apache.iotdb.db.exception.WriteProcessException;
-import org.apache.iotdb.db.metadata.schemaregion.ISchemaRegion;
-import org.apache.iotdb.db.metadata.schemaregion.SchemaEngine;
-import org.apache.iotdb.db.mpp.common.FragmentInstanceId;
-import org.apache.iotdb.db.mpp.common.MPPQueryContext;
-import org.apache.iotdb.db.mpp.common.PlanFragmentId;
-import org.apache.iotdb.db.mpp.execution.QueryStateMachine;
-import org.apache.iotdb.db.mpp.execution.fragment.FragmentInfo;
-import org.apache.iotdb.db.mpp.execution.fragment.FragmentInstanceInfo;
-import org.apache.iotdb.db.mpp.execution.fragment.FragmentInstanceManager;
-import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.analyze.SchemaValidator;
-import org.apache.iotdb.db.mpp.plan.planner.plan.FragmentInstance;
-import org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNode;
-import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertNode;
-import org.apache.iotdb.rpc.RpcUtils;
-import org.apache.iotdb.rpc.TSStatusCode;
-
-import io.airlift.units.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.concurrent.ScheduledExecutorService;
-
-public class StandaloneScheduler implements IScheduler {
-
-  private static final StorageEngine STORAGE_ENGINE = StorageEngine.getInstance();
-
-  private static final SchemaEngine SCHEMA_ENGINE = SchemaEngine.getInstance();
-
-  private static final Logger LOGGER = LoggerFactory.getLogger(StandaloneScheduler.class);
-
-  private final MPPQueryContext queryContext;
-  // The stateMachine of the QueryExecution owned by this QueryScheduler
-  private final QueryStateMachine stateMachine;
-  private final QueryType queryType;
-  // The fragment instances which should be sent to corresponding Nodes.
-  private final List<FragmentInstance> instances;
-
-  private final IFragInstanceStateTracker stateTracker;
-
-  public StandaloneScheduler(
-      MPPQueryContext queryContext,
-      QueryStateMachine stateMachine,
-      List<FragmentInstance> instances,
-      QueryType queryType,
-      ScheduledExecutorService scheduledExecutor,
-      IClientManager<TEndPoint, SyncDataNodeInternalServiceClient> internalServiceClientManager) {
-    this.queryContext = queryContext;
-    this.instances = instances;
-    this.queryType = queryType;
-    this.stateMachine = stateMachine;
-    this.stateTracker =
-        new FixedRateFragInsStateTracker(
-            stateMachine, scheduledExecutor, instances, internalServiceClientManager);
-  }
-
-  @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning
-  @Override
-  public void start() {
-    stateMachine.transitionToDispatching();
-    // For the FragmentInstance of WRITE, it will be executed directly when dispatching.
-    // TODO: Other QueryTypes
-    switch (queryType) {
-      case READ:
-        try {
-          for (FragmentInstance fragmentInstance : instances) {
-            ConsensusGroupId groupId =
-                ConsensusGroupId.Factory.createFromTConsensusGroupId(
-                    fragmentInstance.getRegionReplicaSet().getRegionId());
-            if (groupId instanceof DataRegionId) {
-              DataRegion region = StorageEngine.getInstance().getDataRegion((DataRegionId) groupId);
-              FragmentInstanceInfo info =
-                  FragmentInstanceManager.getInstance()
-                      .execDataQueryFragmentInstance(fragmentInstance, region);
-              // query dispatch failed
-              if (info.getState().isFailed()) {
-                stateMachine.transitionToFailed(
-                    RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, info.getMessage()));
-                return;
-              }
-            } else {
-              ISchemaRegion region =
-                  SchemaEngine.getInstance().getSchemaRegion((SchemaRegionId) groupId);
-              FragmentInstanceManager.getInstance()
-                  .execSchemaQueryFragmentInstance(fragmentInstance, region);
-            }
-          }
-        } catch (Exception e) {
-          stateMachine.transitionToFailed(e);
-          LOGGER.info("transit to FAILED");
-          return;
-        }
-        // The FragmentInstances has been dispatched successfully to corresponding host, we mark the
-        stateMachine.transitionToRunning();
-        LOGGER.info("transit to RUNNING");
-        this.stateTracker.start();
-        LOGGER.info("state tracker starts");
-        break;
-      case WRITE:
-        // reject non-query operations when system is read-only
-        if (CommonDescriptor.getInstance().getConfig().isReadOnly()) {
-          TSStatus failedStatus = new TSStatus(TSStatusCode.SYSTEM_READ_ONLY.getStatusCode());
-          failedStatus.setMessage("Fail to do non-query operations because system is read-only.");
-          stateMachine.transitionToFailed(failedStatus);
-          return;
-        }
-        try {
-          for (FragmentInstance fragmentInstance : instances) {
-            PlanNode planNode = fragmentInstance.getFragment().getPlanNodeTree();
-            ConsensusGroupId groupId =
-                ConsensusGroupId.Factory.createFromTConsensusGroupId(
-                    fragmentInstance.getRegionReplicaSet().getRegionId());
-            boolean hasFailedMeasurement = false;
-            if (planNode instanceof InsertNode) {
-              InsertNode insertNode = (InsertNode) planNode;
-              SchemaValidator.validate(insertNode);
-              hasFailedMeasurement = insertNode.hasFailedMeasurements();
-              if (hasFailedMeasurement) {
-                LOGGER.warn(
-                    "Fail to insert measurements {} caused by {}",
-                    insertNode.getFailedMeasurements(),
-                    insertNode.getFailedMessages());
-              }
-            }
-
-            TSStatus executionResult;
-
-            if (groupId instanceof DataRegionId) {
-              executionResult = STORAGE_ENGINE.write((DataRegionId) groupId, planNode);
-            } else {
-              executionResult = SCHEMA_ENGINE.write((SchemaRegionId) groupId, planNode);
-            }
-
-            // partial insert
-            if (hasFailedMeasurement) {
-              InsertNode node = (InsertNode) planNode;
-              List<Exception> exceptions = node.getFailedExceptions();
-              throw new WriteProcessException(
-                  "failed to insert measurements "
-                      + node.getFailedMeasurements()
-                      + (!exceptions.isEmpty()
-                          ? (" caused by " + exceptions.get(0).getMessage())
-                          : ""));
-            }
-
-            if (executionResult.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-              LOGGER.error("Execute write operation error: {}", executionResult.getMessage());
-              stateMachine.transitionToFailed(executionResult);
-              return;
-            }
-          }
-          stateMachine.transitionToFinished();
-        } catch (Exception e) {
-          LOGGER.error("Execute write operation error ", e);
-          stateMachine.transitionToFailed(e);
-        }
-    }
-  }
-
-  @Override
-  public void stop() {
-    // TODO: It seems that it is unnecessary to check whether they are null or not. Is it a best
-    // practice ?
-    stateTracker.abort();
-    // TODO: (xingtanzjr) handle the exception when the termination cannot succeed
-    for (FragmentInstance fragmentInstance : instances) {
-      FragmentInstanceManager.getInstance().cancelTask(fragmentInstance.getId());
-    }
-  }
-
-  @Override
-  public Duration getTotalCpuTime() {
-    return null;
-  }
-
-  @Override
-  public FragmentInfo getFragmentInfo() {
-    return null;
-  }
-
-  @Override
-  public void abortFragmentInstance(FragmentInstanceId instanceId, Throwable failureCause) {}
-
-  @Override
-  public void cancelFragment(PlanFragmentId planFragmentId) {}
-
-  private String getLogHeader() {
-    return String.format("Query[%s]", queryContext.getQueryId());
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkCacheTest.java b/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkCacheTest.java
index 28517fe126..aa5f113c0b 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkCacheTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkCacheTest.java
@@ -20,13 +20,10 @@
 package org.apache.iotdb.db.engine.cache;
 
 import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.constant.TestConstant;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResourceStatus;
 import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.localconfignode.LocalConfigNode;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
 import org.apache.iotdb.db.query.control.FileReaderManager;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
@@ -52,7 +49,6 @@ import org.junit.Test;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 import static org.apache.iotdb.commons.conf.IoTDBConstant.PATH_SEPARATOR;
@@ -84,7 +80,6 @@ public class ChunkCacheTest {
     if (!tempSGDir.exists()) {
       Assert.assertTrue(tempSGDir.mkdirs());
     }
-    LocalConfigNode.getInstance().init();
     prepareSeries();
     prepareFiles(seqFileNum, unseqFileNum);
   }
@@ -96,7 +91,6 @@ public class ChunkCacheTest {
     unseqResources.clear();
     chunkCache.clear();
     TimeSeriesMetadataCache.getInstance().clear();
-    LocalConfigNode.getInstance().clear();
     EnvironmentUtils.cleanAllDir();
   }
 
@@ -147,19 +141,6 @@ public class ChunkCacheTest {
     for (int i = 0; i < deviceNum; i++) {
       deviceIds[i] = TEST_SG + PATH_SEPARATOR + "device" + i;
     }
-    LocalSchemaProcessor.getInstance().setStorageGroup(new PartialPath(TEST_SG));
-    for (String device : deviceIds) {
-      for (MeasurementSchema measurementSchema : measurementSchemas) {
-        PartialPath devicePath = new PartialPath(device);
-        LocalSchemaProcessor.getInstance()
-            .createTimeseries(
-                devicePath.concatNode(measurementSchema.getMeasurementId()),
-                measurementSchema.getType(),
-                measurementSchema.getEncodingType(),
-                measurementSchema.getCompressor(),
-                Collections.emptyMap());
-      }
-    }
   }
 
   void prepareFiles(int seqFileNum, int unseqFileNum) throws IOException, WriteProcessException {
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerSeqCompactionWithFastPerformerTest.java b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerSeqCompactionWithFastPerformerTest.java
index c0caba2c12..eea729b0a8 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerSeqCompactionWithFastPerformerTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerSeqCompactionWithFastPerformerTest.java
@@ -40,13 +40,9 @@ import org.apache.iotdb.db.engine.storagegroup.TsFileNameGenerator;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.exception.DataRegionException;
 import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.localconfignode.LocalConfigNode;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
 import org.apache.iotdb.tsfile.read.TimeValuePair;
 import org.apache.iotdb.tsfile.utils.Pair;
 
@@ -100,18 +96,6 @@ public class InnerSeqCompactionWithFastPerformerTest {
     prevMaxDegreeOfIndexNode = TSFileDescriptor.getInstance().getConfig().getMaxDegreeOfIndexNode();
     TSFileDescriptor.getInstance().getConfig().setMaxDegreeOfIndexNode(2);
     EnvironmentUtils.envSetUp();
-    LocalConfigNode.getInstance().init();
-    LocalSchemaProcessor.getInstance().setStorageGroup(new PartialPath(COMPACTION_TEST_SG));
-    for (String fullPath : fullPaths) {
-      PartialPath path = new PartialPath(fullPath);
-      LocalSchemaProcessor.getInstance()
-          .createTimeseries(
-              path,
-              TSDataType.INT64,
-              TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-              TSFileDescriptor.getInstance().getConfig().getCompressor(),
-              Collections.emptyMap());
-    }
   }
 
   @After
@@ -120,7 +104,6 @@ public class InnerSeqCompactionWithFastPerformerTest {
     CompactionClearUtils.clearAllCompactionFiles();
     ChunkCache.getInstance().clear();
     TimeSeriesMetadataCache.getInstance().clear();
-    LocalConfigNode.getInstance().clear();
     EnvironmentUtils.cleanEnv();
     EnvironmentUtils.cleanAllDir();
     TSFileDescriptor.getInstance().getConfig().setMaxDegreeOfIndexNode(prevMaxDegreeOfIndexNode);
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerUnseqCompactionWithFastPerformerTest.java b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerUnseqCompactionWithFastPerformerTest.java
index 1a14edecfb..5267eb949b 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerUnseqCompactionWithFastPerformerTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerUnseqCompactionWithFastPerformerTest.java
@@ -20,7 +20,6 @@
 package org.apache.iotdb.db.engine.compaction.inner;
 
 import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.engine.cache.ChunkCache;
 import org.apache.iotdb.db.engine.cache.TimeSeriesMetadataCache;
 import org.apache.iotdb.db.engine.compaction.CompactionUtils;
@@ -35,12 +34,7 @@ import org.apache.iotdb.db.engine.compaction.utils.CompactionOverlapType;
 import org.apache.iotdb.db.engine.compaction.utils.CompactionTimeseriesType;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.localconfignode.LocalConfigNode;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
 import org.apache.iotdb.tsfile.read.TimeValuePair;
 import org.apache.iotdb.tsfile.utils.Pair;
 
@@ -104,18 +98,6 @@ public class InnerUnseqCompactionWithFastPerformerTest {
 
   @Before
   public void setUp() throws MetadataException {
-    LocalConfigNode.getInstance().init();
-    LocalSchemaProcessor.getInstance().setStorageGroup(new PartialPath(COMPACTION_TEST_SG));
-    for (String fullPath : fullPaths) {
-      PartialPath path = new PartialPath(fullPath);
-      LocalSchemaProcessor.getInstance()
-          .createTimeseries(
-              path,
-              TSDataType.INT64,
-              TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-              TSFileDescriptor.getInstance().getConfig().getCompressor(),
-              Collections.emptyMap());
-    }
     Thread.currentThread().setName("pool-1-IoTDB-Compaction-1");
     EnvironmentUtils.envSetUp();
   }
@@ -127,7 +109,6 @@ public class InnerUnseqCompactionWithFastPerformerTest {
     CompactionClearUtils.clearAllCompactionFiles();
     ChunkCache.getInstance().clear();
     TimeSeriesMetadataCache.getInstance().clear();
-    LocalConfigNode.getInstance().clear();
     EnvironmentUtils.cleanAllDir();
     Thread.currentThread().setName(oldThreadName);
     CompactionClearUtils.deleteEmptyDir(new File("target"));
diff --git a/server/src/test/java/org/apache/iotdb/db/localconfignode/LocalConfigNodeMultiDataRegionTest.java b/server/src/test/java/org/apache/iotdb/db/localconfignode/LocalConfigNodeMultiDataRegionTest.java
deleted file mode 100644
index 02dd805a7a..0000000000
--- a/server/src/test/java/org/apache/iotdb/db/localconfignode/LocalConfigNodeMultiDataRegionTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.localconfignode;
-
-import org.apache.iotdb.commons.consensus.DataRegionId;
-import org.apache.iotdb.commons.exception.IllegalPathException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Collections;
-import java.util.List;
-
-public class LocalConfigNodeMultiDataRegionTest {
-  int originDataRegionNum;
-  boolean isClusterMode = false;
-
-  @Before
-  public void setUp() throws IllegalPathException {
-    originDataRegionNum = IoTDBDescriptor.getInstance().getConfig().getDataRegionNum();
-    isClusterMode = IoTDBDescriptor.getInstance().getConfig().isClusterMode();
-    IoTDBDescriptor.getInstance().getConfig().setClusterMode(false);
-    LocalConfigNode.getInstance().init();
-    EnvironmentUtils.envSetUp();
-    LocalDataPartitionInfo.getInstance().init(Collections.EMPTY_MAP);
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    IoTDBDescriptor.getInstance().getConfig().setDataRegionNum(originDataRegionNum);
-    EnvironmentUtils.cleanEnv();
-    IoTDBDescriptor.getInstance().getConfig().setClusterMode(isClusterMode);
-  }
-
-  @Test
-  public void createMultiDataRegionTest() throws Exception {
-    IoTDBDescriptor.getInstance().getConfig().setDataRegionNum(3);
-    LocalSchemaProcessor.getInstance().setStorageGroup(new PartialPath("root.test"));
-    LocalConfigNode configNode = LocalConfigNode.getInstance();
-    LocalDataPartitionInfo info = LocalDataPartitionInfo.getInstance();
-    info.registerStorageGroup(new PartialPath("root.test"));
-    configNode.getBelongedDataRegionIdWithAutoCreate(new PartialPath("root.test.d1"));
-    configNode.getBelongedDataRegionIdWithAutoCreate(new PartialPath("root.test.d2"));
-    configNode.getBelongedDataRegionIdWithAutoCreate(new PartialPath("root.test.d3"));
-    List<DataRegionId> regionIds =
-        info.getDataRegionIdsByStorageGroup(new PartialPath("root.test"));
-    Assert.assertEquals(3, regionIds.size());
-  }
-
-  @Test
-  public void recoverMultiDataRegionTest() throws Exception {
-    IoTDBDescriptor.getInstance().getConfig().setDataRegionNum(3);
-    LocalSchemaProcessor.getInstance().setStorageGroup(new PartialPath("root.test"));
-    LocalConfigNode configNode = LocalConfigNode.getInstance();
-    LocalDataPartitionInfo info = LocalDataPartitionInfo.getInstance();
-    info.registerStorageGroup(new PartialPath("root.test"));
-    configNode.getBelongedDataRegionIdWithAutoCreate(new PartialPath("root.test.d1"));
-    configNode.getBelongedDataRegionIdWithAutoCreate(new PartialPath("root.test.d2"));
-    configNode.getBelongedDataRegionIdWithAutoCreate(new PartialPath("root.test.d3"));
-    LocalConfigNode.getInstance().clear();
-    LocalConfigNode.getInstance().init();
-    info = LocalDataPartitionInfo.getInstance();
-    info.registerStorageGroup(new PartialPath("root.test"));
-    configNode.getBelongedDataRegionIdWithAutoCreate(new PartialPath("root.test.d1"));
-    configNode.getBelongedDataRegionIdWithAutoCreate(new PartialPath("root.test.d2"));
-    configNode.getBelongedDataRegionIdWithAutoCreate(new PartialPath("root.test.d3"));
-    List<DataRegionId> regionIds =
-        info.getDataRegionIdsByStorageGroup(new PartialPath("root.test"));
-    Assert.assertEquals(3, regionIds.size());
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/SchemaBasicTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/SchemaBasicTest.java
deleted file mode 100644
index 12a4837d06..0000000000
--- a/server/src/test/java/org/apache/iotdb/db/metadata/SchemaBasicTest.java
+++ /dev/null
@@ -1,1199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.metadata;
-
-import org.apache.iotdb.commons.exception.IllegalPathException;
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.exception.metadata.PathNotExistException;
-import org.apache.iotdb.db.exception.metadata.StorageGroupAlreadySetException;
-import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
-import org.apache.iotdb.db.metadata.utils.MetaUtils;
-import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
-import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
-import org.apache.iotdb.db.qp.physical.sys.ShowTimeSeriesPlan;
-import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.query.dataset.ShowResult;
-import org.apache.iotdb.db.query.dataset.ShowTimeSeriesResult;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
-import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.stream.Collectors;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public abstract class SchemaBasicTest {
-
-  private CompressionType compressionType;
-
-  @Before
-  public void setUp() {
-    compressionType = TSFileDescriptor.getInstance().getConfig().getCompressor();
-    setConfig();
-    EnvironmentUtils.envSetUp();
-  }
-
-  protected abstract void setConfig();
-
-  protected abstract void rollBackConfig();
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-    rollBackConfig();
-  }
-
-  @Test
-  public void testAddPathAndExist() throws IllegalPathException {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root")));
-
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop")));
-
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop.d1"));
-      schemaProcessor.setStorageGroup(new PartialPath("root.`1`"));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.`1`")));
-
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-    } catch (MetadataException e) {
-      Assert.assertEquals(
-          "some children of root.laptop have already been created as database", e.getMessage());
-    }
-
-    try {
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s0"),
-          TSDataType.valueOf("INT32"),
-          TSEncoding.valueOf("RLE"),
-          compressionType,
-          Collections.emptyMap());
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.s0")));
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.s1")));
-    try {
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s1"),
-          TSDataType.valueOf("INT32"),
-          TSEncoding.valueOf("RLE"),
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.1_2"),
-          TSDataType.INT32,
-          TSEncoding.RLE,
-          TSFileDescriptor.getInstance().getConfig().getCompressor(),
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.`\"1.2.3\"`"),
-          TSDataType.INT32,
-          TSEncoding.RLE,
-          TSFileDescriptor.getInstance().getConfig().getCompressor(),
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.`1`.`2`.`3`"),
-          TSDataType.INT32,
-          TSEncoding.RLE,
-          TSFileDescriptor.getInstance().getConfig().getCompressor(),
-          Collections.emptyMap());
-
-      assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.s1")));
-      assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.1_2")));
-      assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.`\"1.2.3\"`")));
-      assertTrue(schemaProcessor.isPathExist(new PartialPath("root.`1`.`2`")));
-      assertTrue(schemaProcessor.isPathExist(new PartialPath("root.`1`.`2`.`3`")));
-    } catch (MetadataException e1) {
-      e1.printStackTrace();
-      fail(e1.getMessage());
-    }
-
-    try {
-      schemaProcessor.deleteTimeseries(new PartialPath("root.laptop.d1.s1"));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.s1")));
-
-    try {
-      schemaProcessor.deleteTimeseries(new PartialPath("root.laptop.d1.s0"));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.s0")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root")));
-
-    try {
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s1"),
-          TSDataType.valueOf("INT32"),
-          TSEncoding.valueOf("RLE"),
-          compressionType,
-          Collections.emptyMap());
-    } catch (MetadataException e1) {
-      e1.printStackTrace();
-      fail(e1.getMessage());
-    }
-
-    try {
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s0"),
-          TSDataType.valueOf("INT32"),
-          TSEncoding.valueOf("RLE"),
-          compressionType,
-          Collections.emptyMap());
-    } catch (MetadataException e1) {
-      e1.printStackTrace();
-      fail(e1.getMessage());
-    }
-
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d2")));
-    assertFalse(schemaProcessor.checkStorageGroupByPath(new PartialPath("root.laptop.d2")));
-
-    try {
-      schemaProcessor.deleteTimeseries(new PartialPath("root.laptop.d1.s0"));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      schemaProcessor.deleteTimeseries(new PartialPath("root.laptop.d1.s1"));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop1"));
-    } catch (MetadataException e) {
-      Assert.assertEquals(
-          String.format(
-              "The seriesPath of %s already exist, it can't be set to the database",
-              "root.laptop1"),
-          e.getMessage());
-    }
-
-    try {
-      schemaProcessor.deleteTimeseries(new PartialPath("root.laptop.d1.1_2"));
-      schemaProcessor.deleteTimeseries(new PartialPath("root.laptop.d1.`\"1.2.3\"`"));
-      schemaProcessor.deleteTimeseries(new PartialPath("root.`1`.`2`.`3`"));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.1_2")));
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.`\"1.2.3\"`")));
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.`1`.`2`.`3`")));
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.`1`.`2`")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.`1`")));
-
-    try {
-      schemaProcessor.deleteStorageGroups(Collections.singletonList(new PartialPath("root.`1`")));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.`1`")));
-  }
-
-  /**
-   * Test if the PathNotExistException can be correctly thrown when the path to be deleted does not
-   * exist. See {@link LocalSchemaProcessor#deleteTimeseries(PartialPath)}.
-   */
-  @Test
-  public void testDeleteNonExistentTimeseries() {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    try {
-      schemaProcessor.deleteTimeseries(new PartialPath("root.non.existent"));
-      fail();
-    } catch (PathNotExistException e) {
-      assertEquals("Path [root.non.existent] does not exist", e.getMessage());
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning
-  @Test
-  public void testCreateAlignedTimeseries() throws MetadataException {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-
-    try {
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s0"),
-          TSDataType.valueOf("INT32"),
-          TSEncoding.valueOf("RLE"),
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createAlignedTimeSeries(
-          new PartialPath("root.laptop.d1.aligned_device"),
-          Arrays.asList("s1", "s2", "s3"),
-          Arrays.asList(
-              TSDataType.valueOf("INT32"),
-              TSDataType.valueOf("FLOAT"),
-              TSDataType.valueOf("INT32")),
-          Arrays.asList(
-              TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-          Arrays.asList(compressionType, compressionType, compressionType));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.s0")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device.s1")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device.s2")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device.s3")));
-
-    schemaProcessor.deleteTimeseries(new PartialPath("root.laptop.d1.aligned_device.*"));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.s0")));
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device")));
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device.s1")));
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device.s2")));
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device.s3")));
-
-    try {
-      schemaProcessor.deleteTimeseries(new PartialPath("root.laptop.d1.s0"));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1")));
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.s0")));
-
-    try {
-      schemaProcessor.createAlignedTimeSeries(
-          new PartialPath("root.laptop.d1.aligned_device"),
-          Arrays.asList("s0", "s2", "s4"),
-          Arrays.asList(
-              TSDataType.valueOf("INT32"),
-              TSDataType.valueOf("FLOAT"),
-              TSDataType.valueOf("INT32")),
-          Arrays.asList(
-              TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-          Arrays.asList(compressionType, compressionType, compressionType));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device.s0")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device.s2")));
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.d1.aligned_device.s4")));
-  }
-
-  @Test
-  @SuppressWarnings("squid:S5783")
-  public void testGetAllTimeseriesCount() {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d0"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s2.t1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s3"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d2.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d2.s2"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.**")), 6);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.**")), 6);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.*")), 1);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.*.*")), 4);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.*.**")), 5);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.*.*.t1")), 1);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.*.s1")), 2);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.d1.**")), 3);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.d1.*")), 2);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.d2.s1")), 1);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.d2.**")), 2);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop")), 0);
-      assertEquals(schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.d3.s1")), 0);
-
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testSetStorageGroupAndExist() {
-
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-
-    try {
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root1.laptop.d2")));
-
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop.d1"));
-      assertTrue(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d1")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d2")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d1.s1")));
-
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop.d2"));
-      assertTrue(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d1")));
-      assertTrue(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d2")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d3")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop")));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testRecover() throws Exception {
-
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-
-    try {
-
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop.d1"));
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop.d2"));
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d2.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      assertTrue(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d1")));
-      assertTrue(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d2")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d3")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop")));
-      Set<String> devices =
-          new TreeSet<String>() {
-            {
-              add("root.laptop.d1");
-              add("root.laptop.d2");
-            }
-          };
-      // prefix with *
-      assertEquals(
-          devices,
-          schemaProcessor.getMatchedDevices(new PartialPath("root.**"), false).stream()
-              .map(PartialPath::getFullPath)
-              .collect(Collectors.toSet()));
-
-      schemaProcessor.deleteStorageGroups(
-          Collections.singletonList(new PartialPath("root.laptop.d2")));
-      assertTrue(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d1")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d2")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d3")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop")));
-      devices.remove("root.laptop.d2");
-      // prefix with *
-      assertEquals(
-          devices,
-          schemaProcessor.getMatchedDevices(new PartialPath("root.**"), false).stream()
-              .map(PartialPath::getFullPath)
-              .collect(Collectors.toSet()));
-
-      EnvironmentUtils.restartDaemon();
-
-      assertTrue(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d1")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d2")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop.d3")));
-      assertFalse(schemaProcessor.isStorageGroup(new PartialPath("root.laptop")));
-      // prefix with *
-      assertEquals(
-          devices,
-          schemaProcessor.getMatchedDevices(new PartialPath("root.**"), false).stream()
-              .map(PartialPath::getFullPath)
-              .collect(Collectors.toSet()));
-
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testGetAllFileNamesByPath() {
-
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop.d1"));
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop.d2"));
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d2.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-
-      List<PartialPath> list = new ArrayList<>();
-
-      list.add(new PartialPath("root.laptop.d1"));
-      assertEquals(
-          list, schemaProcessor.getBelongedStorageGroups(new PartialPath("root.laptop.d1.s1")));
-      assertEquals(
-          list, schemaProcessor.getBelongedStorageGroups(new PartialPath("root.laptop.d1")));
-
-      list.add(new PartialPath("root.laptop.d2"));
-      assertEquals(
-          list, schemaProcessor.getBelongedStorageGroups(new PartialPath("root.laptop.**")));
-      assertEquals(list, schemaProcessor.getBelongedStorageGroups(new PartialPath("root.**")));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testCheckStorageExistOfPath() {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-
-    try {
-      assertTrue(schemaProcessor.getMeasurementPaths(new PartialPath("root")).isEmpty());
-      assertTrue(schemaProcessor.getBelongedStorageGroups(new PartialPath("root")).isEmpty());
-      assertTrue(
-          schemaProcessor.getBelongedStorageGroups(new PartialPath("root.vehicle")).isEmpty());
-      assertTrue(
-          schemaProcessor
-              .getBelongedStorageGroups(new PartialPath("root.vehicle.device0"))
-              .isEmpty());
-      assertTrue(
-          schemaProcessor
-              .getBelongedStorageGroups(new PartialPath("root.vehicle.device0.sensor"))
-              .isEmpty());
-
-      schemaProcessor.setStorageGroup(new PartialPath("root.vehicle"));
-      assertFalse(
-          schemaProcessor.getBelongedStorageGroups(new PartialPath("root.vehicle")).isEmpty());
-      assertFalse(
-          schemaProcessor
-              .getBelongedStorageGroups(new PartialPath("root.vehicle.device0"))
-              .isEmpty());
-      assertFalse(
-          schemaProcessor
-              .getBelongedStorageGroups(new PartialPath("root.vehicle.device0.sensor"))
-              .isEmpty());
-      assertTrue(
-          schemaProcessor.getBelongedStorageGroups(new PartialPath("root.vehicle1")).isEmpty());
-      assertTrue(
-          schemaProcessor
-              .getBelongedStorageGroups(new PartialPath("root.vehicle1.device0"))
-              .isEmpty());
-
-      schemaProcessor.setStorageGroup(new PartialPath("root.vehicle1.device0"));
-      assertTrue(
-          schemaProcessor
-              .getBelongedStorageGroups(new PartialPath("root.vehicle1.device1"))
-              .isEmpty());
-      assertTrue(
-          schemaProcessor
-              .getBelongedStorageGroups(new PartialPath("root.vehicle1.device2"))
-              .isEmpty());
-      assertTrue(
-          schemaProcessor
-              .getBelongedStorageGroups(new PartialPath("root.vehicle1.device3"))
-              .isEmpty());
-      assertFalse(
-          schemaProcessor
-              .getBelongedStorageGroups(new PartialPath("root.vehicle1.device0"))
-              .isEmpty());
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testShowChildNodesWithGivenPrefix() {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d2.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s2"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      Set<String> nodes = new HashSet<>(Arrays.asList("s1", "s2"));
-      Set<String> nodes2 = new HashSet<>(Arrays.asList("laptop"));
-      Set<String> nodes3 = new HashSet<>(Arrays.asList("d1", "d2"));
-      Set<String> nexLevelNodes1 =
-          schemaProcessor.getChildNodeNameInNextLevel(new PartialPath("root.laptop.d1"));
-      Set<String> nexLevelNodes2 =
-          schemaProcessor.getChildNodeNameInNextLevel(new PartialPath("root"));
-      Set<String> nexLevelNodes3 =
-          schemaProcessor.getChildNodeNameInNextLevel(new PartialPath("root.laptop"));
-      // usual condition
-      assertEquals(nodes, nexLevelNodes1);
-      assertEquals(nodes2, nexLevelNodes2);
-      assertEquals(nodes3, nexLevelNodes3);
-
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testGetStorageGroupNameByAutoLevel() {
-    int level = IoTDBDescriptor.getInstance().getConfig().getDefaultStorageGroupLevel();
-
-    try {
-      assertEquals(
-          "root.laptop",
-          MetaUtils.getStorageGroupPathByLevel(new PartialPath("root.laptop.d1.s1"), level)
-              .getFullPath());
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-
-    boolean caughtException = false;
-    try {
-      MetaUtils.getStorageGroupPathByLevel(new PartialPath("root1.laptop.d1.s1"), level);
-    } catch (MetadataException e) {
-      caughtException = true;
-      assertEquals("root1.laptop.d1.s1 is not a legal path", e.getMessage());
-    }
-    assertTrue(caughtException);
-
-    caughtException = false;
-    try {
-      MetaUtils.getStorageGroupPathByLevel(new PartialPath("root"), level);
-    } catch (MetadataException e) {
-      caughtException = true;
-      assertEquals("root is not a legal path", e.getMessage());
-    }
-    assertTrue(caughtException);
-  }
-
-  @Test
-  public void testGetDevicesWithGivenPrefix() {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d2.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      Set<String> devices = new TreeSet<>();
-      devices.add("root.laptop.d1");
-      devices.add("root.laptop.d2");
-      // usual condition
-      assertEquals(
-          devices,
-          schemaProcessor.getMatchedDevices(new PartialPath("root.laptop.**"), false).stream()
-              .map(PartialPath::getFullPath)
-              .collect(Collectors.toSet()));
-      schemaProcessor.setStorageGroup(new PartialPath("root.vehicle"));
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d1.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      devices.add("root.vehicle.d1");
-      // prefix with *
-      assertEquals(
-          devices,
-          schemaProcessor.getMatchedDevices(new PartialPath("root.**"), false).stream()
-              .map(PartialPath::getFullPath)
-              .collect(Collectors.toSet()));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testGetChildNodePathInNextLevel() {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    String[] res =
-        new String[] {
-          "[TSchemaNode(nodeName:root.laptop, nodeType:2), TSchemaNode(nodeName:root.vehicle, nodeType:2)]",
-          "[TSchemaNode(nodeName:root.laptop.b1, nodeType:3), TSchemaNode(nodeName:root.laptop.b2, nodeType:3)]",
-          "[TSchemaNode(nodeName:root.laptop.b1.d1, nodeType:4), TSchemaNode(nodeName:root.laptop.b1.d2, nodeType:4)]",
-          "[TSchemaNode(nodeName:root.laptop.b1, nodeType:3), TSchemaNode(nodeName:root.laptop.b2, nodeType:3), TSchemaNode(nodeName:root.vehicle.b1, nodeType:3), TSchemaNode(nodeName:root.vehicle.b2, nodeType:3)]",
-          "[TSchemaNode(nodeName:root.laptop.b1.d1, nodeType:4), TSchemaNode(nodeName:root.laptop.b1.d2, nodeType:4), TSchemaNode(nodeName:root.vehicle.b1.d0, nodeType:4), TSchemaNode(nodeName:root.vehicle.b1.d2, nodeType:4), TSchemaNode(nodeName:root.vehicle.b1.d3, nodeType:4)]",
-          "[TSchemaNode(nodeName:root.laptop.b1.d1, nodeType:4), TSchemaNode(nodeName:root.laptop.b1.d2, nodeType:4)]",
-          "[TSchemaNode(nodeName:root.vehicle.b1.d0, nodeType:4), TSchemaNode(nodeName:root.vehicle.b1.d2, nodeType:4), TSchemaNode(nodeName:root.vehicle.b1.d3, nodeType:4), TSchemaNode(nodeName:root.vehicle.b2.d0, nodeType:4)]",
-          "[TSchemaNode(nodeName:root.laptop.b1.d1.s0, nodeType:5), TSchemaNode(nodeName:root.laptop.b1.d1.s1, nodeType:5), TSchemaNode(nodeName:root.laptop.b1.d2.s0, nodeType:5), TSchemaNode(nodeName:root.laptop.b2.d1.s1, nodeType:5), TSchemaNode(nodeName:root.laptop.b2.d1.s3, nodeType:5), TSchemaNode(nodeName:root.laptop.b2.d2.s2, nodeType:5)]",
-          "[]"
-        };
-
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-      schemaProcessor.setStorageGroup(new PartialPath("root.vehicle"));
-
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.b1.d1.s0"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.b1.d1.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.b1.d2.s0"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.b2.d1.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.b2.d1.s3"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.b2.d2.s2"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.b1.d0.s0"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.b1.d2.s2"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.b1.d3.s3"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.b2.d0.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-
-      assertEquals(
-          res[0], schemaProcessor.getChildNodePathInNextLevel(new PartialPath("root")).toString());
-      assertEquals(
-          res[1],
-          schemaProcessor.getChildNodePathInNextLevel(new PartialPath("root.laptop")).toString());
-      assertEquals(
-          res[2],
-          schemaProcessor
-              .getChildNodePathInNextLevel(new PartialPath("root.laptop.b1"))
-              .toString());
-      assertEquals(
-          res[3],
-          schemaProcessor.getChildNodePathInNextLevel(new PartialPath("root.*")).toString());
-      assertEquals(
-          res[4],
-          schemaProcessor.getChildNodePathInNextLevel(new PartialPath("root.*.b1")).toString());
-      assertEquals(
-          res[5],
-          schemaProcessor.getChildNodePathInNextLevel(new PartialPath("root.l*.b1")).toString());
-      assertEquals(
-          res[6],
-          schemaProcessor.getChildNodePathInNextLevel(new PartialPath("root.v*.*")).toString());
-      assertEquals(
-          res[7],
-          schemaProcessor.getChildNodePathInNextLevel(new PartialPath("root.l*.b*.*")).toString());
-      assertEquals(
-          res[8],
-          schemaProcessor.getChildNodePathInNextLevel(new PartialPath("root.laptopp")).toString());
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testShowTimeseries() {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    try {
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s0"),
-          TSDataType.valueOf("INT32"),
-          TSEncoding.valueOf("RLE"),
-          compressionType,
-          Collections.emptyMap());
-
-      // show timeseries root.laptop.d1.s0
-      ShowTimeSeriesPlan showTimeSeriesPlan =
-          new ShowTimeSeriesPlan(
-              new PartialPath("root.laptop.d1.s0"), false, null, null, 0, 0, false);
-      List<ShowTimeSeriesResult> result =
-          schemaProcessor.showTimeseries(showTimeSeriesPlan, EnvironmentUtils.TEST_QUERY_CONTEXT);
-      assertEquals(1, result.size());
-      assertEquals("root.laptop.d1.s0", result.get(0).getName());
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testTotalSeriesNumber() throws Exception {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d0"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s2.t1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.s3"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d2.s1"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d2.s2"),
-          TSDataType.INT32,
-          TSEncoding.PLAIN,
-          CompressionType.GZIP,
-          null);
-
-      assertEquals(6, schemaProcessor.getTotalSeriesNumber());
-      EnvironmentUtils.restartDaemon();
-      assertEquals(6, schemaProcessor.getTotalSeriesNumber());
-      schemaProcessor.deleteTimeseries(new PartialPath("root.laptop.d2.s1"));
-      assertEquals(5, schemaProcessor.getTotalSeriesNumber());
-      schemaProcessor.deleteStorageGroups(
-          Collections.singletonList(new PartialPath("root.laptop")));
-      assertEquals(0, schemaProcessor.getTotalSeriesNumber());
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testStorageGroupNameWithHyphen() throws IllegalPathException {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root")));
-
-    assertFalse(schemaProcessor.isPathExist(new PartialPath("root.group_with_hyphen")));
-
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.group_with_hyphen"));
-    } catch (MetadataException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-
-    assertTrue(schemaProcessor.isPathExist(new PartialPath("root.group_with_hyphen")));
-  }
-
-  @Test
-  public void testCreateTimeseriesAndInsertWithAlignedData() {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.aligned_device.s1"),
-          TSDataType.valueOf("INT32"),
-          TSEncoding.valueOf("RLE"),
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.laptop.d1.aligned_device.s2"),
-          TSDataType.valueOf("INT64"),
-          TSEncoding.valueOf("RLE"),
-          compressionType,
-          Collections.emptyMap());
-    } catch (Exception e) {
-      fail();
-    }
-
-    try {
-      schemaProcessor.createAlignedTimeSeries(
-          new PartialPath("root.laptop.d1.aligned_device"),
-          Arrays.asList("s3", "s4", "s5"),
-          Arrays.asList(
-              TSDataType.valueOf("FLOAT"),
-              TSDataType.valueOf("INT64"),
-              TSDataType.valueOf("INT32")),
-          Arrays.asList(
-              TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-          Arrays.asList(compressionType, compressionType, compressionType));
-      fail();
-    } catch (Exception e) {
-      Assert.assertEquals(
-          "Timeseries under this entity is not aligned, please use createTimeseries or change entity. (Path: root.laptop.d1.aligned_device)",
-          e.getMessage());
-    }
-  }
-
-  @Test
-  public void testCreateAlignedTimeseriesWithIllegalNames() throws Exception {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-    PartialPath deviceId = new PartialPath("root.laptop.d1");
-    String[] measurementIds = {"time", "timestamp", "TIME", "TIMESTAMP"};
-    for (String measurementId : measurementIds) {
-      PartialPath path = deviceId.concatNode(measurementId);
-      try {
-        schemaProcessor.createAlignedTimeSeries(
-            path,
-            Arrays.asList("s1", "s2", "s3"),
-            Arrays.asList(
-                TSDataType.valueOf("FLOAT"),
-                TSDataType.valueOf("INT64"),
-                TSDataType.valueOf("INT32")),
-            Arrays.asList(
-                TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-            Arrays.asList(compressionType, compressionType, compressionType));
-        fail();
-      } catch (Exception e) {
-        Assert.assertEquals(
-            String.format(
-                "%s is not a legal path, because %s",
-                path.getFullPath(), String.format("%s is an illegal name.", measurementId)),
-            e.getMessage());
-      }
-    }
-
-    PartialPath path = deviceId.concatNode("t1");
-    for (String measurementId : measurementIds) {
-      try {
-        schemaProcessor.createAlignedTimeSeries(
-            path,
-            Arrays.asList(measurementId, "s2", "s3"),
-            Arrays.asList(
-                TSDataType.valueOf("FLOAT"),
-                TSDataType.valueOf("INT64"),
-                TSDataType.valueOf("INT32")),
-            Arrays.asList(
-                TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-            Arrays.asList(compressionType, compressionType, compressionType));
-        fail();
-      } catch (Exception e) {
-        Assert.assertEquals(String.format("%s is an illegal name.", measurementId), e.getMessage());
-      }
-    }
-  }
-
-  @Test
-  public void testCreateAlignedTimeseriesWithAliasAndTags() throws Exception {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-    PartialPath devicePath = new PartialPath("root.laptop.device0");
-    List<String> measurements = Arrays.asList("s1", "s2", "s3", "s4", "s5");
-    List<TSDataType> tsDataTypes =
-        Arrays.asList(
-            TSDataType.DOUBLE,
-            TSDataType.TEXT,
-            TSDataType.FLOAT,
-            TSDataType.BOOLEAN,
-            TSDataType.INT32);
-    List<TSEncoding> tsEncodings =
-        Arrays.asList(
-            TSEncoding.PLAIN,
-            TSEncoding.PLAIN,
-            TSEncoding.PLAIN,
-            TSEncoding.PLAIN,
-            TSEncoding.PLAIN);
-    List<CompressionType> compressionTypes =
-        Arrays.asList(
-            CompressionType.UNCOMPRESSED,
-            CompressionType.UNCOMPRESSED,
-            CompressionType.UNCOMPRESSED,
-            CompressionType.UNCOMPRESSED,
-            CompressionType.UNCOMPRESSED);
-    List<String> aliasList = Arrays.asList("alias1", null, "alias2", null, null);
-    List<Map<String, String>> tagList = new ArrayList<>();
-    Map<String, String> tags = new HashMap<>();
-    tags.put("key", "value");
-    tagList.add(tags);
-    tagList.add(null);
-    tagList.add(null);
-    tagList.add(tags);
-    tagList.add(null);
-    CreateAlignedTimeSeriesPlan createAlignedTimeSeriesPlan =
-        new CreateAlignedTimeSeriesPlan(
-            devicePath,
-            measurements,
-            tsDataTypes,
-            tsEncodings,
-            compressionTypes,
-            aliasList,
-            tagList,
-            null);
-    schemaProcessor.createAlignedTimeSeries(createAlignedTimeSeriesPlan);
-
-    Assert.assertEquals(
-        5, schemaProcessor.getAllTimeseriesCount(new PartialPath("root.laptop.device0.*")));
-    Assert.assertTrue(schemaProcessor.isPathExist(new PartialPath("root.laptop.device0.alias2")));
-
-    ShowTimeSeriesPlan showTimeSeriesPlan =
-        new ShowTimeSeriesPlan(new PartialPath("root.**"), false, "key", "value", 0, 0, false);
-    List<ShowTimeSeriesResult> showTimeSeriesResults =
-        schemaProcessor.showTimeseries(showTimeSeriesPlan, null);
-    Assert.assertEquals(2, showTimeSeriesResults.size());
-    showTimeSeriesResults =
-        showTimeSeriesResults.stream()
-            .sorted(Comparator.comparing(ShowResult::getName))
-            .collect(Collectors.toList());
-    ShowTimeSeriesResult result = showTimeSeriesResults.get(0);
-    Assert.assertEquals("root.laptop.device0.s1", result.getName());
-    Assert.assertEquals("alias1", result.getAlias());
-    Assert.assertEquals(tags, result.getTag());
-    result = showTimeSeriesResults.get(1);
-    Assert.assertEquals("root.laptop.device0.s4", result.getName());
-    Assert.assertEquals(tags, result.getTag());
-  }
-
-  @Test
-  public void testGetStorageGroupNodeByPath() {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    PartialPath partialPath = null;
-
-    try {
-      partialPath = new PartialPath("root.ln.sg1");
-    } catch (IllegalPathException e) {
-      fail(e.getMessage());
-    }
-
-    try {
-      schemaProcessor.setStorageGroup(partialPath);
-    } catch (MetadataException e) {
-      fail(e.getMessage());
-    }
-
-    try {
-      partialPath = new PartialPath("root.ln.sg2.device1.sensor1");
-    } catch (IllegalPathException e) {
-      fail(e.getMessage());
-    }
-
-    try {
-      schemaProcessor.getStorageGroupNodeByPath(partialPath);
-    } catch (StorageGroupNotSetException e) {
-      Assert.assertEquals(
-          "Database is not set for current seriesPath: [root.ln.sg2.device1.sensor1]",
-          e.getMessage());
-    } catch (StorageGroupAlreadySetException e) {
-      Assert.assertEquals(
-          "some children of root.ln have already been created as database", e.getMessage());
-    } catch (MetadataException e) {
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void testTagIndexRecovery() throws Exception {
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    PartialPath path = new PartialPath("root.sg.d.s");
-    Map<String, String> tags = new HashMap<>();
-    tags.put("description", "oldValue");
-    schemaProcessor.createTimeseries(
-        new CreateTimeSeriesPlan(
-            path,
-            TSDataType.valueOf("INT32"),
-            TSEncoding.valueOf("RLE"),
-            compressionType,
-            null,
-            tags,
-            null,
-            null));
-
-    ShowTimeSeriesPlan showTimeSeriesPlan =
-        new ShowTimeSeriesPlan(
-            new PartialPath("root.sg.d.s"), true, "description", "Value", 0, 0, false);
-    List<ShowTimeSeriesResult> results =
-        schemaProcessor.showTimeseries(showTimeSeriesPlan, new QueryContext());
-
-    assertEquals(1, results.size());
-    Map<String, String> resultTag = results.get(0).getTag();
-    assertEquals("oldValue", resultTag.get("description"));
-
-    tags.put("description", "newValue");
-    schemaProcessor.upsertTagsAndAttributes(null, tags, null, path);
-
-    showTimeSeriesPlan =
-        new ShowTimeSeriesPlan(
-            new PartialPath("root.sg.d.s"), true, "description", "Value", 0, 0, false);
-    results = schemaProcessor.showTimeseries(showTimeSeriesPlan, new QueryContext());
-
-    assertEquals(1, results.size());
-    resultTag = results.get(0).getTag();
-    assertEquals("newValue", resultTag.get("description"));
-
-    EnvironmentUtils.restartDaemon();
-
-    showTimeSeriesPlan =
-        new ShowTimeSeriesPlan(
-            new PartialPath("root.sg.d.s"), true, "description", "oldValue", 0, 0, false);
-    results = schemaProcessor.showTimeseries(showTimeSeriesPlan, new QueryContext());
-
-    assertEquals(0, results.size());
-
-    showTimeSeriesPlan =
-        new ShowTimeSeriesPlan(
-            new PartialPath("root.sg.d.s"), true, "description", "Value", 0, 0, false);
-    results = schemaProcessor.showTimeseries(showTimeSeriesPlan, new QueryContext());
-
-    assertEquals(1, results.size());
-    resultTag = results.get(0).getTag();
-    assertEquals("newValue", resultTag.get("description"));
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaDiskModeTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaDiskModeTest.java
deleted file mode 100644
index 8c3f82c75a..0000000000
--- a/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaDiskModeTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.metadata.multimode;
-
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.metadata.SchemaBasicTest;
-import org.apache.iotdb.db.metadata.schemaregion.SchemaEngineMode;
-
-public abstract class SchemaDiskModeTest extends SchemaBasicTest {
-  @Override
-  protected void setConfig() {
-    IoTDBDescriptor.getInstance()
-        .getConfig()
-        .setSchemaEngineMode(SchemaEngineMode.Schema_File.toString());
-    setMemSize();
-  }
-
-  @Override
-  protected void rollBackConfig() {
-    IoTDBDescriptor.getInstance()
-        .getConfig()
-        .setSchemaEngineMode(SchemaEngineMode.Memory.toString());
-  }
-
-  protected abstract void setMemSize();
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaFullMemoryTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaFullMemoryTest.java
deleted file mode 100644
index 5d410ec6fa..0000000000
--- a/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaFullMemoryTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.metadata.multimode;
-
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-
-public class SchemaFullMemoryTest extends SchemaDiskModeTest {
-
-  @Override
-  protected void setMemSize() {
-    IoTDBDescriptor.getInstance().getConfig().setCachedMNodeSizeInSchemaFileMode(10000);
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaMemoryModeTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaMemoryModeTest.java
deleted file mode 100644
index 9c65a38a42..0000000000
--- a/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaMemoryModeTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.metadata.multimode;
-
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.metadata.SchemaBasicTest;
-import org.apache.iotdb.db.metadata.schemaregion.SchemaEngineMode;
-
-public class SchemaMemoryModeTest extends SchemaBasicTest {
-  @Override
-  protected void setConfig() {
-    IoTDBDescriptor.getInstance()
-        .getConfig()
-        .setSchemaEngineMode(SchemaEngineMode.Memory.toString());
-  }
-
-  @Override
-  protected void rollBackConfig() {}
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaNonMemoryTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaNonMemoryTest.java
deleted file mode 100644
index a33ca3d406..0000000000
--- a/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaNonMemoryTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.metadata.multimode;
-
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-
-public class SchemaNonMemoryTest extends SchemaDiskModeTest {
-
-  @Override
-  protected void setMemSize() {
-    IoTDBDescriptor.getInstance().getConfig().setCachedMNodeSizeInSchemaFileMode(0);
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaPartialMemoryTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaPartialMemoryTest.java
deleted file mode 100644
index 0ed3ef5c8e..0000000000
--- a/server/src/test/java/org/apache/iotdb/db/metadata/multimode/SchemaPartialMemoryTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.metadata.multimode;
-
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-
-public class SchemaPartialMemoryTest extends SchemaDiskModeTest {
-  @Override
-  protected void setMemSize() {
-    IoTDBDescriptor.getInstance().getConfig().setCachedMNodeSizeInSchemaFileMode(5);
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneSchedulerTest.java b/server/src/test/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneSchedulerTest.java
deleted file mode 100644
index ff1aaa111f..0000000000
--- a/server/src/test/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneSchedulerTest.java
+++ /dev/null
@@ -1,547 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.plan.scheduler;
-
-import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
-import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
-import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
-import org.apache.iotdb.common.rpc.thrift.TEndPoint;
-import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
-import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.partition.StorageExecutor;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.conf.IoTDBConfig;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.engine.StorageEngine;
-import org.apache.iotdb.db.engine.flush.FlushManager;
-import org.apache.iotdb.db.engine.storagegroup.DataRegionTest;
-import org.apache.iotdb.db.exception.DataRegionException;
-import org.apache.iotdb.db.localconfignode.LocalConfigNode;
-import org.apache.iotdb.db.localconfignode.LocalDataPartitionTable;
-import org.apache.iotdb.db.mpp.common.MPPQueryContext;
-import org.apache.iotdb.db.mpp.common.PlanFragmentId;
-import org.apache.iotdb.db.mpp.common.QueryId;
-import org.apache.iotdb.db.mpp.common.SessionInfo;
-import org.apache.iotdb.db.mpp.execution.QueryState;
-import org.apache.iotdb.db.mpp.execution.QueryStateMachine;
-import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.planner.plan.FragmentInstance;
-import org.apache.iotdb.db.mpp.plan.planner.plan.PlanFragment;
-import org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNodeId;
-import org.apache.iotdb.db.mpp.plan.planner.plan.node.metedata.write.CreateAlignedTimeSeriesNode;
-import org.apache.iotdb.db.mpp.plan.planner.plan.node.metedata.write.CreateMultiTimeSeriesNode;
-import org.apache.iotdb.db.mpp.plan.planner.plan.node.metedata.write.CreateTimeSeriesNode;
-import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowNode;
-import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertTabletNode;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.db.wal.WALManager;
-import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.iotdb.tsfile.read.filter.GroupByFilter;
-import org.apache.iotdb.tsfile.write.record.TSRecord;
-import org.apache.iotdb.tsfile.write.record.datapoint.DataPoint;
-import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-
-public class StandaloneSchedulerTest {
-  private static final IoTDBConfig conf = IoTDBDescriptor.getInstance().getConfig();
-  private static final SessionInfo sessionInfo =
-      new SessionInfo(1, "test", ZoneId.systemDefault().getId());
-
-  static LocalConfigNode configNode;
-
-  @Before
-  public void setUp() throws Exception {
-    conf.setDataNodeId(0);
-
-    configNode = LocalConfigNode.getInstance();
-    configNode.init();
-    WALManager.getInstance().start();
-    FlushManager.getInstance().start();
-    StorageEngine.getInstance().start();
-    LocalDataPartitionTable.DataRegionIdGenerator.getInstance().reset();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    configNode.clear();
-    WALManager.getInstance().stop();
-    StorageEngine.getInstance().stop();
-    FlushManager.getInstance().stop();
-    EnvironmentUtils.cleanAllDir();
-    conf.setDataNodeId(-1);
-  }
-
-  @Test
-  public void testCreateTimeseries() throws MetadataException {
-    CreateTimeSeriesNode createTimeSeriesNode =
-        new CreateTimeSeriesNode(
-            new PlanNodeId("0"),
-            new PartialPath("root.ln.wf01.wt01.status"),
-            TSDataType.BOOLEAN,
-            TSEncoding.PLAIN,
-            CompressionType.SNAPPY,
-            new HashMap<String, String>() {
-              {
-                put("MAX_POINT_NUMBER", "3");
-              }
-            },
-            new HashMap<String, String>() {
-              {
-                put("tag1", "v1");
-                put("tag2", "v2");
-              }
-            },
-            new HashMap<String, String>() {
-              {
-                put("attr1", "a1");
-                put("attr2", "a2");
-              }
-            },
-            "meter1");
-
-    TRegionReplicaSet regionReplicaSet = genRegionReplicaSet(TConsensusGroupType.SchemaRegion);
-    PlanFragment planFragment = new PlanFragment(new PlanFragmentId("2", 3), createTimeSeriesNode);
-    FragmentInstance fragmentInstance =
-        new FragmentInstance(
-            planFragment,
-            planFragment.getId().genFragmentInstanceId(),
-            new GroupByFilter(1, 2, 3, 4),
-            QueryType.WRITE,
-            conf.getQueryTimeoutThreshold(),
-            sessionInfo);
-    fragmentInstance.setExecutorAndHost(new StorageExecutor(regionReplicaSet));
-
-    configNode.getBelongedSchemaRegionIdWithAutoCreate(new PartialPath("root.ln.wf01.wt01.status"));
-    MPPQueryContext context =
-        new MPPQueryContext(
-            "",
-            new QueryId("query1"),
-            new SessionInfo(1L, "fakeUsername", "fakeZoneId"),
-            new TEndPoint(),
-            new TEndPoint());
-    ExecutorService executor = IoTDBThreadPoolFactory.newSingleThreadExecutor("Test");
-    QueryStateMachine stateMachine = new QueryStateMachine(context.getQueryId(), executor);
-
-    Assert.assertFalse(stateMachine.getState().isDone());
-    // execute request
-    StandaloneScheduler standaloneScheduler =
-        new StandaloneScheduler(
-            context,
-            stateMachine,
-            Collections.singletonList(fragmentInstance),
-            QueryType.WRITE,
-            null,
-            null);
-    try {
-      standaloneScheduler.start();
-      Assert.assertEquals(QueryState.FINISHED, stateMachine.getState());
-    } catch (Exception e) {
-      e.printStackTrace();
-      Assert.fail();
-    } finally {
-      standaloneScheduler.stop();
-    }
-  }
-
-  @Test
-  public void testCreateAlignedTimeseries() throws MetadataException {
-    CreateAlignedTimeSeriesNode createAlignedTimeSeriesNode =
-        new CreateAlignedTimeSeriesNode(
-            new PlanNodeId("0"),
-            new PartialPath("root.ln.wf01.GPS"),
-            new ArrayList<String>() {
-              {
-                add("latitude");
-                add("longitude");
-              }
-            },
-            new ArrayList<TSDataType>() {
-              {
-                add(TSDataType.FLOAT);
-                add(TSDataType.FLOAT);
-              }
-            },
-            new ArrayList<TSEncoding>() {
-              {
-                add(TSEncoding.PLAIN);
-                add(TSEncoding.PLAIN);
-              }
-            },
-            new ArrayList<CompressionType>() {
-              {
-                add(CompressionType.SNAPPY);
-                add(CompressionType.SNAPPY);
-              }
-            },
-            new ArrayList<String>() {
-              {
-                add("meter1");
-                add(null);
-              }
-            },
-            new ArrayList<Map<String, String>>() {
-              {
-                add(
-                    new HashMap<String, String>() {
-                      {
-                        put("tag1", "t1");
-                      }
-                    });
-                add(null);
-              }
-            },
-            new ArrayList<Map<String, String>>() {
-              {
-                add(
-                    new HashMap<String, String>() {
-                      {
-                        put("tag1", "t1");
-                      }
-                    });
-                add(null);
-              }
-            });
-
-    TRegionReplicaSet regionReplicaSet = genRegionReplicaSet(TConsensusGroupType.SchemaRegion);
-    PlanFragment planFragment =
-        new PlanFragment(new PlanFragmentId("2", 3), createAlignedTimeSeriesNode);
-    FragmentInstance fragmentInstance =
-        new FragmentInstance(
-            planFragment,
-            planFragment.getId().genFragmentInstanceId(),
-            new GroupByFilter(1, 2, 3, 4),
-            QueryType.WRITE,
-            conf.getQueryTimeoutThreshold(),
-            sessionInfo);
-    fragmentInstance.setExecutorAndHost(new StorageExecutor(regionReplicaSet));
-
-    configNode.getBelongedSchemaRegionIdWithAutoCreate(new PartialPath("root.ln.wf01.GPS"));
-    MPPQueryContext context =
-        new MPPQueryContext(
-            "",
-            new QueryId("query1"),
-            new SessionInfo(1L, "fakeUsername", "fakeZoneId"),
-            new TEndPoint(),
-            new TEndPoint());
-    ExecutorService executor = IoTDBThreadPoolFactory.newSingleThreadExecutor("Test");
-    QueryStateMachine stateMachine = new QueryStateMachine(context.getQueryId(), executor);
-
-    Assert.assertFalse(stateMachine.getState().isDone());
-    // execute request
-    StandaloneScheduler standaloneScheduler =
-        new StandaloneScheduler(
-            context,
-            stateMachine,
-            Collections.singletonList(fragmentInstance),
-            QueryType.WRITE,
-            null,
-            null);
-    try {
-      standaloneScheduler.start();
-      Assert.assertEquals(QueryState.FINISHED, stateMachine.getState());
-    } catch (Exception e) {
-      e.printStackTrace();
-      Assert.fail();
-    } finally {
-      standaloneScheduler.stop();
-    }
-  }
-
-  @Test
-  public void testCreateMultiTimeSeries() throws MetadataException {
-    CreateMultiTimeSeriesNode createMultiTimeSeriesNode =
-        new CreateMultiTimeSeriesNode(
-            new PlanNodeId("0"),
-            new ArrayList<PartialPath>() {
-              {
-                add(new PartialPath("root.ln.d3.s1"));
-                add(new PartialPath("root.ln.d3.s2"));
-              }
-            },
-            new ArrayList<TSDataType>() {
-              {
-                add(TSDataType.FLOAT);
-                add(TSDataType.FLOAT);
-              }
-            },
-            new ArrayList<TSEncoding>() {
-              {
-                add(TSEncoding.PLAIN);
-                add(TSEncoding.PLAIN);
-              }
-            },
-            new ArrayList<CompressionType>() {
-              {
-                add(CompressionType.SNAPPY);
-                add(CompressionType.SNAPPY);
-              }
-            },
-            new ArrayList<Map<String, String>>() {
-              {
-                add(
-                    new HashMap<String, String>() {
-                      {
-                        put("MAX_POINT_NUMBER", "3");
-                      }
-                    });
-                add(null);
-              }
-            },
-            new ArrayList<String>() {
-              {
-                add("meter1");
-                add(null);
-              }
-            },
-            new ArrayList<Map<String, String>>() {
-              {
-                add(
-                    new HashMap<String, String>() {
-                      {
-                        put("tag1", "t1");
-                      }
-                    });
-                add(null);
-              }
-            },
-            new ArrayList<Map<String, String>>() {
-              {
-                add(
-                    new HashMap<String, String>() {
-                      {
-                        put("tag1", "t1");
-                      }
-                    });
-                add(null);
-              }
-            });
-
-    TRegionReplicaSet regionReplicaSet = genRegionReplicaSet(TConsensusGroupType.SchemaRegion);
-    PlanFragment planFragment =
-        new PlanFragment(new PlanFragmentId("2", 3), createMultiTimeSeriesNode);
-    FragmentInstance fragmentInstance =
-        new FragmentInstance(
-            planFragment,
-            planFragment.getId().genFragmentInstanceId(),
-            new GroupByFilter(1, 2, 3, 4),
-            QueryType.WRITE,
-            conf.getQueryTimeoutThreshold(),
-            sessionInfo);
-    fragmentInstance.setExecutorAndHost(new StorageExecutor(regionReplicaSet));
-
-    configNode.getBelongedSchemaRegionIdWithAutoCreate(new PartialPath("root.ln.d3"));
-    MPPQueryContext context =
-        new MPPQueryContext(
-            "",
-            new QueryId("query1"),
-            new SessionInfo(1L, "fakeUsername", "fakeZoneId"),
-            new TEndPoint(),
-            new TEndPoint());
-    ExecutorService executor = IoTDBThreadPoolFactory.newSingleThreadExecutor("Test");
-    QueryStateMachine stateMachine = new QueryStateMachine(context.getQueryId(), executor);
-
-    Assert.assertFalse(stateMachine.getState().isDone());
-    // execute request
-    StandaloneScheduler standaloneScheduler =
-        new StandaloneScheduler(
-            context,
-            stateMachine,
-            Collections.singletonList(fragmentInstance),
-            QueryType.WRITE,
-            null,
-            null);
-    try {
-      standaloneScheduler.start();
-      Assert.assertEquals(QueryState.FINISHED, stateMachine.getState());
-    } catch (Exception e) {
-      e.printStackTrace();
-      Assert.fail();
-    } finally {
-      standaloneScheduler.stop();
-    }
-  }
-
-  @Test
-  public void testInsertRow() throws DataRegionException, MetadataException {
-    String deviceId = "root.vehicle.d0";
-    String measurementId = "s0";
-    TSRecord record = new TSRecord(10000, deviceId);
-    record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(1000)));
-    InsertRowNode insertRowNode = DataRegionTest.buildInsertRowNodeByTSRecord(record);
-
-    TRegionReplicaSet regionReplicaSet = genRegionReplicaSet(TConsensusGroupType.DataRegion);
-    PlanFragment planFragment = new PlanFragment(new PlanFragmentId("2", 3), insertRowNode);
-    FragmentInstance fragmentInstance =
-        new FragmentInstance(
-            planFragment,
-            planFragment.getId().genFragmentInstanceId(),
-            new GroupByFilter(1, 2, 3, 4),
-            QueryType.WRITE,
-            conf.getQueryTimeoutThreshold(),
-            sessionInfo);
-    fragmentInstance.setExecutorAndHost(new StorageExecutor(regionReplicaSet));
-
-    configNode.getBelongedSchemaRegionIdWithAutoCreate(new PartialPath(deviceId));
-    configNode.getBelongedDataRegionIdWithAutoCreate(new PartialPath(deviceId));
-    MPPQueryContext context =
-        new MPPQueryContext(
-            "",
-            new QueryId("query1"),
-            new SessionInfo(1L, "fakeUsername", "fakeZoneId"),
-            new TEndPoint(),
-            new TEndPoint());
-    ExecutorService executor = IoTDBThreadPoolFactory.newSingleThreadExecutor("Test");
-    QueryStateMachine stateMachine = new QueryStateMachine(context.getQueryId(), executor);
-
-    Assert.assertFalse(stateMachine.getState().isDone());
-    // execute request
-    StandaloneScheduler standaloneScheduler =
-        new StandaloneScheduler(
-            context,
-            stateMachine,
-            Collections.singletonList(fragmentInstance),
-            QueryType.WRITE,
-            null,
-            null);
-    try {
-      standaloneScheduler.start();
-      Assert.assertEquals(QueryState.FINISHED, stateMachine.getState());
-    } catch (Exception e) {
-      e.printStackTrace();
-      Assert.fail();
-    } finally {
-      standaloneScheduler.stop();
-    }
-  }
-
-  @Test
-  public void testInsertTablet() throws DataRegionException, MetadataException {
-    PartialPath deviceId = new PartialPath("root.vehicle.d0");
-    String[] measurements = new String[2];
-    measurements[0] = "s0";
-    measurements[1] = "s1";
-    TSDataType[] dataTypes = new TSDataType[2];
-    dataTypes[0] = TSDataType.INT32;
-    dataTypes[1] = TSDataType.INT64;
-
-    MeasurementSchema[] measurementSchemas = new MeasurementSchema[2];
-    measurementSchemas[0] = new MeasurementSchema("s0", TSDataType.INT32, TSEncoding.PLAIN);
-    measurementSchemas[1] = new MeasurementSchema("s1", TSDataType.INT64, TSEncoding.PLAIN);
-
-    long[] times = new long[100];
-    Object[] columns = new Object[2];
-    columns[0] = new int[100];
-    columns[1] = new long[100];
-
-    for (int r = 0; r < 100; r++) {
-      times[r] = r;
-      ((int[]) columns[0])[r] = 1;
-      ((long[]) columns[1])[r] = 1;
-    }
-
-    InsertTabletNode insertTabletNode =
-        new InsertTabletNode(
-            new QueryId("test_write").genPlanNodeId(),
-            deviceId,
-            false,
-            measurements,
-            dataTypes,
-            times,
-            null,
-            columns,
-            times.length);
-
-    TRegionReplicaSet regionReplicaSet = genRegionReplicaSet(TConsensusGroupType.DataRegion);
-    PlanFragment planFragment = new PlanFragment(new PlanFragmentId("2", 3), insertTabletNode);
-    FragmentInstance fragmentInstance =
-        new FragmentInstance(
-            planFragment,
-            planFragment.getId().genFragmentInstanceId(),
-            new GroupByFilter(1, 2, 3, 4),
-            QueryType.WRITE,
-            conf.getQueryTimeoutThreshold(),
-            sessionInfo);
-    fragmentInstance.setExecutorAndHost(new StorageExecutor(regionReplicaSet));
-
-    configNode.getBelongedSchemaRegionIdWithAutoCreate(deviceId);
-    configNode.getBelongedDataRegionIdWithAutoCreate(deviceId);
-    MPPQueryContext context =
-        new MPPQueryContext(
-            "",
-            new QueryId("query1"),
-            new SessionInfo(1L, "fakeUsername", "fakeZoneId"),
-            new TEndPoint(),
-            new TEndPoint());
-    ExecutorService executor = IoTDBThreadPoolFactory.newSingleThreadExecutor("Test");
-    QueryStateMachine stateMachine = new QueryStateMachine(context.getQueryId(), executor);
-
-    Assert.assertFalse(stateMachine.getState().isDone());
-    // execute request
-    StandaloneScheduler standaloneScheduler =
-        new StandaloneScheduler(
-            context,
-            stateMachine,
-            Collections.singletonList(fragmentInstance),
-            QueryType.WRITE,
-            null,
-            null);
-    try {
-      standaloneScheduler.start();
-      Assert.assertEquals(QueryState.FINISHED, stateMachine.getState());
-    } catch (Exception e) {
-      e.printStackTrace();
-      Assert.fail();
-    } finally {
-      standaloneScheduler.stop();
-    }
-  }
-
-  private TRegionReplicaSet genRegionReplicaSet(TConsensusGroupType type) {
-    List<TDataNodeLocation> dataNodeList = new ArrayList<>();
-    dataNodeList.add(
-        new TDataNodeLocation()
-            .setClientRpcEndPoint(new TEndPoint(conf.getRpcAddress(), conf.getRpcPort()))
-            .setInternalEndPoint(new TEndPoint(conf.getInternalAddress(), conf.getInternalPort()))
-            .setMPPDataExchangeEndPoint(
-                new TEndPoint(conf.getInternalAddress(), conf.getMppDataExchangePort()))
-            .setDataRegionConsensusEndPoint(
-                new TEndPoint(conf.getInternalAddress(), conf.getDataRegionConsensusPort()))
-            .setSchemaRegionConsensusEndPoint(
-                new TEndPoint(conf.getInternalAddress(), conf.getSchemaRegionConsensusPort())));
-
-    // construct fragmentInstance
-    return new TRegionReplicaSet(new TConsensusGroupId(type, 0), dataNodeList);
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
index 5f43136785..d48f2cebe1 100644
--- a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
+++ b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
@@ -22,6 +22,7 @@ import org.apache.iotdb.commons.auth.AuthException;
 import org.apache.iotdb.commons.cluster.NodeStatus;
 import org.apache.iotdb.commons.conf.CommonConfig;
 import org.apache.iotdb.commons.conf.CommonDescriptor;
+import org.apache.iotdb.commons.exception.StartupException;
 import org.apache.iotdb.commons.udf.service.UDFManagementService;
 import org.apache.iotdb.db.auth.AuthorizerManager;
 import org.apache.iotdb.db.conf.IoTDBConfig;
@@ -33,9 +34,12 @@ import org.apache.iotdb.db.engine.cache.BloomFilterCache;
 import org.apache.iotdb.db.engine.cache.ChunkCache;
 import org.apache.iotdb.db.engine.cache.TimeSeriesMetadataCache;
 import org.apache.iotdb.db.engine.compaction.CompactionTaskManager;
+import org.apache.iotdb.db.engine.flush.FlushManager;
 import org.apache.iotdb.db.exception.StorageEngineException;
+import org.apache.iotdb.db.localconfignode.LocalConfigNode;
 import org.apache.iotdb.db.metadata.idtable.IDTableManager;
 import org.apache.iotdb.db.metadata.idtable.entry.DeviceIDFactory;
+import org.apache.iotdb.db.metadata.schemaregion.SchemaEngine;
 import org.apache.iotdb.db.query.context.QueryContext;
 import org.apache.iotdb.db.query.control.FileReaderManager;
 import org.apache.iotdb.db.query.control.QueryResourceManager;
@@ -134,6 +138,10 @@ public class EnvironmentUtils {
 
     StorageEngine.getInstance().stop();
 
+    SchemaEngine.getInstance().clear();
+    LocalConfigNode.getInstance().clear();
+    FlushManager.getInstance().stop();
+
     CommonDescriptor.getInstance().getConfig().setNodeStatus(NodeStatus.Running);
     // We must disable MQTT service as it will cost a lot of time to be shutdown, which may slow our
     // unit tests.
@@ -269,6 +277,20 @@ public class EnvironmentUtils {
 
     createAllDir();
 
+    LocalConfigNode.getInstance().init();
+
+    StorageEngine.getInstance().start();
+
+    SchemaEngine.getInstance().init();
+
+    CompactionTaskManager.getInstance().start();
+
+    try {
+      FlushManager.getInstance().start();
+    } catch (StartupException e) {
+      throw new RuntimeException(e);
+    }
+
     // reset id method
     DeviceIDFactory.getInstance().reset();