Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix issues with previous merge

  • Loading branch information...
commit a222cf4161c1ec81f88c8f8e4d8f39270642462b 1 parent 8480b43
@jtuple jtuple authored
Showing with 29 additions and 5 deletions.
  1. +4 −3 src/riak_core_claimant.erl
  2. +25 −2 src/riak_core_ring.erl
View
7 src/riak_core_claimant.erl
@@ -669,7 +669,9 @@ maybe_remove_exiting(Node, CState) ->
Changed = (Exiting /= []),
CState2 =
lists:foldl(fun(ENode, CState0) ->
- riak_core_ring:set_member(Node, CState0, ENode,
+ ClearedCS =
+ riak_core_ring:clear_member_meta(Node, CState0, ENode),
+ riak_core_ring:set_member(Node, ClearedCS, ENode,
invalid, same_vclock)
end, CState, Exiting),
{Changed, CState2};
@@ -824,7 +826,6 @@ rebalance_ring(CNode, CState) ->
rebalance_ring(CNode, Next, CState).
rebalance_ring(_CNode, [], CState) ->
-
CState2 = riak_core_claim:claim(CState),
Owners1 = riak_core_ring:all_owners(CState),
Owners2 = riak_core_ring:all_owners(CState2),
@@ -871,7 +872,7 @@ remove_node(CState, Node, Status, Replacing, Seed, Log) ->
remove_node(CState, Node, Status, Replacing, Seed, Log, Indices).
%% @private
-remove_node(CState, _Node, _Status, _Log, _Replacing, _Seed, []) ->
+remove_node(CState, _Node, _Status, _Replacing, _Seed, _Log, []) ->
CState;
remove_node(CState, Node, Status, Replacing, Seed, Log, Indices) ->
CStateT1 = riak_core_ring:change_owners(CState,
View
27 src/riak_core_ring.erl
@@ -66,6 +66,7 @@
pretty_print/2,
all_member_status/1,
update_member_meta/5,
+ clear_member_meta/3,
get_member_meta/3,
add_member/3,
remove_member/3,
@@ -90,6 +91,7 @@
future_indices/2,
future_ring/1,
disowning_indices/2,
+ cancel_transfers/1,
pending_changes/1,
next_owner/1,
next_owner/2,
@@ -581,11 +583,28 @@ update_member_meta(Node, State, Member, Key, Val, same_vclock) ->
State
end.
+clear_member_meta(Node, State, Member) ->
+ Members = State?CHSTATE.members,
+ case orddict:is_key(Member, Members) of
+ true ->
+ Members2 = orddict:update(Member,
+ fun({Status, VC, _MD}) ->
+ {Status,
+ vclock:increment(Node, VC),
+ orddict:new()}
+ end,
+ Members),
+ State?CHSTATE{members=Members2};
+ false ->
+ State
+ end.
+
add_member(PNode, State, Node) ->
set_member(PNode, State, Node, joining).
remove_member(PNode, State, Node) ->
- set_member(PNode, State, Node, invalid).
+ State2 = clear_member_meta(PNode, State, Node),
+ set_member(PNode, State2, Node, invalid).
leave_member(PNode, State, Node) ->
set_member(PNode, State, Node, leaving).
@@ -823,7 +842,11 @@ pretty_print(Ring, Opts) ->
end, 1, Indices),
io:format(Out, "~n", [])
end.
-
+
+%% @doc Return a ring with all transfers cancelled - for claim sim
+cancel_transfers(Ring) ->
+ Ring?CHSTATE{next=[]}.
+
%% ===================================================================
%% Legacy reconciliation
%% ===================================================================
Please sign in to comment.
Something went wrong with that request. Please try again.