You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2019/05/01 14:16:17 UTC

[couchdb] branch use-individual-rexi-kills created (now ac2041a)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch use-individual-rexi-kills
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at ac2041a  Revert to using the older rexi kill messages

This branch includes the following new commits:

     new ac2041a  Revert to using the older rexi kill messages

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Revert to using the older rexi kill messages

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch use-individual-rexi-kills
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit ac2041abf768e94c38b0c9906959568e66183b1a
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Wed May 1 10:05:44 2019 -0400

    Revert to using the older rexi kill messages
    
    In a future release, once all nodes know how to handle kill_all message will
    re-enable it.
    
    In low traffic clusters this might not be an issue, as the extra workers would
    time out and exit eventually, but in busy clusters this could cause
    couch_server and other message backups as while the upgrade is happening
    workers would not be terminate quickly enough.
---
 src/rexi/src/rexi.erl | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/rexi/src/rexi.erl b/src/rexi/src/rexi.erl
index 21e2b53..712e4c3 100644
--- a/src/rexi/src/rexi.erl
+++ b/src/rexi/src/rexi.erl
@@ -80,13 +80,22 @@ kill(Node, Ref) ->
 %% No rexi_EXIT message will be sent.
 -spec kill_all([{node(), reference()}]) -> ok.
 kill_all(NodeRefs) when is_list(NodeRefs) ->
-    PerNodeMap = lists:foldl(fun({Node, Ref}, Acc) ->
-        maps:update_with(Node, fun(Refs) -> [Ref | Refs] end, [Ref], Acc)
-    end, #{}, NodeRefs),
-    maps:map(fun(Node, Refs) ->
-        rexi_utils:send(rexi_utils:server_pid(Node), cast_msg({kill_all, Refs}))
-    end, PerNodeMap),
-    ok.
+    lists:foreach(fun({Node, Ref}) -> kill(Node, Ref) end, NodeRefs).
+
+%% Upgrade clause. Since kill_all is a new message, nodes in a mixed
+%% cluster won't know how to process it. In that case, opt to send the older
+%% kill message. In a future release, once all the nodes know how to handle
+%% kill_all, switch to using this implemention
+%%
+%% kill_all(NodeRefs) when is_list(NodeRefs) ->
+%%     PerNodeMap = lists:foldl(fun({Node, Ref}, Acc) ->
+%%         maps:update_with(Node, fun(Refs) -> [Ref | Refs] end, [Ref], Acc)
+%%     end, #{}, NodeRefs),
+%%     maps:map(fun(Node, Refs) ->
+%%         rexi_utils:send(rexi_utils:server_pid(Node), cast_msg({kill_all, Refs}))
+%%     end, PerNodeMap),
+%%     ok.
+
 
 %% @equiv async_server_call(Server, self(), Request)
 -spec async_server_call(pid() | {atom(),node()}, any()) -> reference().