@Override
  protected void periodicExecute(Env env) {
    List<String> databases = configManager.getClusterSchemaManager().getDatabaseNames(null);
    Map<String, Long> databaseTTLMap = new TreeMap<>();
    for (String database : databases) {
      long databaseTTL =
          PathUtils.isTableModelDatabase(database)
              ? configManager.getClusterSchemaManager().getDatabaseMaxTTL(database)
              : configManager.getTTLManager().getDatabaseMaxTTL(database);
      databaseTTLMap.put(database, databaseTTL);
    }
    LOGGER.info(
        "[PartitionTableCleaner] Periodically activate PartitionTableAutoCleaner, databaseTTL: {}",
        databaseTTLMap);
    for (String database : databases) {
      long databaseTTL = databaseTTLMap.get(database);
      if (!configManager.getPartitionManager().isDatabaseExist(database)
          || databaseTTL < 0
          || databaseTTL == Long.MAX_VALUE) {
        // Remove the entry if the database or the TTL does not exist
        databaseTTLMap.remove(database);
      }
    }
    if (!databaseTTLMap.isEmpty()) {
      LOGGER.info(
          "[PartitionTableCleaner] Periodically activate PartitionTableAutoCleaner for: {}",
          databaseTTLMap);
      // Only clean the partition table when necessary
      TTimePartitionSlot currentTimePartitionSlot = getCurrentTimePartitionSlot();
      try {
        configManager
            .getConsensusManager()
            .write(new AutoCleanPartitionTablePlan(databaseTTLMap, currentTimePartitionSlot));
      } catch (ConsensusException e) {
        LOGGER.warn(CONSENSUS_WRITE_ERROR, e);
      }
    }
  }
A cleaner that automatically deletes the expired mapping within the partition table.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/PartitionTableAutoCleaner.java