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 17:30:48 UTC
[couchdb] branch master updated: Use individual rexi kill messages
by default
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/master by this push:
new 762d7a8 Use individual rexi kill messages by default
762d7a8 is described below
commit 762d7a81416d07ab2f9a7f7091376376075578c0
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Wed May 1 10:05:44 2019 -0400
Use individual rexi kill messages by default
When performing a rolling upgrade older nodes won't be able to handle newer
kill_all messages. In busy clusters this could cause couch_server and other
message queue backups while the upgrade is in progress.
Make message sending behavior is configurable. After all the nodes have been
upgraded, can toggle `[rexi] use_kill_all = true` to save on some inter-node
network traffic. In a future release the configuration check might be removed,
default to sending kill_all messages only.
---
src/rexi/src/rexi.erl | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/rexi/src/rexi.erl b/src/rexi/src/rexi.erl
index 21e2b53..ead5bee 100644
--- a/src/rexi/src/rexi.erl
+++ b/src/rexi/src/rexi.erl
@@ -80,12 +80,24 @@ 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),
+ %% Upgrade clause. Since kill_all is a new message, nodes in a mixed
+ %% cluster won't know how to process it. In that case, the default is to send
+ %% the individual kill messages. Once all the nodes have been upgraded, can
+ %% configure the cluster to send kill_all messages.
+ case config:get_boolean("rexi", "use_kill_all", false) of
+ true ->
+ 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) ->
+ ServerPid = rexi_utils:server_pid(Node),
+ rexi_utils:send(ServerPid, cast_msg({kill_all, Refs}))
+ end, PerNodeMap);
+ false ->
+ lists:foreach(fun({Node, Ref}) -> kill(Node, Ref) end, NodeRefs)
+ end,
ok.
%% @equiv async_server_call(Server, self(), Request)