helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java [611:639]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    InstanceConfig instanceConfig = getInstanceConfig(clusterName, instanceName);
    if (instanceConfig == null) {
      logger.warn(
          "Instance {} in cluster {} does not exist. Cannot determine if the swap is complete.",
          instanceName, clusterName);
      return false;
    }

    List<InstanceConfig> swappingInstances =
        InstanceUtil.findInstancesWithMatchingLogicalId(_baseDataAccessor, clusterName,
            instanceConfig);
    if (swappingInstances.size() != 1) {
      logger.warn(
          "Instance {} in cluster {} is not swapping with any other instance. Cannot determine if the swap is complete.",
          instanceName, clusterName);
      return false;
    }

    InstanceConfig swapOutInstanceConfig = !instanceConfig.getInstanceOperation().getOperation()
        .equals(InstanceConstants.InstanceOperation.SWAP_IN)
            ? instanceConfig : swappingInstances.get(0);
    InstanceConfig swapInInstanceConfig = instanceConfig.getInstanceOperation().getOperation()
        .equals(InstanceConstants.InstanceOperation.SWAP_IN) ? instanceConfig
        : swappingInstances.get(0);
    if (swapOutInstanceConfig == null || swapInInstanceConfig == null) {
      logger.warn(
          "Instance {} in cluster {} is not swapping with any other instance. Cannot determine if the swap is complete.",
          instanceName, clusterName);
      return false;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java [650:678]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    InstanceConfig instanceConfig = getInstanceConfig(clusterName, instanceName);
    if (instanceConfig == null) {
      logger.warn(
          "Instance {} in cluster {} does not exist. Cannot determine if the swap is complete.",
          instanceName, clusterName);
      return false;
    }

    List<InstanceConfig> swappingInstances =
        InstanceUtil.findInstancesWithMatchingLogicalId(_baseDataAccessor, clusterName,
            instanceConfig);
    if (swappingInstances.size() != 1) {
      logger.warn(
          "Instance {} in cluster {} is not swapping with any other instance. Cannot determine if the swap is complete.",
          instanceName, clusterName);
      return false;
    }

    InstanceConfig swapOutInstanceConfig = !instanceConfig.getInstanceOperation().getOperation()
        .equals(InstanceConstants.InstanceOperation.SWAP_IN)
            ? instanceConfig : swappingInstances.get(0);
    InstanceConfig swapInInstanceConfig = instanceConfig.getInstanceOperation().getOperation()
        .equals(InstanceConstants.InstanceOperation.SWAP_IN) ? instanceConfig
        : swappingInstances.get(0);
    if (swapOutInstanceConfig == null || swapInInstanceConfig == null) {
      logger.warn(
          "Instance {} in cluster {} is not swapping with any other instance. Cannot determine if the swap is complete.",
          instanceName, clusterName);
      return false;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



