summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@apache.org>2019-05-01 10:05:44 -0400
committerNick Vatamaniuc <vatamane@apache.org>2019-05-01 10:05:44 -0400
commitac2041abf768e94c38b0c9906959568e66183b1a (patch)
tree9869751a539fccc0f4dd9ae5d3593613ade836b7
parent85617a77b1b5444568d4ed9549a39cf406729c88 (diff)
downloadcouchdb-ac2041abf768e94c38b0c9906959568e66183b1a.tar.gz
Revert to using the older rexi kill messagesuse-individual-rexi-kills
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.
-rw-r--r--src/rexi/src/rexi.erl23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/rexi/src/rexi.erl b/src/rexi/src/rexi.erl
index 21e2b5388..712e4c3c3 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().