anchor.diff:      end.
   
   %% @private
  -rebalance_1(false,_PairOfTakeover,_Nodes) ->
  +rebalance_1(false,_Nodes) ->
       {error, not_running};
  -rebalance_1(_State, [], []) ->
  +rebalance_1(_State, []) ->
       {error, not_need_to_rebalance};
  -
  -%% for takeover-operation
  -rebalance_1(true, [_,_] = PairOfTakeover,_Nodes) ->
  -    Ret1 = lists:keyfind(?STATE_DETACHED, 1, PairOfTakeover),
  -    Ret2 = lists:keyfind(?STATE_ATTACHED, 1, PairOfTakeover),
  -
  -    case (Ret1 /= false andalso Ret2 /= false) of
  -        true ->
  -            case assign_nodes_to_ring([Ret1, Ret2]) of
  -                ok ->
  -                    {_, DetachedNode} = Ret1,
  -                    {_, AttachedNode} = Ret2,
  -                    rebalance_1_1(DetachedNode, AttachedNode);
  -                Error ->
  -                    Error
  -            end;
  -        false ->
  -            {error, ?ERROR_NOT_SATISFY_CONDITION}
  -    end;
  -
  -%% for regular-case
  -rebalance_1(true,_PairOfTakeover, Nodes) ->
  +rebalance_1(true, Nodes) ->
       case assign_nodes_to_ring(Nodes) of
           ok ->
               case is_allow_to_distribute_command() of
  
positive.code:                   {error, Cause}
            end,
  
      %% check that fail sending message
      case Ret of
          ok -> void;
          {error, _} ->
              %% @TODO >> enqueue
              ok
      end,
      rebalance_3(?STATE_ATTACHED, Rest, RebalanceProcInfo);
  
  rebalance_3(?STATE_DETACHED, [Node|Rest], RebalanceProcInfo) ->
      case leo_manager_mnesia:get_storage_node_by_name(Node) of
          {ok, [NodeInfo|_]} ->
              _ = leo_manager_mnesia:delete_storage_node(NodeInfo),
              rebalance_3(?STATE_DETACHED, Rest, RebalanceProcInfo);
          Error ->
              Error
      end.
  
negative.code: rebalance() ->
      case leo_redundant_manager_api:get_members() of
          {ok, Members_1} ->
              {State, Nodes} =
                  lists:foldl(
                    fun(#member{state = ?STATE_RUNNING },{false, AccN}) ->
                            {true, AccN};
                       (#member{node  = Node,
                                state = ?STATE_ATTACHED},{SoFar, [{?STATE_DETACHED,_}] = AccN}) ->
                            NS = {?STATE_ATTACHED, Node},
                            {SoFar, [NS|AccN]};
                       (#member{node  = Node,
                                state = ?STATE_ATTACHED},{SoFar, AccN}) ->
                            NS = {?STATE_ATTACHED, Node},
                            {SoFar, [NS|AccN]};
                       (#member{node  = Node,
                                state = ?STATE_DETACHED},{SoFar, [{?STATE_ATTACHED,_}] = AccN}) ->
                            NS = {?STATE_DETACHED, Node},
                            {SoFar, [NS|AccN]};
                       (#member{node  = Node,
                                state = ?STATE_DETACHED},{SoFar, AccN}) ->
                            NS = {?STATE_DETACHED, Node},
                            {SoFar, [NS|AccN]};
                       (_Member, SoFar) ->
                            SoFar
                    end, {false, []}, Members_1),
  
              case rebalance_1(State, Nodes) of
                  {ok, RetRebalance} ->
                      case leo_redundant_manager_api:get_members() of
                          {ok, Members_2} ->
                              {ok, SystemConf} = leo_manager_mnesia:get_system_config(),
                              case rebalance_3(Nodes, #rebalance_proc_info{members_cur = Members_2,
                                                                           system_conf = SystemConf}) of
                                  ok ->
                                      _ = distribute_members([N || {_, N} <- Nodes]),
                                      rebalance_5(RetRebalance, []);
                                  {error, Cause}->
                                      ?error("rebalance/0", "cause:~p", [Cause]),
  