@Override
  public boolean isCompatibleWith(HiveConf conf) {
    // Make a copy of currentMetaVars, there is a race condition that
    // currentMetaVars might be changed during the execution of the method
    Map<String, String> currentMetaVarsCopy = currentMetaVars;
    if (currentMetaVarsCopy == null) {
      return false; // recreate
    }
    boolean compatible = true;
    for (ConfVars oneVar : HiveConf.metaVars) {
      // Since metaVars are all of different types, use string for comparison
      String oldVar = currentMetaVarsCopy.get(oneVar.varname);
      String newVar = conf.get(oneVar.varname, "");
      if (oldVar == null
          || (oneVar.isCaseSensitive()
              ? !oldVar.equals(newVar)
              : !oldVar.equalsIgnoreCase(newVar))) {
        LOG.info(
            "Mestastore configuration "
                + oneVar.varname
                + " changed from "
                + oldVar
                + " to "
                + newVar);
        compatible = false;
      }
    }
    return compatible;
  }
Swaps the first element of the metastoreUris array with a random element from the remainder of
the array.
amoro-format-mixed/amoro-mixed-trino/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java