anchor.diff:              CurrentNotCommon = sets:subtract(KeepNodesSet, CandidateNodesSet),
               case sets:size(CurrentNotCommon) of
                   0 ->
  -                    [CandidateMap];
  +                    case lists:sort(CandidateTags) == lists:sort(CurrentTags) of
  +                        true ->
  +                            [CandidateMap];
  +                        false ->
  +                            []
  +                    end;
                   1 ->
                       [NewNode] = sets:to_list(CurrentNotCommon),
                       [OldNode] = sets:to_list(sets:subtract(CandidateNodesSet, KeepNodesSet)),
  -                    NewMap = misc:rewrite_value(OldNode, NewNode, CandidateMap),
  -                    [NewMap];
  +
  +                    rewrite_map(CandidateMap, CandidateTags, CurrentTags,
  +                                [{OldNode, NewNode}]);
                   2 ->
                       [NewNodeA, NewNodeB] = sets:to_list(CurrentNotCommon),
                       [OldNodeA, OldNodeB] = sets:to_list(sets:subtract(CandidateNodesSet, KeepNodesSet)),
  -                    NewMapA = misc:rewrite_value(OldNodeB, NewNodeB,
  -                                                 misc:rewrite_value(OldNodeA, NewNodeA, CandidateMap)),
  -                    NewMapB = misc:rewrite_value(OldNodeA, NewNodeB,
  -                                                 misc:rewrite_value(OldNodeB, NewNodeA, CandidateMap)),
  -                    [NewMapA, NewMapB];
  +
  +                    rewrite_map(CandidateMap, CandidateTags, CurrentTags,
  +                                [{OldNodeA, NewNodeA}, {OldNodeB, NewNodeB}]) ++
  +                        rewrite_map(CandidateMap, CandidateTags, CurrentTags,
  +                                    [{OldNodeA, NewNodeB}, {OldNodeB, NewNodeA}]);
                   _ ->
                       %% just try some random mapping just in case. It
                       %% will work nicely if NewNode-s are all being
  
positive.code:             generate_map_star(Map, Nodes, Options)
      end.
  
  is_compatible_past_star_map(OptionsPast, OptionsNow, NumReplicas) ->
      case OptionsNow =:= OptionsPast of
          true ->
              true;
  
negative.code:                     %% removed). Because in such case exact mapping
                      %% doesn't really matter, because we'll backfill
                      %% new nodes and it doesn't matter which.
                      CandidateNotCommon = sets:to_list(sets:subtract(CandidateNodesSet, KeepNodesSet)),
  
                      rewrite_map(CandidateMap, CandidateTags, CurrentTags,
                                  lists:zip(CandidateNotCommon, sets:to_list(CurrentNotCommon)))
              end
      end.
  
  