summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2019-07-16 15:35:12 +0200
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2019-12-05 10:47:37 +0100
commit8600e543e384470f972d81238a94449433ea0645 (patch)
tree9c77fba62ae0bcab8ac8e97f5186dabf21414ba1 /src
parent6e0b7d1ae0a0801290fc992445baf7263af4663e (diff)
downloadrabbitmq-server-git-8600e543e384470f972d81238a94449433ea0645.tar.gz
rabbit_mnesia: Be more flexible in is_virgin_node()
Before, if the directory was not empty, the function required that all three ignored files were present in that directory. If only two were, then the test would fail and the node would not be considered as pristine. Now, we take the list of files in that directory and remove the files to ignored. If the result is empty, the node is new.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mnesia.erl18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 4c3d8f566f..ce75898f7b 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -990,15 +990,15 @@ is_virgin_node() ->
true;
{ok, []} ->
true;
- {ok, [File1, File2, File3]} ->
- lists:usort([filename:join(dir(), File1),
- filename:join(dir(), File2),
- filename:join(dir(), File3)]) =:=
- lists:usort([rabbit_node_monitor:cluster_status_filename(),
- rabbit_node_monitor:running_nodes_filename(),
- rabbit_node_monitor:quorum_filename()]);
- {ok, _} ->
- false
+ {ok, List0} ->
+ IgnoredFiles0 =
+ [rabbit_node_monitor:cluster_status_filename(),
+ rabbit_node_monitor:running_nodes_filename(),
+ rabbit_node_monitor:quorum_filename(),
+ rabbit_feature_flags:enabled_feature_flags_list_file()],
+ IgnoredFiles = [filename:basename(File) || File <- IgnoredFiles0],
+ List = List0 -- IgnoredFiles,
+ List =:= []
end.
find_reachable_peer_to_cluster_with([]) ->