@Override
  public void alter_table(String catName, String dbName, String tbl_name, Table new_tbl,
      EnvironmentContext envContext, String validWriteIds) throws TException {
    HiveMetaHook hook = getHook(new_tbl);
    if (hook != null) {
      hook.preAlterTable(new_tbl, envContext);
    }
    boolean success = false;
    try {
      boolean skipAlter = envContext != null && envContext.getProperties() != null &&
              Boolean.valueOf(envContext.getProperties().getOrDefault(HiveMetaHook.SKIP_METASTORE_ALTER, "false"));
      if (!skipAlter) {
        AlterTableRequest req = new AlterTableRequest(dbName, tbl_name, new_tbl);
        req.setCatName(catName);
        req.setValidWriteIdList(validWriteIds);
        req.setEnvironmentContext(envContext);
        if (processorCapabilities != null) {
          req.setProcessorCapabilities(new ArrayList<String>(Arrays.asList(processorCapabilities)));
          req.setProcessorIdentifier(processorIdentifier);
        }

        client.alter_table_req(req);
      }

      if (hook != null) {
        hook.commitAlterTable(new_tbl, envContext);
      }
      success = true;
    } finally {
      if (!success && (hook != null)) {
        hook.rollbackAlterTable(new_tbl, envContext);
      }
    }
  }
Swaps the first element of the metastoreUris array with a random element from the
remainder of the array.
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java