Commits

Anonymous committed bdf95c0 Merge

merge

  • Participants
  • Parent commits 49e87fd, 1fe40c8

Comments (0)

Files changed (3)

src/riak_get_fsm.erl

     AllowMult = proplists:get_value(allow_mult,BucketProps),
     Preflist = riak_ring:filtered_preflist(DocIdx, Ring, N),
     {Targets, Fallbacks} = lists:split(N, Preflist),
-    {Sent1, Pangs1} = riak_util:try_cast(vnode_get, Msg, Targets),
+    {Sent1, Pangs1} = riak_util:try_cast(vnode_get, Msg, nodes(), Targets),
     Sent = case length(Sent1) =:= N of   % Sent is [{Index,TargetNode,SentNode}]
         true -> Sent1;
         false -> Sent1 ++ riak_util:fallback(vnode_get,Msg,Pangs1,Fallbacks)

src/riak_put_fsm.erl

     N = proplists:get_value(n_val,BucketProps),
     Preflist = riak_ring:filtered_preflist(DocIdx, Ring, N),
     {Targets, Fallbacks} = lists:split(N, Preflist),
-    {Sent1, Pangs1} = riak_util:try_cast(vnode_put, Msg, Targets),
+    {Sent1, Pangs1} = riak_util:try_cast(vnode_put, Msg, nodes(), Targets),
     Sent = case length(Sent1) =:= N of   % Sent is [{Index,TargetNode,SentNode}]
         true -> Sent1;
         false -> Sent1 ++ riak_util:fallback(vnode_put,Msg,Pangs1,Fallbacks)

src/riak_util.erl

          is_x_deleted/1,obj_not_deleted/1,integer_to_list/2,
          unique_id_62/0]).
 -export([chash_key/1,chash_std_keyfun/1,chash_bucketonly_keyfun/1]).
--export([try_cast/3, fallback/4, mkclientid/1]).
+-export([try_cast/4, fallback/4, mkclientid/1]).
 
 %% @spec moment() -> integer()
 %% @doc Get the current "moment".  Current implementation is the
 %%      successful casts is the first element of the return tuple, and
 %%      the list of pang-responding nodes is the second element.
 %%      Used in riak_put_fsm and riak_get_fsm.
-try_cast(Cmd, Msg, Targets) -> try_cast(Cmd, Msg, Targets, [], []).
-try_cast(_Cmd, _Msg, [], Sent, Pangs) -> {Sent, Pangs};
-try_cast(Cmd, Msg, [{Index,Node}|Targets], Sent, Pangs) ->
-    case lists:member(Node, [node()|nodes()]) orelse net_adm:ping(Node) == pong of
-        false -> try_cast(Cmd, Msg, Targets, Sent, [{Index,Node}|Pangs]);
+try_cast(Cmd, Msg, UpNodes, Targets) ->
+    try_cast(Cmd, Msg, UpNodes, Targets, [], []).
+try_cast(_Cmd, _Msg, _UpNodes, [], Sent, Pangs) -> {Sent, Pangs};
+try_cast(Cmd, Msg, UpNodes, [{Index,Node}|Targets], Sent, Pangs) ->
+    case lists:member(Node, [node()|UpNodes])
+          orelse net_adm:ping(Node) == pong of
+        false ->
+            try_cast(Cmd, Msg, UpNodes, Targets, Sent, [{Index,Node}|Pangs]);
         true ->
             gen_server:cast({riak_vnode_master, Node},
                             {Cmd, {Index,Node}, Msg}),
-            try_cast(Cmd, Msg, Targets, [{Index,Node,Node}|Sent], Pangs)
+            try_cast(Cmd, Msg, UpNodes, Targets, [{Index,Node,Node}|Sent],Pangs)
     end.
 
 %% @spec fallback(term(), term(), [{Index :: term(), Node :: node()}],
 %%      from the second element of the response tuple of a call to
 %%      try_cast/3.
 %%      Used in riak_put_fsm and riak_get_fsm
-fallback(Cmd, Msg, Pangs, Fallbacks) -> fallback(Cmd, Msg, Pangs, Fallbacks, []).
+fallback(Cmd, Msg, Pangs, Fallbacks) ->
+    fallback(Cmd, Msg, Pangs, Fallbacks, []).
 fallback(_Cmd, _Msg, [], _Fallbacks, Sent) -> Sent;
 fallback(_Cmd, _Msg, _Pangs, [], Sent) -> Sent;
 fallback(Cmd, Msg, [{Index,Node}|Pangs], [{_,FN}|Fallbacks], Sent) ->