summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Anderson <brad@cloudant.com>2010-04-28 15:26:22 -0400
committerBrad Anderson <brad@cloudant.com>2010-05-09 22:56:24 -0400
commit7233933976709eca1eddf5471790ec786cb33bc2 (patch)
treecd7767f6cb62b57b0b6c9500ef113907645db71f /src
parent454b9aff017c4bbda9fa01cf9875c44f04644210 (diff)
fix bug in get_remote_states
Diffstat (limited to 'src')
-rw-r--r--src/mem3.erl22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/mem3.erl b/src/mem3.erl
index 25945761..b3416219 100644
--- a/src/mem3.erl
+++ b/src/mem3.erl
@@ -314,15 +314,8 @@ handle_join(first, ExtNodes, nil, State) ->
handle_join(new, ExtNodes, PingNode, #mem{args=Args} = State) ->
NewState = case get_test(Args) of
- undefined ->
- % ping the PingNode and get its state
- pong = net_adm:ping(PingNode),
- timer:sleep(1000), % let dist. erl get set up... sigh.
- {ok, RemoteState} = rpc:call(PingNode, mem3, state, []),
- RemoteState;
- _ ->
- % testing, so meh
- State
+ undefined -> get_pingnode_state(PingNode);
+ _ -> State % testing, so meh
end,
% now use this info to join the ring
int_join(ExtNodes, NewState);
@@ -349,6 +342,14 @@ int_join(ExtNodes, #mem{nodes=Nodes, clock=Clock} = State) ->
NewState.
+get_pingnode_state(PingNode) ->
+ % ping the PingNode and get its state
+ pong = net_adm:ping(PingNode),
+ timer:sleep(1000), % let dist. erl get set up... sigh.
+ {ok, RemoteState} = rpc:call(PingNode, mem3, state, []),
+ RemoteState.
+
+
%% @doc handle the gossip messages
%% We're not using vector_clock:resolve b/c we need custom merge strategy
handle_gossip(From, RemoteState=#mem{clock=RemoteClock},
@@ -529,7 +530,8 @@ get_remote_states(NodeList) ->
NodeList1 = lists:delete(node(), NodeList),
{States1, BadNodes} = rpc:multicall(NodeList1, mem3, state, [], 5000),
{_Status, States2} = lists:unzip(States1),
- {lists:zip(NodeList1,States2), BadNodes}.
+ NodeList2 = NodeList1 -- BadNodes,
+ {lists:zip(NodeList2,States2), BadNodes}.
%% @doc compare state with states based on vector clock