private void removeDataNodeConfigFromHelix(String dcName, String instanceName,
      PropertyStoreToDataNodeConfigAdapter adapter) {
    if (shouldPrompt) {
      // use lock to protect prompt from concurrent operations.
      lock.lock();
      String question =
          String.format("Are you sure you want to remove instance %s from property store and instance config",
              instanceName);
      String line = System.console().readLine("%s (y[es]/n[o]): ", question).toLowerCase();
      boolean shouldDelete = line.equals("yes") || line.equals("y");
      lock.unlock();

      if (!shouldDelete) {
        // terminate the process right away.
        System.exit(1);
      }
    }
    adminForDc.get(dcName).dropInstance(clusterName, new InstanceConfig(instanceName));
    if (dataNodeConfigSourceType == PROPERTY_STORE) {
      if (adapter.remove(instanceName)) {
        logger.error("[{}] Failed to remove config for node {} in the property store.", dcName.toUpperCase(),
            instanceName);
      }
    }
  }
Add and/or update instances in Helix based on the information in the static cluster map.
@param dcName the name of the datacenter being processed.
@param partitionsToInstancesInDc a map to be filled with the mapping of partitions to their instance sets in the
                                 given datacenter.
@param resourcesAreFullAutoCompatible true if the resources are constructed as full auto compatible
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixBootstrapUpgradeUtil.java