public boolean renameProperties(String mapKey, String newKey) {
    boolean success = false;
    Query<MMetastoreDBProperties> query = null;
    try {
      LOG.debug("Attempting to rename property {} to {} for the metastore db", mapKey, newKey);
      if (openTransaction()) {
        // ensure the target is clear;
        // query is cleaned up in finally block
        query = pm.newQuery(MMetastoreDBProperties.class, PTYARG_EQ_KEY);
        query.declareParameters(PTYPARAM_STR_KEY);
        query.setUnique(true);
        MMetastoreDBProperties properties = (MMetastoreDBProperties) query.execute(newKey);
        if (properties != null) {
          return false;
        }
        // ensure we got a source
        properties = (MMetastoreDBProperties) query.execute(mapKey);
        if (properties == null) {
          return false;
        }
        byte[] content = properties.getPropertyContent();
        String value = properties.getPropertyValue();
        // remove source from persistent storage
        pm.deletePersistent(properties);
        // make it persist with new key
        MMetastoreDBProperties newProperties = new MMetastoreDBProperties();
        // update description
        newProperties.setDescription("Metastore property renamed from " + mapKey + " to " + newKey
            + " " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")));
        // change key
        newProperties.setPropertykey(newKey);
        newProperties.setPropertyValue(value);
        newProperties.setPropertyContent(content);
        pm.makePersistent(newProperties);
        // commit
        success = commitTransaction();
        if (success) {
          LOG.info("Metastore property {} renamed {} successfully", mapKey, newKey);
          return true;
        }
      }
    } finally {
      rollbackAndCleanup(success, query);
    }
    return false;
  }
Called right before an action that would drop a storage descriptor.
This function makes the SD's reference to a CD null, and then deletes the CD
if it no longer is referenced in the table.
@param msd the storage descriptor to drop
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java