Permalink
Browse files

Fix issue#814 - Cannot remove a 'DOWN' node from the cluster

  • Loading branch information...
1 parent fa99cdc commit ed730f6827f64563db496d3f4146f7b0ad72ab6e @emqplus emqplus committed Dec 12, 2016
Showing with 7 additions and 5 deletions.
  1. +1 −1 rebar.config
  2. +4 −2 src/emqttd_cluster.erl
  3. +2 −2 src/emqttd_mnesia.erl
View
@@ -1,4 +1,4 @@
{deps, [
-{gproc,".*",{git,"https://github.com/uwiger/gproc",""}},{lager,".*",{git,"https://github.com/basho/lager","master"}},{gen_logger,".*",{git,"https://github.com/emqtt/gen_logger",""}},{esockd,".*",{git,"https://github.com/emqtt/esockd","emq20"}},{mochiweb,".*",{git,"https://github.com/emqtt/mochiweb",""}}
+{gproc,".*",{git,"https://github.com/uwiger/gproc",""}},{lager,".*",{git,"https://github.com/basho/lager","master"}},{gen_logger,".*",{git,"https://github.com/emqtt/gen_logger",""}},{esockd,".*",{git,"https://github.com/emqtt/esockd","master"}},{mochiweb,".*",{git,"https://github.com/emqtt/mochiweb",""}}
]}.
{erl_opts, [{parse_transform,lager_transform}]}.
@@ -77,8 +77,10 @@ remove(Node) ->
ok -> rpc:call(Node, ?MODULE, reboot, []);
Error -> Error
end;
- Error ->
- {error, Error}
+ {badrpc, nodedown} ->
+ emqttd_mnesia:remove_from_cluster(Node);
+ {badrpc, Reason} ->
+ {error, Reason}
end.
%% @doc Cluster status
@@ -187,8 +187,8 @@ remove_from_cluster(Node) when Node =/= node() ->
ensure_ok(del_schema_copy(Node)),
ensure_ok(rpc:call(Node, ?MODULE, delete_schema, []));
{true, false} ->
- ensure_ok(del_schema_copy(Node)),
- ensure_ok(rpc:call(Node, ?MODULE, delete_schema, []));
+ ensure_ok(del_schema_copy(Node));
+ %ensure_ok(rpc:call(Node, ?MODULE, delete_schema, []));
{false, _} ->
{error, node_not_in_cluster}
end.

0 comments on commit ed730f6

Please sign in to comment.