anchor.diff:  %   limitations under the License.
   
   %% @author Maik Lange <lakedaimon300@googlemail.com>
  -%% @doc Aministrative helper functions for replica repair
  +%% @doc Administrative helper functions for replica repair evaluation
   %% @version $Id:  $
   -module(rr_admin).
   
   -export([make_ring/2, 
  +         fill_ring/3,
  +         start_sync/0,
            set_recon_method/1]).
   
  +-export([test_upd/0,
  +         test_regen/0,
  +         test_man/0]). %TEST SETS
  +
   -include("scalaris.hrl").
   
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %% TYPES
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   
  --type ring_type() :: symmetric | random.
  +-type ring_type()    :: symmetric | random.
  +-type failure_type() :: update | regen | mixed.
  +-type db_type()      :: wiki | random.
  +-type db_parameter() :: {ftype, failure_type()} |
  +                        {fprob, 0..100} |            %failure probability
  +                        {distribution, db_generator:distribution()}.
  +
  +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  +%% Eval Quick Start
  +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  +
  +-spec test_upd() -> ok.
  +test_upd() ->
  +    make_ring(symmetric, 10),
  +    fill_ring(random, 10000, []),
  +    ok.
  +
  +-spec test_regen() -> ok.
  +test_regen() ->
  +    make_ring(symmetric, 10),
  +    fill_ring(random, 10000, [{ftype, regen}]),
  +    start_sync(),
  +    ok.
  +
  +-spec test_man() -> ok.
  +test_man() ->
  +    make_ring(symmetric, 10),
  +    fill_ring(random, 10000, [{ftype, regen}]),
  +    ok.
   
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %% API Functions
  
positive.code:     end.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% Local Functions
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  get_node_list() ->
      mgmt_server:node_list(),
      receive
          {get_list_response, List} -> List
      end.
  
  get_symmetric_ids(NodeCount) ->
  
negative.code:         symmetric ->
              Ids = get_symmetric_ids(Size),
              admin:add_node([{first}, {{dht_node, id}, hd(Ids)}]),
              [admin:add_node_at_id(Id) || Id <- tl(Ids)]
      end,
      wait_for_stable_ring(),
      ok.
  
  % @doc  DBSize=Number of Data Entities in DB (without replicas)
  -spec fill_ring(db_type(), pos_integer(), [db_parameter()]) -> ok.
  fill_ring(random, DBSize, Params) ->    
      Distr = proplists:get_value(distribution, Params, uniform),            
      I = hd(intervals:split(intervals:all(), 4)),    %4=replication factor
      Keys = db_generator:get_db(I, DBSize, Distr),    
      insert_random_db(Keys, Params),
      ok;
  fill_ring(wiki, DBSize, Params) ->
      %TODO
      ok.
  
  -spec start_sync() -> ok.
  start_sync() ->
      Nodes = get_node_list(),
      io:format("NodeS=~p", [Nodes]),
      %start
      lists:foreach(fun(Node) ->
                            comm:send(Node, {send_to_group_member, rep_upd, {rep_update_trigger}})
                    end, 
                    Nodes),
      %wait for end
      lists:foreach(
        fun(Node) -> 
                util:wait_for(
                  fun() -> 
                          comm:send(Node, {send_to_group_member, rep_upd, {get_state, comm:this(), open_sync}}),
                          receive
                              {get_state_response, Val} -> Val =:= 0
                          end
                  end)
        end, 
        Nodes),
      ok.
  
  -spec set_recon_method(rep_upd_recon:method()) -> ok | {error, term()}.
  set_recon_method(Method) ->
      config:write(rep_update_activate, true),
      config:write(rep_update_interval, 100000000),
      config:write(rep_update_trigger, trigger_periodic),
      config:write(rep_update_recon_method, Method),
      config:write(rep_update_resolve_method, simple),
      config:write(rep_update_recon_fpr, 0.01),
      config:write(rep_update_max_items, case Method of
                                             bloom -> 10000;
                                             _ -> 100000
                                         end),
      config:write(rep_update_negotiate_sync_interval, case Method of
                                                           bloom -> false;
                                                           _ -> true
                                                       end),    
      
      RM = config:read(rep_update_recon_method),
      case RM =:= Method of
          true -> ok;
  