public void dropTagsOrAttributes(
      Set<String> keySet, PartialPath fullPath, IMeasurementMNode<?> leafMNode)
      throws MetadataException, IOException {
    Pair<Map<String, String>, Map<String, String>> pair = tagLogFile.read(leafMNode.getOffset());

    Map<String, String> deleteTag = new HashMap<>();
    for (String key : keySet) {
      // check tag map
      // check attribute map
      String removeVal = pair.left.remove(key);
      if (removeVal != null) {
        deleteTag.put(key, removeVal);
      } else {
        removeVal = pair.right.remove(key);
        if (removeVal == null) {
          logger.warn("TimeSeries [{}] does not have tag/attribute [{}]", fullPath, key);
        }
      }
    }

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

    if (!deleteTag.isEmpty()) {
      for (Map.Entry<String, String> entry : deleteTag.entrySet()) {
        if (tagIndex.containsKey((entry.getKey()))
            && tagIndex.get(entry.getKey()).containsKey(entry.getValue())) {
          if (logger.isDebugEnabled()) {
            logger.debug(
                String.format(
                    String.format(DEBUG_MSG, "Drop" + TAG_FORMAT, leafMNode.getFullPath()),
                    entry.getKey(),
                    entry.getValue(),
                    leafMNode.getOffset()));
          }

          removeIndex(entry.getKey(), entry.getValue(), leafMNode);

        } else {
          if (logger.isDebugEnabled()) {
            logger.debug(
                String.format(
                    String.format(
                        DEBUG_MSG_1, "Drop" + PREVIOUS_CONDITION, leafMNode.getFullPath()),
                    entry.getKey(),
                    entry.getValue(),
                    leafMNode.getOffset(),
                    tagIndex.containsKey(entry.getKey())));
          }
        }
      }
    }
  }
Drop tags or attributes of the timeseries. It will not throw exception even if the key does not
exist.

@param keySet tags key or attributes key
@throws MetadataException metadata exception
@throws IOException error occurred when reading disk
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/tag/TagManager.java