public void upsertDataPartition(DataPartition targetDataPartition) {
    requireNonNull(this.dataPartitionMap, "dataPartitionMap is null");

    for (Map.Entry<
            String, Map<TSeriesPartitionSlot, Map<TTimePartitionSlot, List<TRegionReplicaSet>>>>
        targetDbEntry : targetDataPartition.getDataPartitionMap().entrySet()) {
      String database = targetDbEntry.getKey();
      if (dataPartitionMap.containsKey(database)) {
        Map<TSeriesPartitionSlot, Map<TTimePartitionSlot, List<TRegionReplicaSet>>>
            sourceSeriesPartitionMap = dataPartitionMap.get(database);

        for (Map.Entry<TSeriesPartitionSlot, Map<TTimePartitionSlot, List<TRegionReplicaSet>>>
            targetSeriesSlotEntry : targetDbEntry.getValue().entrySet()) {

          TSeriesPartitionSlot targetSeriesSlot = targetSeriesSlotEntry.getKey();
          if (sourceSeriesPartitionMap.containsKey(targetSeriesSlot)) {
            Map<TTimePartitionSlot, List<TRegionReplicaSet>> sourceTimePartitionMap =
                sourceSeriesPartitionMap.get(targetSeriesSlot);
            Map<TTimePartitionSlot, List<TRegionReplicaSet>> targetTimePartionMap =
                targetSeriesSlotEntry.getValue();
            for (Map.Entry<TTimePartitionSlot, List<TRegionReplicaSet>> targetEntry :
                targetTimePartionMap.entrySet()) {
              if (!sourceTimePartitionMap.containsKey(targetEntry.getKey())) {
                sourceTimePartitionMap.put(targetEntry.getKey(), targetEntry.getValue());
              }
            }
          } else {
            sourceSeriesPartitionMap.put(targetSeriesSlot, targetSeriesSlotEntry.getValue());
          }
        }

      } else {
        dataPartitionMap.put(database, targetDbEntry.getValue());
      }
    }
  }
For table model usage.

<p>The database shall start with "root.". Concat this to a user-provided db name if necessary.

<p>The device id shall be [table, seg1, ....]
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java