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

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


The following commit(s) were added to refs/heads/master by this push:
     new 76d3a13e29 Eliminate LocalSchemaProcessor and stale code (#8802)
76d3a13e29 is described below

commit 76d3a13e293bfccdc2c8091781eab40a11c72f5f
Author: Marcos_Zyk <[email protected]>
AuthorDate: Tue Jan 10 11:05:23 2023 +0800

    Eliminate LocalSchemaProcessor and stale code (#8802)
    
    Eliminate LocalSchemaProcessor and stale code (#8802)
---
 .../iotdb/db/localconfignode/LocalConfigNode.java  | 130 +----------
 .../iotdb/db/metadata/LocalSchemaProcessor.java    | 250 ---------------------
 .../iotdb/db/metadata/mtree/ConfigMTree.java       |  21 --
 .../storagegroup/IStorageGroupSchemaManager.java   |  53 -----
 .../storagegroup/StorageGroupSchemaManager.java    |  78 -------
 .../schema/NodePathsSchemaScanOperator.java        | 159 -------------
 .../iotdb/db/engine/MetadataManagerHelper.java     | 158 -------------
 .../compaction/TestUtilsForAlignedSeries.java      |  42 +---
 .../db/engine/compaction/cross/MergeTest.java      |  19 --
 .../inner/AbstractInnerSpaceCompactionTest.java    |  19 --
 ...nerSeqCompactionWithReadChunkPerformerTest.java |  17 --
 ...rUnseqCompactionWithReadPointPerformerTest.java |  19 --
 .../inner/sizetiered/SizeTieredCompactionTest.java |  19 --
 .../recover/SizeTieredCompactionRecoverTest.java   |  16 --
 .../db/engine/memtable/MemTableFlushTaskTest.java  |   2 -
 .../iotdb/db/metadata/mtree/ConfigMTreeTest.java   |   6 -
 .../iotdb/db/metadata/mtree/MTreeBelowSGTest.java  |  12 -
 .../execution/operator/AlignedSeriesTestUtil.java  |  53 -----
 .../iotdb/db/rescon/ResourceManagerTest.java       |  16 --
 .../DataNodeInternalRPCServiceImplTest.java        |  11 +-
 .../org/apache/iotdb/db/utils/SchemaTestUtils.java |  22 +-
 .../db/wal/recover/WALRecoverManagerTest.java      |  32 ---
 .../db/wal/recover/file/TsFilePlanRedoerTest.java  |  53 -----
 .../file/UnsealedTsFileRecoverPerformerTest.java   |  31 ---
 24 files changed, 22 insertions(+), 1216 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java 
b/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java
index ec86b2a3d5..3dab7e367f 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java
@@ -35,15 +35,8 @@ 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.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.StorageGroupAlreadySetException;
-import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.metadata.schemaregion.ISchemaRegion;
 import org.apache.iotdb.db.metadata.schemaregion.SchemaEngine;
-import org.apache.iotdb.db.metadata.storagegroup.IStorageGroupSchemaManager;
-import org.apache.iotdb.db.metadata.storagegroup.StorageGroupSchemaManager;
-import org.apache.iotdb.db.metadata.utils.MetaUtils;
-import org.apache.iotdb.db.rescon.MemTableManager;
 import org.apache.iotdb.rpc.RpcUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
 
@@ -51,8 +44,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -67,9 +58,6 @@ public class LocalConfigNode {
 
   private static final IoTDBConfig config = 
IoTDBDescriptor.getInstance().getConfig();
   private volatile boolean initialized = false;
-
-  private final IStorageGroupSchemaManager storageGroupSchemaManager =
-      StorageGroupSchemaManager.getInstance();
   private final SchemaEngine schemaEngine = SchemaEngine.getInstance();
   private final LocalSchemaPartitionTable schemaPartitionTable =
       LocalSchemaPartitionTable.getInstance();
@@ -110,7 +98,6 @@ public class LocalConfigNode {
     }
 
     try {
-      storageGroupSchemaManager.init();
 
       Map<PartialPath, List<SchemaRegionId>> recoveredLocalSchemaRegionInfo =
           schemaEngine.initForLocalConfigNode();
@@ -122,7 +109,7 @@ public class LocalConfigNode {
             storageEngine.getLocalDataRegionInfo();
         dataPartitionInfo.init(recoveredLocalDataRegionInfo);
       }
-    } catch (MetadataException | IOException e) {
+    } catch (MetadataException e) {
       logger.error(
           "Cannot recover all MTree from file, we try to recover as possible 
as we can", e);
     }
@@ -135,125 +122,16 @@ public class LocalConfigNode {
       return;
     }
 
-    try {
-
-      schemaPartitionTable.clear();
-      schemaEngine.clear();
-      storageGroupSchemaManager.clear();
+    schemaPartitionTable.clear();
+    schemaEngine.clear();
 
-      dataPartitionInfo.clear();
-
-    } catch (IOException e) {
-      logger.error("Error occurred when clearing LocalConfigNode:", e);
-    }
+    dataPartitionInfo.clear();
 
     initialized = false;
   }
 
   // endregion
 
-  // region Interfaces for database management
-
-  // region Interfaces for database write operation
-
-  /**
-   * CREATE DATABASE of the given path to MTree.
-   *
-   * @param storageGroup root.node.(node)*
-   */
-  public void setStorageGroup(PartialPath storageGroup) throws 
MetadataException {
-    storageGroupSchemaManager.setStorageGroup(storageGroup);
-    for (SchemaRegionId schemaRegionId : 
schemaPartitionTable.setStorageGroup(storageGroup)) {
-      schemaEngine.createSchemaRegion(storageGroup, schemaRegionId);
-    }
-
-    if (!config.isEnableMemControl()) {
-      MemTableManager.getInstance().addOrDeleteStorageGroup(1);
-    }
-  }
-
-  private PartialPath ensureStorageGroup(PartialPath path) throws 
MetadataException {
-    try {
-      return getBelongedStorageGroup(path);
-    } catch (StorageGroupNotSetException e) {
-      if (!config.isAutoCreateSchemaEnabled()) {
-        throw e;
-      }
-      PartialPath storageGroupPath =
-          MetaUtils.getStorageGroupPathByLevel(path, 
config.getDefaultStorageGroupLevel());
-      try {
-        setStorageGroup(storageGroupPath);
-        return storageGroupPath;
-      } catch (StorageGroupAlreadySetException 
storageGroupAlreadySetException) {
-        if (storageGroupAlreadySetException.isHasChild()) {
-          // if setStorageGroup failure is because of child, the deviceNode 
should not be created.
-          // Timeseries can't be created under a deviceNode without 
storageGroup.
-          throw storageGroupAlreadySetException;
-        }
-
-        // concurrent timeseries creation may result concurrent 
ensureStorageGroup
-        // it's ok that the storageGroup has already been set
-        return getBelongedStorageGroup(path);
-      }
-    }
-  }
-
-  // endregion
-
-  // region Interfaces for database info query
-
-  /**
-   * Get database name by path
-   *
-   * <p>e.g., root.sg1 is a database and path = root.sg1.d1, return root.sg1
-   *
-   * @param path only full path, cannot be path pattern
-   * @return database in the given path
-   */
-  public PartialPath getBelongedStorageGroup(PartialPath path) throws 
StorageGroupNotSetException {
-    return storageGroupSchemaManager.getBelongedStorageGroup(path);
-  }
-
-  // endregion
-
-  // endregion
-
-  // region Interfaces for SchemaRegionId Management
-
-  // This interface involves database and schema region auto creation
-  public SchemaRegionId getBelongedSchemaRegionIdWithAutoCreate(PartialPath 
path)
-      throws MetadataException {
-    PartialPath storageGroup = ensureStorageGroup(path);
-    SchemaRegionId schemaRegionId = 
schemaPartitionTable.getSchemaRegionId(storageGroup, path);
-    if (schemaRegionId == null) {
-      schemaPartitionTable.setStorageGroup(storageGroup);
-      schemaRegionId = schemaPartitionTable.getSchemaRegionId(storageGroup, 
path);
-    }
-    ISchemaRegion schemaRegion = schemaEngine.getSchemaRegion(schemaRegionId);
-    if (schemaRegion == null) {
-      schemaEngine.createSchemaRegion(storageGroup, schemaRegionId);
-    }
-    return schemaRegionId;
-  }
-
-  /**
-   * Get the target SchemaRegionIds, which will be involved/covered by the 
given pathPattern. The
-   * path may contain wildcards, * or **. This method is the first step when 
there's a task on
-   * multiple paths represented by the given pathPattern. If isPrefixMatch, 
all databases under the
-   * prefixPath that matches the given pathPattern will be collected.
-   */
-  public List<SchemaRegionId> getInvolvedSchemaRegionIds(PartialPath 
pathPattern)
-      throws MetadataException {
-    List<SchemaRegionId> result = new ArrayList<>();
-    for (PartialPath storageGroup :
-        storageGroupSchemaManager.getInvolvedStorageGroups(pathPattern)) {
-      
result.addAll(schemaPartitionTable.getInvolvedSchemaRegionIds(storageGroup, 
pathPattern));
-    }
-    return result;
-  }
-
-  // endregion
-
   public TSStatus executeMergeOperation() {
     try {
       storageEngine.mergeAll();
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java 
b/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java
deleted file mode 100644
index 9aaecc5273..0000000000
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java
+++ /dev/null
@@ -1,250 +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.consensus.SchemaRegionId;
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.MeasurementPath;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.commons.path.PathPatternTree;
-import org.apache.iotdb.db.conf.IoTDBConfig;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.exception.metadata.AliasAlreadyExistException;
-import org.apache.iotdb.db.exception.metadata.MeasurementAlreadyExistException;
-import org.apache.iotdb.db.exception.metadata.PathAlreadyExistException;
-import org.apache.iotdb.db.exception.metadata.PathNotExistException;
-import org.apache.iotdb.db.localconfignode.LocalConfigNode;
-import 
org.apache.iotdb.db.metadata.plan.schemaregion.impl.read.SchemaRegionReadPlanFactory;
-import 
org.apache.iotdb.db.metadata.plan.schemaregion.impl.write.SchemaRegionWritePlanFactory;
-import org.apache.iotdb.db.metadata.query.info.ITimeSeriesSchemaInfo;
-import org.apache.iotdb.db.metadata.query.reader.ISchemaReader;
-import org.apache.iotdb.db.metadata.schemaregion.ISchemaRegion;
-import org.apache.iotdb.db.metadata.schemaregion.SchemaEngine;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This class takes the responsibility of serialization of all the metadata 
info and persistent it
- * into files. This class contains all the interfaces to modify the metadata 
for delta system.
- *
- * <p>Since there are too many interfaces and methods in this class, we use 
code region to help
- * manage code. The code region starts with //region and ends with 
//endregion. When using Intellij
- * Idea to develop, it's easy to fold the code region and see code region 
overview by collapsing
- * all.
- *
- * <p>The codes are divided into the following code regions:
- *
- * <ol>
- *   <li>SchemaProcessor Singleton
- *   <li>Interfaces and Implementation for Timeseries operation
- *   <li>Interfaces and Implementation for StorageGroup and TTL operation
- *   <li>Interfaces for metadata info Query
- *       <ol>
- *         <li>Interfaces for metadata count
- *         <li>Interfaces for level Node info Query
- *         <li>Interfaces for StorageGroup and TTL info Query
- *         <li>Interfaces for Entity/Device info Query
- *         <li>Interfaces for timeseries, measurement and schema info Query
- *       </ol>
- *   <li>Interfaces and methods for MNode query
- *   <li>Interfaces for alias and tag/attribute operations
- *   <li>TestOnly Interfaces
- * </ol>
- *
- * @deprecated
- */
-@SuppressWarnings("java:S1135") // ignore todos
-// Now it's only used for test and isn't able to recover after restarting
-@Deprecated
-public class LocalSchemaProcessor {
-
-  private static final Logger logger = 
LoggerFactory.getLogger(LocalSchemaProcessor.class);
-
-  protected static IoTDBConfig config = 
IoTDBDescriptor.getInstance().getConfig();
-
-  private final LocalConfigNode configManager = LocalConfigNode.getInstance();
-  private final SchemaEngine schemaEngine = SchemaEngine.getInstance();
-
-  // region SchemaProcessor Singleton
-  private static class LocalSchemaProcessorHolder {
-
-    private LocalSchemaProcessorHolder() {
-      // allowed to do nothing
-    }
-
-    private static final LocalSchemaProcessor INSTANCE = new 
LocalSchemaProcessor();
-  }
-
-  /** we should not use this function in other place, but only in IoTDB class 
*/
-  public static LocalSchemaProcessor getInstance() {
-    return LocalSchemaProcessorHolder.INSTANCE;
-  }
-
-  protected LocalSchemaProcessor() {}
-  // endregion
-
-  // region methods in this region is only used for local schemaRegion 
management.
-
-  // This interface involves database auto creation
-  private ISchemaRegion getBelongedSchemaRegionWithAutoCreate(PartialPath path)
-      throws MetadataException {
-    return schemaEngine.getSchemaRegion(
-        configManager.getBelongedSchemaRegionIdWithAutoCreate(path));
-  }
-
-  /**
-   * Get the target SchemaRegion, which will be involved/covered by the given 
pathPattern. The path
-   * may contain wildcards, * or **. This method is the first step when 
there's a task on multiple
-   * paths represented by the given pathPattern. If isPrefixMatch, all 
databases under the
-   * prefixPath that matches the given pathPattern will be collected.
-   */
-  private List<ISchemaRegion> getInvolvedSchemaRegions(PartialPath pathPattern)
-      throws MetadataException {
-    List<SchemaRegionId> schemaRegionIds = 
configManager.getInvolvedSchemaRegionIds(pathPattern);
-    List<ISchemaRegion> schemaRegions = new ArrayList<>();
-    for (SchemaRegionId schemaRegionId : schemaRegionIds) {
-      schemaRegions.add(schemaEngine.getSchemaRegion(schemaRegionId));
-    }
-    return schemaRegions;
-  }
-  // endregion
-
-  // region Interfaces and Implementation for Timeseries operation
-  // including create and delete
-
-  /**
-   * Add one timeseries to metadata tree, if the timeseries already exists, 
throw exception
-   *
-   * @param path the timeseries path
-   * @param dataType the dateType {@code DataType} of the timeseries
-   * @param encoding the encoding function {@code Encoding} of the timeseries
-   * @param compressor the compressor function {@code Compressor} of the time 
series
-   */
-  public void createTimeseries(
-      PartialPath path,
-      TSDataType dataType,
-      TSEncoding encoding,
-      CompressionType compressor,
-      Map<String, String> props)
-      throws MetadataException {
-    try {
-      getBelongedSchemaRegionWithAutoCreate(path)
-          .createTimeseries(
-              SchemaRegionWritePlanFactory.getCreateTimeSeriesPlan(
-                  path, dataType, encoding, compressor, props, null, null, 
null),
-              -1);
-    } catch (PathAlreadyExistException
-        | AliasAlreadyExistException
-        | MeasurementAlreadyExistException e) {
-      if (logger.isDebugEnabled()) {
-        logger.debug(
-            "Ignore PathAlreadyExistException and AliasAlreadyExistException 
when Concurrent inserting"
-                + " a non-exist time series {}",
-            path);
-      }
-    }
-  }
-
-  public void createAlignedTimeSeries(
-      PartialPath prefixPath,
-      List<String> measurements,
-      List<TSDataType> dataTypes,
-      List<TSEncoding> encodings,
-      List<CompressionType> compressors)
-      throws MetadataException {
-    getBelongedSchemaRegionWithAutoCreate(prefixPath)
-        .createAlignedTimeSeries(
-            SchemaRegionWritePlanFactory.getCreateAlignedTimeSeriesPlan(
-                prefixPath, measurements, dataTypes, encodings, compressors, 
null, null, null));
-  }
-
-  /**
-   * Delete all timeseries matching the given path pattern, may cross 
different database
-   *
-   * @param pathPattern path to be deleted
-   */
-  public void deleteTimeseries(PartialPath pathPattern) throws 
MetadataException {
-    List<ISchemaRegion> schemaRegions = getInvolvedSchemaRegions(pathPattern);
-    if (schemaRegions.isEmpty()) {
-      // In the cluster mode, the deletion of a timeseries will be forwarded 
to all the nodes. For
-      // nodes that do not have the metadata of the timeseries, the 
coordinator expects a
-      // PathNotExistException.
-      throw new PathNotExistException(pathPattern.getFullPath());
-    }
-
-    PathPatternTree patternTree = new PathPatternTree();
-    patternTree.appendPathPattern(pathPattern);
-    patternTree.constructTree();
-    for (ISchemaRegion schemaRegion : schemaRegions) {
-      schemaRegion.constructSchemaBlackList(patternTree);
-      schemaRegion.deleteTimeseriesInBlackList(patternTree);
-    }
-  }
-  // endregion
-
-  // region Interfaces and Implementation for StorageGroup and TTL operation
-  // including sg set and delete, and ttl set
-
-  /**
-   * CREATE DATABASE of the given path to MTree.
-   *
-   * @param storageGroup root.node.(node)*
-   */
-  public void setStorageGroup(PartialPath storageGroup) throws 
MetadataException {
-    configManager.setStorageGroup(storageGroup);
-  }
-  // endregion
-
-  // region Interfaces for metadata info Query
-
-  // region Interfaces for timeseries, measurement and schema info Query
-
-  public List<MeasurementPath> getMeasurementPathsWithAlias(PartialPath 
pathPattern)
-      throws MetadataException {
-    List<MeasurementPath> measurementPaths = new LinkedList<>();
-
-    for (ISchemaRegion schemaRegion : getInvolvedSchemaRegions(pathPattern)) {
-      ISchemaReader<ITimeSeriesSchemaInfo> timeSeriesReader =
-          schemaRegion.getTimeSeriesReader(
-              SchemaRegionReadPlanFactory.getShowTimeSeriesPlan(pathPattern));
-      while (timeSeriesReader.hasNext()) {
-        ITimeSeriesSchemaInfo timeSeriesSchemaInfo = timeSeriesReader.next();
-        MeasurementPath measurementPath =
-            new MeasurementPath(
-                timeSeriesSchemaInfo.getPartialPath(), 
timeSeriesSchemaInfo.getSchema());
-        measurementPath.setMeasurementAlias(timeSeriesSchemaInfo.getAlias());
-        
measurementPath.setUnderAlignedEntity(timeSeriesSchemaInfo.isUnderAlignedDevice());
-        measurementPaths.add(measurementPath);
-      }
-    }
-
-    return measurementPaths;
-  }
-  // endregion
-  // endregion
-}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/ConfigMTree.java 
b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/ConfigMTree.java
index fd43420803..8c2649018c 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/ConfigMTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/ConfigMTree.java
@@ -157,27 +157,6 @@ public class ConfigMTree {
     }
   }
 
-  /**
-   * Get database path by path
-   *
-   * <p>e.g., root.sg1 is database, path is root.sg1.d1, return root.sg1
-   *
-   * @return database in the given path
-   */
-  public PartialPath getBelongedStorageGroup(PartialPath path) throws 
StorageGroupNotSetException {
-    String[] nodes = path.getNodes();
-    IMNode cur = root;
-    for (int i = 1; i < nodes.length; i++) {
-      cur = cur.getChild(nodes[i]);
-      if (cur == null) {
-        throw new StorageGroupNotSetException(path.getFullPath());
-      } else if (cur.isStorageGroup()) {
-        return cur.getPartialPath();
-      }
-    }
-    throw new StorageGroupNotSetException(path.getFullPath());
-  }
-
   /**
    * Get the database that given path pattern matches or belongs to.
    *
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/storagegroup/IStorageGroupSchemaManager.java
 
b/server/src/main/java/org/apache/iotdb/db/metadata/storagegroup/IStorageGroupSchemaManager.java
deleted file mode 100644
index f2c874ebfe..0000000000
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/storagegroup/IStorageGroupSchemaManager.java
+++ /dev/null
@@ -1,53 +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.storagegroup;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
-
-import java.io.IOException;
-import java.util.List;
-
-// This class declares all the interfaces for database management.
-public interface IStorageGroupSchemaManager {
-
-  void init() throws MetadataException, IOException;
-
-  void clear() throws IOException;
-
-  /**
-   * create database of the given path to MTree.
-   *
-   * @param path database path
-   */
-  void setStorageGroup(PartialPath path) throws MetadataException;
-
-  /**
-   * Get database name by path
-   *
-   * <p>e.g., root.sg1 is a database and path = root.sg1.d1, return root.sg1
-   *
-   * @param path only full path, cannot be path pattern
-   * @return database in the given path
-   */
-  PartialPath getBelongedStorageGroup(PartialPath path) throws 
StorageGroupNotSetException;
-
-  List<PartialPath> getInvolvedStorageGroups(PartialPath pathPattern) throws 
MetadataException;
-}
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
deleted file mode 100644
index 24c2c89300..0000000000
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/storagegroup/StorageGroupSchemaManager.java
+++ /dev/null
@@ -1,78 +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.storagegroup;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
-import org.apache.iotdb.db.metadata.mtree.ConfigMTree;
-
-import java.io.IOException;
-import java.util.List;
-
-// Never support restart
-// This class implements all the interfaces for database management. The 
MTreeAboveSg is used
-// to manage all the databases and MNodes above database.
-@Deprecated
-public class StorageGroupSchemaManager implements IStorageGroupSchemaManager {
-
-  private ConfigMTree mtree;
-
-  private static class StorageGroupManagerHolder {
-
-    private static final StorageGroupSchemaManager INSTANCE = new 
StorageGroupSchemaManager();
-
-    private StorageGroupManagerHolder() {}
-  }
-
-  public static StorageGroupSchemaManager getInstance() {
-    return StorageGroupManagerHolder.INSTANCE;
-  }
-
-  private StorageGroupSchemaManager() {}
-
-  public synchronized void init() throws MetadataException, IOException {
-
-    mtree = new ConfigMTree();
-  }
-
-  public synchronized void clear() throws IOException {
-
-    if (mtree != null) {
-      mtree.clear();
-    }
-  }
-
-  @Override
-  public void setStorageGroup(PartialPath path) throws MetadataException {
-    mtree.setStorageGroup(path);
-  }
-
-  @Override
-  public PartialPath getBelongedStorageGroup(PartialPath path) throws 
StorageGroupNotSetException {
-    return mtree.getBelongedStorageGroup(path);
-  }
-
-  @Override
-  public List<PartialPath> getInvolvedStorageGroups(PartialPath pathPattern)
-      throws MetadataException {
-    return mtree.getBelongedStorageGroups(pathPattern);
-  }
-}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/schema/NodePathsSchemaScanOperator.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/schema/NodePathsSchemaScanOperator.java
deleted file mode 100644
index 6902648e44..0000000000
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/schema/NodePathsSchemaScanOperator.java
+++ /dev/null
@@ -1,159 +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.execution.operator.schema;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import 
org.apache.iotdb.db.metadata.plan.schemaregion.impl.read.SchemaRegionReadPlanFactory;
-import org.apache.iotdb.db.metadata.plan.schemaregion.read.IShowNodesPlan;
-import org.apache.iotdb.db.metadata.query.info.INodeSchemaInfo;
-import org.apache.iotdb.db.metadata.query.reader.ISchemaReader;
-import org.apache.iotdb.db.mpp.common.header.ColumnHeader;
-import org.apache.iotdb.db.mpp.common.header.ColumnHeaderConstant;
-import org.apache.iotdb.db.mpp.execution.driver.SchemaDriverContext;
-import org.apache.iotdb.db.mpp.execution.operator.OperatorContext;
-import org.apache.iotdb.db.mpp.execution.operator.source.SourceOperator;
-import org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNodeId;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
-import org.apache.iotdb.tsfile.utils.Binary;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static 
org.apache.iotdb.commons.conf.IoTDBConstant.ONE_LEVEL_PATH_WILDCARD;
-import static 
org.apache.iotdb.tsfile.read.common.block.TsBlockBuilderStatus.DEFAULT_MAX_TSBLOCK_SIZE_IN_BYTES;
-
-public class NodePathsSchemaScanOperator implements SourceOperator {
-
-  private static final long MAX_SIZE = DEFAULT_MAX_TSBLOCK_SIZE_IN_BYTES;
-
-  private final PlanNodeId sourceId;
-
-  private final OperatorContext operatorContext;
-
-  private final PartialPath partialPath;
-
-  private final int level;
-
-  private boolean isFinished;
-
-  private final List<TSDataType> outputDataTypes;
-
-  private ISchemaReader<INodeSchemaInfo> nodeReader;
-
-  public NodePathsSchemaScanOperator(
-      PlanNodeId sourceId, OperatorContext operatorContext, PartialPath 
partialPath, int level) {
-    this.sourceId = sourceId;
-    this.operatorContext = operatorContext;
-    this.partialPath = partialPath;
-    this.level = level;
-    this.outputDataTypes =
-        ColumnHeaderConstant.showChildPathsColumnHeaders.stream()
-            .map(ColumnHeader::getColumnType)
-            .collect(Collectors.toList());
-  }
-
-  @Override
-  public OperatorContext getOperatorContext() {
-    return operatorContext;
-  }
-
-  @Override
-  public TsBlock next() {
-    isFinished = true;
-    TsBlockBuilder tsBlockBuilder = new TsBlockBuilder(outputDataTypes);
-    INodeSchemaInfo nodeSchemaInfo;
-    while (nodeReader.hasNext()) {
-      nodeSchemaInfo = nodeReader.next();
-      tsBlockBuilder.getTimeColumnBuilder().writeLong(0L);
-      tsBlockBuilder.getColumnBuilder(0).writeBinary(new 
Binary(nodeSchemaInfo.getFullPath()));
-      tsBlockBuilder
-          .getColumnBuilder(1)
-          .writeBinary(new 
Binary(String.valueOf(nodeSchemaInfo.getNodeType().getNodeType())));
-      tsBlockBuilder.declarePosition();
-      if (tsBlockBuilder.getRetainedSizeInBytes() >= MAX_SIZE) {
-        break;
-      }
-    }
-    return tsBlockBuilder.build();
-  }
-
-  @Override
-  public boolean hasNext() {
-    if (nodeReader == null) {
-      nodeReader = createReader();
-    }
-    return nodeReader.hasNext();
-  }
-
-  private ISchemaReader<INodeSchemaInfo> createReader() {
-    IShowNodesPlan showNodesPlan;
-    if (-1 == level) {
-      showNodesPlan =
-          SchemaRegionReadPlanFactory.getShowNodesPlan(
-              partialPath.concatNode(ONE_LEVEL_PATH_WILDCARD));
-    } else {
-      showNodesPlan = 
SchemaRegionReadPlanFactory.getShowNodesPlan(partialPath, level, false);
-    }
-    try {
-      return nodeReader =
-          ((SchemaDriverContext) operatorContext.getDriverContext())
-              .getSchemaRegion()
-              .getNodeReader(showNodesPlan);
-    } catch (MetadataException e) {
-      throw new RuntimeException(e.getMessage(), e);
-    }
-  }
-
-  @Override
-  public boolean isFinished() {
-    return !hasNextWithTimer();
-  }
-
-  @Override
-  public PlanNodeId getSourceId() {
-    return sourceId;
-  }
-
-  @Override
-  public long calculateMaxPeekMemory() {
-    return DEFAULT_MAX_TSBLOCK_SIZE_IN_BYTES;
-  }
-
-  @Override
-  public long calculateMaxReturnSize() {
-    return DEFAULT_MAX_TSBLOCK_SIZE_IN_BYTES;
-  }
-
-  @Override
-  public long calculateRetainedSizeAfterCallingNext() {
-    return 0L;
-  }
-
-  @Override
-  public void close() throws Exception {
-    if (nodeReader != null) {
-      nodeReader.close();
-      nodeReader = null;
-    }
-  }
-}
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/MetadataManagerHelper.java 
b/server/src/test/java/org/apache/iotdb/db/engine/MetadataManagerHelper.java
deleted file mode 100644
index 630427e3e6..0000000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/MetadataManagerHelper.java
+++ /dev/null
@@ -1,158 +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.engine;
-
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.localconfignode.LocalConfigNode;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
-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 java.util.Collections;
-
-public class MetadataManagerHelper {
-
-  public static void initMetadata() {
-    LocalConfigNode.getInstance().init();
-    LocalSchemaProcessor schemaProcessor = LocalSchemaProcessor.getInstance();
-    try {
-      schemaProcessor.setStorageGroup(new PartialPath("root.vehicle.d0"));
-      schemaProcessor.setStorageGroup(new PartialPath("root.vehicle.d1"));
-      schemaProcessor.setStorageGroup(new PartialPath("root.vehicle.d2"));
-
-      CompressionType compressionType = 
TSFileDescriptor.getInstance().getConfig().getCompressor();
-
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d0.s0"),
-          TSDataType.valueOf("INT32"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d0.s1"),
-          TSDataType.valueOf("INT64"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d0.s2"),
-          TSDataType.valueOf("FLOAT"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d0.s3"),
-          TSDataType.valueOf("DOUBLE"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d0.s4"),
-          TSDataType.valueOf("BOOLEAN"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d0.s5"),
-          TSDataType.valueOf("TEXT"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d1.s0"),
-          TSDataType.valueOf("INT32"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d1.s1"),
-          TSDataType.valueOf("INT64"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d1.s2"),
-          TSDataType.valueOf("FLOAT"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d1.s3"),
-          TSDataType.valueOf("DOUBLE"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d1.s4"),
-          TSDataType.valueOf("BOOLEAN"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d1.s5"),
-          TSDataType.valueOf("TEXT"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d2.s0"),
-          TSDataType.valueOf("INT32"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d2.s1"),
-          TSDataType.valueOf("INT64"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d2.s2"),
-          TSDataType.valueOf("FLOAT"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d2.s3"),
-          TSDataType.valueOf("DOUBLE"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d2.s4"),
-          TSDataType.valueOf("BOOLEAN"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-      schemaProcessor.createTimeseries(
-          new PartialPath("root.vehicle.d2.s5"),
-          TSDataType.valueOf("TEXT"),
-          TSEncoding.PLAIN,
-          compressionType,
-          Collections.emptyMap());
-
-    } catch (Exception e) {
-      throw new RuntimeException("Initialize the metadata manager failed", e);
-    }
-  }
-}
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/TestUtilsForAlignedSeries.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/TestUtilsForAlignedSeries.java
index 88ec47e3e9..92fb443a28 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/TestUtilsForAlignedSeries.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/TestUtilsForAlignedSeries.java
@@ -20,12 +20,8 @@
 package org.apache.iotdb.db.engine.compaction;
 
 import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
-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.utils.Binary;
 import org.apache.iotdb.tsfile.write.chunk.AlignedChunkWriterImpl;
 import org.apache.iotdb.tsfile.write.chunk.ChunkWriterImpl;
@@ -35,48 +31,12 @@ import org.apache.iotdb.tsfile.write.writer.TsFileIOWriter;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.Random;
 
 public class TestUtilsForAlignedSeries {
   public static void registerTimeSeries(
       String storageGroup, String[] devices, IMeasurementSchema[] schemas, 
boolean[] isAligned)
-      throws MetadataException {
-    LocalSchemaProcessor.getInstance().setStorageGroup(new 
PartialPath(storageGroup));
-    for (int i = 0; i < devices.length; ++i) {
-      boolean aligned = isAligned[i];
-      String device = devices[i];
-      if (!aligned) {
-        for (IMeasurementSchema schema : schemas) {
-          LocalSchemaProcessor.getInstance()
-              .createTimeseries(
-                  new PartialPath(device, schema.getMeasurementId()),
-                  schema.getType(),
-                  schema.getEncodingType(),
-                  schema.getCompressor(),
-                  new HashMap<>());
-        }
-      } else {
-        TSDataType[] dataTypes = new TSDataType[schemas.length];
-        TSEncoding[] encodings = new TSEncoding[schemas.length];
-        CompressionType[] compressionTypes = new 
CompressionType[schemas.length];
-        String[] measurements = new String[schemas.length];
-        for (int j = 0; j < schemas.length; ++j) {
-          dataTypes[j] = schemas[j].getType();
-          encodings[j] = schemas[j].getEncodingType();
-          compressionTypes[j] = schemas[j].getCompressor();
-          measurements[j] = schemas[j].getMeasurementId();
-        }
-        LocalSchemaProcessor.getInstance()
-            .createAlignedTimeSeries(
-                new PartialPath(device),
-                Arrays.asList(measurements),
-                Arrays.asList(dataTypes),
-                Arrays.asList(encodings),
-                Arrays.asList(compressionTypes));
-      }
-    }
-  }
+      throws MetadataException {}
 
   public static void writeTsFile(
       String[] devices,
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeTest.java
index 7f6c9cea15..9d2c4e4194 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeTest.java
@@ -20,7 +20,6 @@
 package org.apache.iotdb.db.engine.compaction.cross;
 
 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.cache.ChunkCache;
 import org.apache.iotdb.db.engine.cache.TimeSeriesMetadataCache;
@@ -28,8 +27,6 @@ import 
org.apache.iotdb.db.engine.compaction.utils.CompactionConfigRestorer;
 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;
@@ -49,7 +46,6 @@ import org.junit.Before;
 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;
@@ -75,7 +71,6 @@ abstract class MergeTest {
   @Before
   public void setUp() throws IOException, WriteProcessException, 
MetadataException {
     EnvironmentUtils.envSetUp();
-    LocalConfigNode.getInstance().init();
     prepareSeries();
     prepareFiles(seqFileNum, unseqFileNum);
   }
@@ -88,7 +83,6 @@ abstract class MergeTest {
     unseqResources.clear();
     ChunkCache.getInstance().clear();
     TimeSeriesMetadataCache.getInstance().clear();
-    LocalConfigNode.getInstance().clear();
     EnvironmentUtils.cleanEnv();
   }
 
@@ -103,19 +97,6 @@ abstract class MergeTest {
     for (int i = 0; i < deviceNum; i++) {
       deviceIds[i] = MERGE_TEST_SG + PATH_SEPARATOR + "device" + i;
     }
-    LocalSchemaProcessor.getInstance().setStorageGroup(new 
PartialPath(MERGE_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/AbstractInnerSpaceCompactionTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/AbstractInnerSpaceCompactionTest.java
index c359566376..686858a35f 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/AbstractInnerSpaceCompactionTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/AbstractInnerSpaceCompactionTest.java
@@ -21,7 +21,6 @@ package org.apache.iotdb.db.engine.compaction.inner;
 
 import org.apache.iotdb.commons.conf.IoTDBConstant;
 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.cache.ChunkCache;
 import org.apache.iotdb.db.engine.cache.TimeSeriesMetadataCache;
@@ -31,8 +30,6 @@ import org.apache.iotdb.db.engine.storagegroup.TsFileManager;
 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;
@@ -56,7 +53,6 @@ import org.slf4j.LoggerFactory;
 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;
@@ -131,7 +127,6 @@ public abstract class AbstractInnerSpaceCompactionTest {
     }
 
     EnvironmentUtils.envSetUp();
-    LocalConfigNode.getInstance().init();
     prepareSeries();
     prepareFiles(seqFileNum, unseqFileNum);
     tsFileManager = new TsFileManager(COMPACTION_TEST_SG, "0", 
tempSGDir.getAbsolutePath());
@@ -148,19 +143,6 @@ public abstract class AbstractInnerSpaceCompactionTest {
     for (int i = 0; i < deviceNum; i++) {
       deviceIds[i] = COMPACTION_TEST_SG + PATH_SEPARATOR + "device" + i;
     }
-    LocalSchemaProcessor.getInstance().setStorageGroup(new 
PartialPath(COMPACTION_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 {
@@ -241,7 +223,6 @@ public abstract class AbstractInnerSpaceCompactionTest {
     unseqResources.clear();
     ChunkCache.getInstance().clear();
     TimeSeriesMetadataCache.getInstance().clear();
-    LocalConfigNode.getInstance().clear();
     EnvironmentUtils.cleanEnv();
     if (tempSGDir.exists()) {
       FileUtils.deleteDirectory(tempSGDir);
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerSeqCompactionWithReadChunkPerformerTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerSeqCompactionWithReadChunkPerformerTest.java
index 0f9c8ba020..36ddbf3b6e 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerSeqCompactionWithReadChunkPerformerTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerSeqCompactionWithReadChunkPerformerTest.java
@@ -41,12 +41,8 @@ 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.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 InnerSeqCompactionWithReadChunkPerformerTest {
     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 InnerSeqCompactionWithReadChunkPerformerTest {
     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/InnerUnseqCompactionWithReadPointPerformerTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerUnseqCompactionWithReadPointPerformerTest.java
index ae12c410ec..85816d40ea 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerUnseqCompactionWithReadPointPerformerTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerUnseqCompactionWithReadPointPerformerTest.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.execute.performer.ICompactionPerformer;
@@ -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 InnerUnseqCompactionWithReadPointPerformerTest 
{
 
   @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 InnerUnseqCompactionWithReadPointPerformerTest 
{
     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/engine/compaction/inner/sizetiered/SizeTieredCompactionTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/sizetiered/SizeTieredCompactionTest.java
index bd7a1fcc64..8211c71ebb 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/sizetiered/SizeTieredCompactionTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/sizetiered/SizeTieredCompactionTest.java
@@ -21,7 +21,6 @@ package 
org.apache.iotdb.db.engine.compaction.inner.sizetiered;
 
 import org.apache.iotdb.commons.conf.IoTDBConstant;
 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.cache.ChunkCache;
 import org.apache.iotdb.db.engine.cache.TimeSeriesMetadataCache;
@@ -29,8 +28,6 @@ import 
org.apache.iotdb.db.engine.compaction.utils.CompactionConfigRestorer;
 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;
@@ -50,7 +47,6 @@ import org.junit.Before;
 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;
@@ -75,7 +71,6 @@ public class SizeTieredCompactionTest {
   @Before
   public void setUp() throws IOException, WriteProcessException, 
MetadataException {
     EnvironmentUtils.envSetUp();
-    LocalConfigNode.getInstance().init();
     prepareSeries();
     prepareFiles(seqFileNum, unseqFileNum);
   }
@@ -88,7 +83,6 @@ public class SizeTieredCompactionTest {
     unseqResources.clear();
     ChunkCache.getInstance().clear();
     TimeSeriesMetadataCache.getInstance().clear();
-    LocalConfigNode.getInstance().clear();
     EnvironmentUtils.cleanEnv();
   }
 
@@ -103,19 +97,6 @@ public class SizeTieredCompactionTest {
     for (int i = 0; i < deviceNum; i++) {
       deviceIds[i] = COMPACTION_TEST_SG + PATH_SEPARATOR + "device" + i;
     }
-    LocalSchemaProcessor.getInstance().setStorageGroup(new 
PartialPath(COMPACTION_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/recover/SizeTieredCompactionRecoverTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/recover/SizeTieredCompactionRecoverTest.java
index 96c1726e8e..d65c9eed31 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/recover/SizeTieredCompactionRecoverTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/recover/SizeTieredCompactionRecoverTest.java
@@ -40,8 +40,6 @@ import org.apache.iotdb.db.engine.storagegroup.TsFileManager;
 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.localconfignode.LocalConfigNode;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
@@ -127,7 +125,6 @@ public class SizeTieredCompactionRecoverTest {
 
   @Before
   public void setUp() throws Exception {
-    LocalConfigNode.getInstance().init();
     CompactionTaskManager.getInstance().start();
     originDataDirs = config.getDataDirs();
     setDataDirs(testDataDirs);
@@ -145,7 +142,6 @@ public class SizeTieredCompactionRecoverTest {
     new CompactionConfigRestorer().restoreCompactionConfig();
     CompactionTaskManager.getInstance().stop();
     setDataDirs(originDataDirs);
-    LocalConfigNode.getInstance().clear();
     File dataDir = new File(testDataDirs[0]);
     if (dataDir.exists()) {
       FileUtils.forceDelete(dataDir);
@@ -168,18 +164,6 @@ public class SizeTieredCompactionRecoverTest {
               CompressionType.UNCOMPRESSED);
       deviceIds[i] = new PartialPath(fullPaths[i].substring(0, 27));
     }
-    LocalSchemaProcessor.getInstance().setStorageGroup(new 
PartialPath(COMPACTION_TEST_SG));
-    for (int i = 0; i < fullPaths.length; ++i) {
-      MeasurementSchema schema = schemas[i];
-      PartialPath deviceId = deviceIds[i];
-      LocalSchemaProcessor.getInstance()
-          .createTimeseries(
-              deviceId.concatNode(schema.getMeasurementId()),
-              schema.getType(),
-              schema.getEncodingType(),
-              schema.getCompressor(),
-              Collections.emptyMap());
-    }
   }
 
   public void setDataDirs(String[] dataDirs) throws Exception {
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTableFlushTaskTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTableFlushTaskTest.java
index ca50c72466..13e92e33a8 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTableFlushTaskTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTableFlushTaskTest.java
@@ -20,7 +20,6 @@ package org.apache.iotdb.db.engine.memtable;
 
 import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.MetadataManagerHelper;
 import org.apache.iotdb.db.engine.flush.MemTableFlushTask;
 import org.apache.iotdb.db.exception.WriteProcessException;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
@@ -51,7 +50,6 @@ public class MemTableFlushTaskTest {
   @Before
   public void setUp() throws Exception {
     EnvironmentUtils.envSetUp();
-    MetadataManagerHelper.initMetadata();
     writer = new 
RestorableTsFileIOWriter(FSFactoryProducer.getFSFactory().getFile(filePath));
     memTable = new PrimitiveMemTable();
   }
diff --git 
a/server/src/test/java/org/apache/iotdb/db/metadata/mtree/ConfigMTreeTest.java 
b/server/src/test/java/org/apache/iotdb/db/metadata/mtree/ConfigMTreeTest.java
index 77fb3819b6..a7a2f5588c 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/metadata/mtree/ConfigMTreeTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/metadata/mtree/ConfigMTreeTest.java
@@ -99,13 +99,7 @@ public class ConfigMTreeTest {
     try {
       root.setStorageGroup(new PartialPath("root.laptop.d1"));
       assertTrue(root.isStorageGroupAlreadySet(new 
PartialPath("root.laptop.d1")));
-      assertEquals(
-          "root.laptop.d1",
-          root.getBelongedStorageGroup(new 
PartialPath("root.laptop.d1")).getFullPath());
       assertTrue(root.isStorageGroupAlreadySet(new 
PartialPath("root.laptop.d1.s1")));
-      assertEquals(
-          "root.laptop.d1",
-          root.getBelongedStorageGroup(new 
PartialPath("root.laptop.d1.s1")).getFullPath());
     } catch (MetadataException e) {
       e.printStackTrace();
       fail(e.getMessage());
diff --git 
a/server/src/test/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGTest.java 
b/server/src/test/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGTest.java
index e6eb604559..21fec98461 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGTest.java
@@ -127,12 +127,6 @@ public abstract class MTreeBelowSGTest {
     try {
       storageGroup = getStorageGroup(new PartialPath("root.laptop.d1"));
       assertTrue(root.isStorageGroupAlreadySet(new 
PartialPath("root.laptop.d1")));
-      assertEquals(
-          "root.laptop.d1",
-          root.getBelongedStorageGroup(new 
PartialPath("root.laptop.d1")).getFullPath());
-      assertEquals(
-          "root.laptop.d1",
-          root.getBelongedStorageGroup(new 
PartialPath("root.laptop.d1.s1")).getFullPath());
 
     } catch (MetadataException e) {
       e.printStackTrace();
@@ -146,9 +140,6 @@ public abstract class MTreeBelowSGTest {
     }
 
     try {
-      assertEquals(
-          "root.laptop.d1",
-          root.getBelongedStorageGroup(new 
PartialPath("root.laptop.d1.s0")).getFullPath());
       storageGroup.createTimeseries(
           new PartialPath("root.laptop.d1.s0"),
           TSDataType.INT32,
@@ -156,9 +147,6 @@ public abstract class MTreeBelowSGTest {
           TSFileDescriptor.getInstance().getConfig().getCompressor(),
           Collections.emptyMap(),
           null);
-      assertEquals(
-          "root.laptop.d1",
-          root.getBelongedStorageGroup(new 
PartialPath("root.laptop.d1.s1")).getFullPath());
       storageGroup.createTimeseries(
           new PartialPath("root.laptop.d1.s1"),
           TSDataType.INT32,
diff --git 
a/server/src/test/java/org/apache/iotdb/db/mpp/execution/operator/AlignedSeriesTestUtil.java
 
b/server/src/test/java/org/apache/iotdb/db/mpp/execution/operator/AlignedSeriesTestUtil.java
index 36d748b337..c6be93db8c 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/mpp/execution/operator/AlignedSeriesTestUtil.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/mpp/execution/operator/AlignedSeriesTestUtil.java
@@ -19,14 +19,11 @@
 package org.apache.iotdb.db.mpp.execution.operator;
 
 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.cache.ChunkCache;
 import org.apache.iotdb.db.engine.cache.TimeSeriesMetadataCache;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResourceStatus;
-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;
@@ -43,9 +40,7 @@ import org.junit.Assert;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Collections;
 import java.util.List;
-import java.util.stream.Collectors;
 
 import static org.apache.iotdb.commons.conf.IoTDBConstant.PATH_SEPARATOR;
 
@@ -67,7 +62,6 @@ public class AlignedSeriesTestUtil {
       List<TsFileResource> unseqResources,
       String sgName)
       throws MetadataException, IOException, WriteProcessException {
-    LocalConfigNode.getInstance().init();
     prepareSeries(measurementSchemas, sgName);
     prepareFiles(seqResources, unseqResources, measurementSchemas, sgName);
   }
@@ -79,7 +73,6 @@ public class AlignedSeriesTestUtil {
     unseqResources.clear();
     ChunkCache.getInstance().clear();
     TimeSeriesMetadataCache.getInstance().clear();
-    LocalConfigNode.getInstance().clear();
     EnvironmentUtils.cleanAllDir();
   }
 
@@ -206,52 +199,6 @@ public class AlignedSeriesTestUtil {
     measurementSchemas.add(
         new MeasurementSchema(
             "sensor5", TSDataType.TEXT, TSEncoding.PLAIN, 
CompressionType.SNAPPY));
-
-    LocalSchemaProcessor.getInstance().setStorageGroup(new 
PartialPath(sgName));
-    LocalSchemaProcessor.getInstance()
-        .createAlignedTimeSeries(
-            new PartialPath(sgName + PATH_SEPARATOR + "device0"),
-            measurementSchemas.stream()
-                .map(MeasurementSchema::getMeasurementId)
-                .collect(Collectors.toList()),
-            measurementSchemas.stream()
-                .map(MeasurementSchema::getType)
-                .collect(Collectors.toList()),
-            measurementSchemas.stream()
-                .map(MeasurementSchema::getEncodingType)
-                .collect(Collectors.toList()),
-            measurementSchemas.stream()
-                .map(MeasurementSchema::getCompressor)
-                .collect(Collectors.toList()));
-    LocalSchemaProcessor.getInstance()
-        .createAlignedTimeSeries(
-            new PartialPath(sgName + PATH_SEPARATOR + "device1"),
-            measurementSchemas.stream()
-                .map(MeasurementSchema::getMeasurementId)
-                .collect(Collectors.toList()),
-            measurementSchemas.stream()
-                .map(MeasurementSchema::getType)
-                .collect(Collectors.toList()),
-            measurementSchemas.stream()
-                .map(MeasurementSchema::getEncodingType)
-                .collect(Collectors.toList()),
-            measurementSchemas.stream()
-                .map(MeasurementSchema::getCompressor)
-                .collect(Collectors.toList()));
-    for (MeasurementSchema measurementSchema : measurementSchemas) {
-      LocalSchemaProcessor.getInstance()
-          .createTimeseries(
-              new PartialPath(
-                  sgName
-                      + PATH_SEPARATOR
-                      + "device2"
-                      + PATH_SEPARATOR
-                      + measurementSchema.getMeasurementId()),
-              measurementSchema.getType(),
-              measurementSchema.getEncodingType(),
-              measurementSchema.getCompressor(),
-              Collections.emptyMap());
-    }
   }
 
   private static void removeFiles(
diff --git 
a/server/src/test/java/org/apache/iotdb/db/rescon/ResourceManagerTest.java 
b/server/src/test/java/org/apache/iotdb/db/rescon/ResourceManagerTest.java
index fe56569273..2172af79f5 100644
--- a/server/src/test/java/org/apache/iotdb/db/rescon/ResourceManagerTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/rescon/ResourceManagerTest.java
@@ -20,7 +20,6 @@ package org.apache.iotdb.db.rescon;
 
 import org.apache.iotdb.commons.conf.IoTDBConstant;
 import org.apache.iotdb.commons.exception.MetadataException;
-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.constant.TestConstant;
@@ -31,7 +30,6 @@ import 
org.apache.iotdb.db.engine.storagegroup.TsFileResourceStatus;
 import org.apache.iotdb.db.engine.storagegroup.timeindex.TimeIndexLevel;
 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 +50,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;
@@ -112,19 +109,6 @@ public class ResourceManagerTest {
     for (int i = 0; i < deviceNum; i++) {
       deviceIds[i] = RESOURCE_MANAGER_TEST_SG + PATH_SEPARATOR + "device" + i;
     }
-    LocalSchemaProcessor.getInstance().setStorageGroup(new 
PartialPath(RESOURCE_MANAGER_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());
-      }
-    }
   }
 
   private void removeFiles() throws IOException {
diff --git 
a/server/src/test/java/org/apache/iotdb/db/service/DataNodeInternalRPCServiceImplTest.java
 
b/server/src/test/java/org/apache/iotdb/db/service/DataNodeInternalRPCServiceImplTest.java
index 33b62df876..c06fcf6007 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/service/DataNodeInternalRPCServiceImplTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/service/DataNodeInternalRPCServiceImplTest.java
@@ -34,7 +34,7 @@ import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.consensus.DataRegionConsensusImpl;
 import org.apache.iotdb.db.consensus.SchemaRegionConsensusImpl;
 import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.localconfignode.LocalConfigNode;
+import org.apache.iotdb.db.metadata.schemaregion.SchemaEngine;
 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;
@@ -68,7 +68,6 @@ import java.util.Map;
 public class DataNodeInternalRPCServiceImplTest {
   private static final IoTDBConfig conf = 
IoTDBDescriptor.getInstance().getConfig();
   DataNodeInternalRPCServiceImpl dataNodeInternalRPCServiceImpl;
-  static LocalConfigNode configNode;
   private static final int dataNodeId = 0;
 
   @BeforeClass
@@ -76,9 +75,9 @@ public class DataNodeInternalRPCServiceImplTest {
     // In standalone mode, we need to set dataNodeId to 0 for RaftPeerId in 
RatisConsensus
     conf.setDataNodeId(dataNodeId);
 
-    LocalConfigNode.getInstance().init();
-    configNode = LocalConfigNode.getInstance();
-    configNode.getBelongedSchemaRegionIdWithAutoCreate(new 
PartialPath("root.ln"));
+    SchemaEngine.getInstance().init();
+    SchemaEngine.getInstance()
+        .createSchemaRegion(new PartialPath("root.ln"), new SchemaRegionId(0));
     DataRegionConsensusImpl.setupAndGetInstance().start();
     SchemaRegionConsensusImpl.setupAndGetInstance().start();
     DataNodeRegionManager.getInstance().init();
@@ -108,7 +107,7 @@ public class DataNodeInternalRPCServiceImplTest {
     DataNodeRegionManager.getInstance().clear();
     DataRegionConsensusImpl.getInstance().stop();
     SchemaRegionConsensusImpl.getInstance().stop();
-    LocalConfigNode.getInstance().clear();
+    SchemaEngine.getInstance().clear();
     EnvironmentUtils.cleanEnv();
   }
 
diff --git 
a/server/src/test/java/org/apache/iotdb/db/utils/SchemaTestUtils.java 
b/server/src/test/java/org/apache/iotdb/db/utils/SchemaTestUtils.java
index 4bd3f1ac40..b36bbc6e31 100644
--- a/server/src/test/java/org/apache/iotdb/db/utils/SchemaTestUtils.java
+++ b/server/src/test/java/org/apache/iotdb/db/utils/SchemaTestUtils.java
@@ -21,20 +21,22 @@ package org.apache.iotdb.db.utils;
 import org.apache.iotdb.commons.exception.MetadataException;
 import org.apache.iotdb.commons.path.MeasurementPath;
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
-
-import java.util.List;
-
-import static org.junit.Assert.assertFalse;
+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.write.schema.MeasurementSchema;
 
 public class SchemaTestUtils {
 
   public static MeasurementPath getMeasurementPath(String pathPatternString)
       throws MetadataException {
-    PartialPath pathPattern = new PartialPath(pathPatternString);
-    List<MeasurementPath> measurementPaths =
-        
LocalSchemaProcessor.getInstance().getMeasurementPathsWithAlias(pathPattern);
-    assertFalse(measurementPaths.isEmpty());
-    return measurementPaths.get(0);
+    PartialPath path = new PartialPath(pathPatternString);
+    return new MeasurementPath(
+        path,
+        new MeasurementSchema(
+            path.getMeasurement(),
+            TSDataType.DOUBLE,
+            TSEncoding.PLAIN,
+            CompressionType.UNCOMPRESSED));
   }
 }
diff --git 
a/server/src/test/java/org/apache/iotdb/db/wal/recover/WALRecoverManagerTest.java
 
b/server/src/test/java/org/apache/iotdb/db/wal/recover/WALRecoverManagerTest.java
index 8464b92b23..38f35bcd3f 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/wal/recover/WALRecoverManagerTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/wal/recover/WALRecoverManagerTest.java
@@ -29,7 +29,6 @@ import org.apache.iotdb.db.engine.memtable.IMemTable;
 import org.apache.iotdb.db.engine.memtable.PrimitiveMemTable;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNodeId;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowNode;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertTabletNode;
@@ -44,7 +43,6 @@ import 
org.apache.iotdb.db.wal.recover.file.UnsealedTsFileRecoverPerformer;
 import org.apache.iotdb.db.wal.utils.TsFileUtilsForRecoverTest;
 import org.apache.iotdb.db.wal.utils.WALMode;
 import org.apache.iotdb.db.wal.utils.listener.WALRecoverListener;
-import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
 import org.apache.iotdb.tsfile.file.metadata.ChunkMetadata;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -72,7 +70,6 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.channels.FileChannel;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
@@ -120,35 +117,6 @@ public class WALRecoverManagerTest {
     config.setWalMode(WALMode.SYNC);
     walBuffer = new WALBuffer(WAL_NODE_IDENTIFIER, WAL_NODE_FOLDER);
     checkpointManager = new CheckpointManager(WAL_NODE_IDENTIFIER, 
WAL_NODE_FOLDER);
-    LocalSchemaProcessor.getInstance().setStorageGroup(new 
PartialPath(SG_NAME));
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE1_NAME.concat(".s1")),
-            TSDataType.INT32,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE1_NAME.concat(".s2")),
-            TSDataType.INT64,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE2_NAME.concat(".s1")),
-            TSDataType.FLOAT,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE2_NAME.concat(".s2")),
-            TSDataType.DOUBLE,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
   }
 
   @After
diff --git 
a/server/src/test/java/org/apache/iotdb/db/wal/recover/file/TsFilePlanRedoerTest.java
 
b/server/src/test/java/org/apache/iotdb/db/wal/recover/file/TsFilePlanRedoerTest.java
index 515e19690b..91843aecf6 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/wal/recover/file/TsFilePlanRedoerTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/wal/recover/file/TsFilePlanRedoerTest.java
@@ -26,7 +26,6 @@ import org.apache.iotdb.db.engine.memtable.IMemTable;
 import org.apache.iotdb.db.engine.modification.ModificationFile;
 import org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNodeId;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.DeleteDataNode;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowNode;
@@ -94,53 +93,6 @@ public class TsFilePlanRedoerTest {
     prevIsEnablePartialInsert = 
IoTDBDescriptor.getInstance().getConfig().isEnablePartialInsert();
     IoTDBDescriptor.getInstance().getConfig().setEnablePartialInsert(true);
     compressionType = 
TSFileDescriptor.getInstance().getConfig().getCompressor();
-    LocalSchemaProcessor.getInstance().setStorageGroup(new 
PartialPath(SG_NAME));
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE1_NAME.concat(".s1")),
-            TSDataType.INT32,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE1_NAME.concat(".s2")),
-            TSDataType.INT64,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE2_NAME.concat(".s1")),
-            TSDataType.FLOAT,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE2_NAME.concat(".s2")),
-            TSDataType.DOUBLE,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
-    LocalSchemaProcessor.getInstance()
-        .createAlignedTimeSeries(
-            new PartialPath(DEVICE3_NAME),
-            Arrays.asList("s1", "s2", "s3", "s4", "s5"),
-            Arrays.asList(
-                TSDataType.INT32,
-                TSDataType.INT64,
-                TSDataType.BOOLEAN,
-                TSDataType.FLOAT,
-                TSDataType.TEXT),
-            Arrays.asList(
-                TSEncoding.RLE, TSEncoding.RLE, TSEncoding.RLE, 
TSEncoding.RLE, TSEncoding.PLAIN),
-            Arrays.asList(
-                compressionType,
-                compressionType,
-                compressionType,
-                compressionType,
-                compressionType));
   }
 
   @After
@@ -643,11 +595,6 @@ public class TsFilePlanRedoerTest {
 
   @Test
   public void testRedoAlignedInsertAfterDeleteTimeseries() throws Exception {
-    // some timeseries have been deleted
-    LocalSchemaProcessor.getInstance()
-        .deleteTimeseries(new PartialPath(DEVICE3_NAME.concat(".s1")));
-    LocalSchemaProcessor.getInstance()
-        .deleteTimeseries(new PartialPath(DEVICE3_NAME.concat(".s5")));
     // generate .tsfile and update resource in memory
     File file = new File(FILE_NAME);
     generateCompleteFile(file);
diff --git 
a/server/src/test/java/org/apache/iotdb/db/wal/recover/file/UnsealedTsFileRecoverPerformerTest.java
 
b/server/src/test/java/org/apache/iotdb/db/wal/recover/file/UnsealedTsFileRecoverPerformerTest.java
index c2bc0c02ee..d1fe54b54b 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/wal/recover/file/UnsealedTsFileRecoverPerformerTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/wal/recover/file/UnsealedTsFileRecoverPerformerTest.java
@@ -23,7 +23,6 @@ import org.apache.iotdb.db.conf.IoTDBConfig;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.engine.modification.ModificationFile;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNodeId;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.DeleteDataNode;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowNode;
@@ -32,7 +31,6 @@ import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.db.wal.buffer.WALEntry;
 import org.apache.iotdb.db.wal.buffer.WALInfoEntry;
 import org.apache.iotdb.db.wal.utils.TsFileUtilsForRecoverTest;
-import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
 import org.apache.iotdb.tsfile.file.metadata.ChunkMetadata;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -83,35 +81,6 @@ public class UnsealedTsFileRecoverPerformerTest {
     EnvironmentUtils.envSetUp();
     isClusterMode = config.isClusterMode();
     config.setClusterMode(true);
-    LocalSchemaProcessor.getInstance().setStorageGroup(new 
PartialPath(SG_NAME));
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE1_NAME.concat(".s1")),
-            TSDataType.INT32,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE1_NAME.concat(".s2")),
-            TSDataType.INT64,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE2_NAME.concat(".s1")),
-            TSDataType.FLOAT,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
-    LocalSchemaProcessor.getInstance()
-        .createTimeseries(
-            new PartialPath(DEVICE2_NAME.concat(".s2")),
-            TSDataType.DOUBLE,
-            TSEncoding.RLE,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
   }
 
   @After

Reply via email to