|
73 | 73 | -export([node_info/0, remove_node_if_mnesia_running/1]).
|
74 | 74 |
|
75 | 75 | %% Used internally in `rabbit_db_cluster'.
|
76 |
| --export([members/0]). |
| 76 | +-export([members/0, leave_discover_cluster/1]). |
77 | 77 |
|
78 | 78 | %% Used internally in `rabbit_khepri'.
|
79 | 79 | -export([mnesia_and_msg_store_files/0]).
|
@@ -179,7 +179,6 @@ can_join_cluster(DiscoveryNode) ->
|
179 | 179 | {ok, already_member};
|
180 | 180 | false ->
|
181 | 181 | Msg = format_inconsistent_cluster_message(DiscoveryNode, node()),
|
182 |
| - rabbit_log:error(Msg), |
183 | 182 | {error, {inconsistent_cluster, Msg}}
|
184 | 183 | end
|
185 | 184 | end.
|
@@ -923,15 +922,19 @@ remove_node_if_mnesia_running(Node) ->
|
923 | 922 | end
|
924 | 923 | end.
|
925 | 924 |
|
926 |
| -leave_cluster() -> |
927 |
| - case rabbit_nodes:nodes_excl_me(cluster_nodes(all)) of |
928 |
| - [] -> ok; |
929 |
| - AllNodes -> case lists:any(fun leave_cluster/1, AllNodes) of |
930 |
| - true -> ok; |
931 |
| - false -> e(no_running_cluster_nodes) |
932 |
| - end |
933 |
| - end. |
| 925 | +leave_discover_cluster(DiscoveryNode) -> |
| 926 | + {ClusterNodes, _, _} = discover_cluster([DiscoveryNode]), |
| 927 | + leave_cluster(rabbit_nodes:nodes_excl_me(ClusterNodes)). |
934 | 928 |
|
| 929 | +leave_cluster() -> |
| 930 | + leave_cluster(rabbit_nodes:nodes_excl_me(cluster_nodes(all))). |
| 931 | +leave_cluster([]) -> |
| 932 | + ok; |
| 933 | +leave_cluster(Nodes) when is_list(Nodes) -> |
| 934 | + case lists:any(fun leave_cluster/1, Nodes) of |
| 935 | + true -> ok; |
| 936 | + false -> e(no_running_cluster_nodes) |
| 937 | + end; |
935 | 938 | leave_cluster(Node) ->
|
936 | 939 | case rpc:call(Node,
|
937 | 940 | rabbit_mnesia, remove_node_if_mnesia_running, [node()]) of
|
|
0 commit comments