private long getTxnId(EnvironmentContext context) {
    return Optional.ofNullable(context)
      .map(EnvironmentContext::getProperties)
      .map(prop -> prop.get(hive_metastoreConstants.TXN_ID))
      .map(Long::parseLong)
      .orElse(0L);
  }
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