@Override
  public void onDropTable(DropTableEvent tableEvent) throws MetaException {
    Table table = tableEvent.getTable();
    
    if (TxnUtils.isTransactionalTable(table)) {
      txnHandler = getTxnHandler();
      txnHandler.cleanupRecords(HiveObjectType.TABLE, null, table, null, !tableEvent.getDeleteData());
      
      if (!tableEvent.getDeleteData()) {
        long currentTxn = getTxnId(tableEvent.getEnvironmentContext());
        
        if (currentTxn > 0) {
          try {
            CompactionRequest rqst = new CompactionRequest(table.getDbName(), table.getTableName(), CompactionType.MAJOR);
            rqst.setRunas(TxnUtils.findUserToRunAs(table.getSd().getLocation(), table, conf));
            rqst.putToProperties("location", table.getSd().getLocation());
            rqst.putToProperties("ifPurge", Boolean.toString(isMustPurge(tableEvent.getEnvironmentContext(), table)));
            txnHandler.submitForCleanup(rqst, table.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