From aecd02c705a0d006cc8c3b6ecf5d773e62009180 Mon Sep 17 00:00:00 2001 From: Yosuke Hara Date: Sun, 17 Apr 2016 00:03:58 +0900 Subject: [PATCH] Modified for fixing leo-project/leofs/issues/474 --- src/leo_storage_mq.erl | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/leo_storage_mq.erl b/src/leo_storage_mq.erl index 154fce2..7637a9b 100644 --- a/src/leo_storage_mq.erl +++ b/src/leo_storage_mq.erl @@ -452,17 +452,30 @@ recover_node_callback_1(_,_,_,[]) -> recover_node_callback_1(AddrId, Key, Node, RedundantNodes) -> case lists:member(Node, RedundantNodes) of true -> - case lists:member(erlang:node(), RedundantNodes) of - true -> - ?MODULE:publish(?QUEUE_ID_PER_OBJECT, - AddrId, Key, ?ERR_TYPE_RECOVER_DATA); - false -> - ok + case lists:delete(Node, RedundantNodes) of + [] -> + ok; + RedundantNodes_1 -> + recover_node_callback_2(RedundantNodes_1, AddrId, Key) end; false -> ok end. +%% @private +recover_node_callback_2([],_AddrId,_Key) -> + ok; +recover_node_callback_2([Node|Rest], AddrId, Key) -> + case leo_misc:node_existence(Node, ?DEF_REQ_TIMEOUT) of + true when Node == erlang:node() -> + ?MODULE:publish(?QUEUE_ID_PER_OBJECT, + AddrId, Key, ?ERR_TYPE_RECOVER_DATA); + true -> + ok; + false -> + recover_node_callback_2(Rest, AddrId, Key) + end. + %% @doc synchronize by vnode-id. %%