From commits-return-37029-archive-asf-public=cust-asf.ponee.io@couchdb.apache.org Wed May 1 14:16:19 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id C81D7180629 for ; Wed, 1 May 2019 16:16:18 +0200 (CEST) Received: (qmail 53506 invoked by uid 500); 1 May 2019 14:16:18 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 53497 invoked by uid 99); 1 May 2019 14:16:18 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 May 2019 14:16:18 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 82A6C8716D; Wed, 1 May 2019 14:16:17 +0000 (UTC) Date: Wed, 01 May 2019 14:16:18 +0000 To: "commits@couchdb.apache.org" Subject: [couchdb] 01/01: Revert to using the older rexi kill messages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: vatamane@apache.org In-Reply-To: <155672017724.7424.3361784832671761463@gitbox.apache.org> References: <155672017724.7424.3361784832671761463@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: couchdb X-Git-Refname: refs/heads/use-individual-rexi-kills X-Git-Reftype: branch X-Git-Rev: ac2041abf768e94c38b0c9906959568e66183b1a X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20190501141617.82A6C8716D@gitbox.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 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().