public void addTags(
      Map<String, String> tagsMap, PartialPath fullPath, IMeasurementMNode<?> leafMNode)
      throws MetadataException, IOException {

    Pair<Map<String, String>, Map<String, String>> pair = tagLogFile.read(leafMNode.getOffset());

    for (Map.Entry<String, String> entry : tagsMap.entrySet()) {
      String key = entry.getKey();
      String value = entry.getValue();
      if (pair.left.containsKey(key)) {
        throw new MetadataException(
            String.format("TimeSeries [%s] already has the tag [%s].", fullPath, key));
      }
      pair.left.put(key, value);
    }

    // persist the change to disk
    tagLogFile.write(pair.left, pair.right, leafMNode.getOffset());

    // update tag inverted map
    addIndex(tagsMap, leafMNode);
  }
Add new tags key-value for the timeseries.

@param tagsMap newly added tags map
@param fullPath timeseries
@throws MetadataException tagLogFile write error or tag already exists
@throws IOException error occurred when reading disk
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/tag/TagManager.java