/**
  * Log task mapped.
  *
  * @param log Logger.
  * @param clazz Task class.
  * @param nodes Mapped nodes.
  */
 public static void logMapped(
     @Nullable IgniteLogger log, Class<?> clazz, Collection<ClusterNode> nodes) {
   log0(
       log,
       U.currentTimeMillis(),
       String.format("[%s]: MAPPED: %s", clazz.getSimpleName(), U.toShortString(nodes)));
 }
  /**
   * @param mappings Mappings.
   * @param key Key to map.
   * @param locVals Local values.
   * @param topVer Topology version.
   * @param mapped Previously mapped.
   * @return {@code True} if has remote nodes.
   */
  @SuppressWarnings("ConstantConditions")
  private boolean map(
      KeyCacheObject key,
      Map<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>> mappings,
      Map<K, V> locVals,
      AffinityTopologyVersion topVer,
      Map<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>> mapped) {
    int part = cctx.affinity().partition(key);

    List<ClusterNode> affNodes = cctx.affinity().nodes(part, topVer);

    if (affNodes.isEmpty()) {
      onDone(serverNotFoundError(topVer));

      return false;
    }

    boolean fastLocGet =
        (!forcePrimary || affNodes.get(0).isLocal())
            && cctx.allowFastLocalRead(part, affNodes, topVer);

    if (fastLocGet && localGet(key, part, locVals)) return false;

    ClusterNode node = affinityNode(affNodes);

    if (node == null) {
      onDone(serverNotFoundError(topVer));

      return false;
    }

    boolean remote = !node.isLocal();

    LinkedHashMap<KeyCacheObject, Boolean> keys = mapped.get(node);

    if (keys != null && keys.containsKey(key)) {
      if (REMAP_CNT_UPD.incrementAndGet(this) > MAX_REMAP_CNT) {
        onDone(
            new ClusterTopologyCheckedException(
                "Failed to remap key to a new node after "
                    + MAX_REMAP_CNT
                    + " attempts (key got remapped to the same node) [key="
                    + key
                    + ", node="
                    + U.toShortString(node)
                    + ", mappings="
                    + mapped
                    + ']'));

        return false;
      }
    }

    LinkedHashMap<KeyCacheObject, Boolean> old = mappings.get(node);

    if (old == null) mappings.put(node, old = new LinkedHashMap<>(3, 1f));

    old.put(key, false);

    return remote;
  }