@Override
  public void onAlterPartition(AlterPartitionEvent partitionEvent)  throws MetaException {
    if (!TxnUtils.isTransactionalTable(partitionEvent.getTable())) {
      return;
    }
    Partition oldPart = partitionEvent.getOldPartition();
    Partition newPart = partitionEvent.getNewPartition();
    Table t = partitionEvent.getTable();
    String oldPartName = Warehouse.makePartName(t.getPartitionKeys(), oldPart.getValues());
    String newPartName = Warehouse.makePartName(t.getPartitionKeys(), newPart.getValues());
    if (!oldPartName.equals(newPartName)) {
      txnHandler = getTxnHandler();
      txnHandler.onRename(t.getCatName(), t.getDbName(), t.getTableName(), oldPartName,
          t.getCatName(), t.getDbName(), t.getTableName(), newPartName);

      EnvironmentContext context = partitionEvent.getEnvironmentContext();
      Table table = partitionEvent.getTable();

      boolean clonePart = Optional.ofNullable(context)
        .map(EnvironmentContext::getProperties)
        .map(prop -> prop.get(RENAME_PARTITION_MAKE_COPY))
        .map(Boolean::parseBoolean)
        .orElse(false);
      
      if (clonePart) {
        long currentTxn = getTxnId(context);
        
        if (currentTxn > 0) {
          try {
            CompactionRequest rqst = new CompactionRequest(
              table.getDbName(), table.getTableName(), CompactionType.MAJOR);
            rqst.setRunas(TxnUtils.findUserToRunAs(table.getSd().getLocation(), table, conf));
            rqst.setPartitionname(oldPartName);

            rqst.putToProperties("location", oldPart.getSd().getLocation());
            rqst.putToProperties("ifPurge", Boolean.toString(isMustPurge(context, table)));
            txnHandler.submitForCleanup(rqst, partitionEvent.getWriteId(), currentTxn);
          } catch (InterruptedException | IOException e) {
            throwMetaException(e);
          }
        }
      }
    }
  }
It handles cleanup of dropped partition/table/database in ACID related metastore tables
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/AcidEventListener.java