private void removeUnusedColumnDescriptor(MColumnDescriptor oldCD) {
    if (oldCD == null) {
      return;
    }
    Query query = null;
    boolean success = false;
    LOG.debug("execute removeUnusedColumnDescriptor");

    try {
      openTransaction();
      if (!hasRemainingCDReference(oldCD)) {
        // First remove any constraints that may be associated with this CD
        query = pm.newQuery(MConstraint.class, "parentColumn == inCD || childColumn == inCD");
        query.declareParameters("MColumnDescriptor inCD");
        List<MConstraint> mConstraintsList = (List<MConstraint>) query.execute(oldCD);
        if (CollectionUtils.isNotEmpty(mConstraintsList)) {
          pm.deletePersistentAll(mConstraintsList);
        }
        // Finally remove CD
        pm.retrieve(oldCD);
        pm.deletePersistent(oldCD);
        LOG.debug("successfully deleted a CD in removeUnusedColumnDescriptor");

      }
      success = commitTransaction();
    } finally {
      rollbackAndCleanup(success, query);
    }
  }
Checks if a column descriptor has any remaining references by storage descriptors
in the db.  If it does not, then delete the CD.  If it does, then do nothing.
@param oldCD the column descriptor to delete if it is no longer referenced anywhere
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java