public List<IMeasurementMNode<ICachedMNode>> createAlignedTimeSeries(
      final PartialPath devicePath,
      final List<String> measurements,
      final List<TSDataType> dataTypes,
      final List<TSEncoding> encodings,
      final List<CompressionType> compressors,
      final List<String> aliasList,
      final boolean withMerge,
      final Set<Integer> existingMeasurementIndexes)
      throws MetadataException {
    final List<IMeasurementMNode<ICachedMNode>> measurementMNodeList = new ArrayList<>();
    MetaFormatUtils.checkSchemaMeasurementNames(measurements);
    final ICachedMNode deviceParent = checkAndAutoCreateInternalPath(devicePath);

    try {
      // synchronize check and add, we need addChild operation be atomic.
      // only write operations on mTree will be synchronized
      synchronized (this) {
        ICachedMNode device = checkAndAutoCreateDeviceNode(devicePath.getTailNode(), deviceParent);

        try {
          for (int i = 0; i < measurements.size(); i++) {
            if (store.hasChild(device, measurements.get(i))) {
              final ICachedMNode node = device.getChild(measurements.get(i));
              if (node.isMeasurement()) {
                final IMeasurementMNode<ICachedMNode> measurementNode =
                    node.getAsMeasurementMNode();
                if (node.getAsMeasurementMNode().isPreDeleted()) {
                  throw new MeasurementInBlackListException(
                      devicePath.concatAsMeasurementPath(measurements.get(i)));
                } else if (!withMerge || measurementNode.getDataType() != dataTypes.get(i)) {
                  throw new MeasurementAlreadyExistException(
                      devicePath.getFullPath() + "." + measurements.get(i),
                      node.getAsMeasurementMNode().getMeasurementPath());
                } else {
                  existingMeasurementIndexes.add(i);
                  continue;
                }
              } else {
                throw new PathAlreadyExistException(
                    devicePath.getFullPath() + "." + measurements.get(i));
              }
            }

            if (aliasList != null
                && aliasList.get(i) != null
                && store.hasChild(device, aliasList.get(i))) {
              throw new AliasAlreadyExistException(
                  devicePath.getFullPath() + "." + measurements.get(i), aliasList.get(i));
            }
          }

          if (device.isDevice()
              && device.getAsDeviceMNode().isAlignedNullable() != null
              && !device.getAsDeviceMNode().isAligned()) {
            throw new AlignedTimeseriesException(
                "TimeSeries under this device is not aligned, please use createTimeSeries or change device.",
                devicePath.getFullPath());
          }

          final IDeviceMNode<ICachedMNode> entityMNode;
          if (device.isDevice()) {
            entityMNode = device.getAsDeviceMNode();
          } else {
            entityMNode = store.setToEntity(device);
            entityMNode.setAligned(true);
            device = entityMNode.getAsMNode();
          }

          // create an aligned time series
          if (entityMNode.isAlignedNullable() == null) {
            entityMNode.setAligned(true);
          }

          for (int i = 0; i < measurements.size(); i++) {
            if (existingMeasurementIndexes.contains(i)) {
              continue;
            }

            final IMeasurementMNode<ICachedMNode> measurementMNode =
                nodeFactory.createMeasurementMNode(
                    entityMNode,
                    measurements.get(i),
                    new MeasurementSchema(
                        measurements.get(i),
                        dataTypes.get(i),
                        encodings.get(i),
                        compressors.get(i)),
                    aliasList == null ? null : aliasList.get(i));
            store.addChild(
                entityMNode.getAsMNode(), measurements.get(i), measurementMNode.getAsMNode());
            if (aliasList != null && aliasList.get(i) != null) {
              entityMNode.addAlias(aliasList.get(i), measurementMNode);
            }
            measurementMNodeList.add(measurementMNode);
          }
          return measurementMNodeList;
        } finally {
          unPinMNode(device);
        }
      }
    } finally {
      if (deviceParent != null) {
        unPinMNode(deviceParent);
      }
    }
  }
Create aligned timeseries with full paths from root to one leaf node. Before creating
timeseries, the * database should be set first, throw exception otherwise

@param devicePath device path
@param measurements measurements list
@param dataTypes data types list
@param encodings encodings list
@param compressors compressor
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java