From 4c3f9bdf2d7446a91255070f1020a2f4e1eb5b9c Mon Sep 17 00:00:00 2001 From: Francesco Mazzoli Date: Wed, 19 Sep 2012 13:01:36 +0100 Subject: fix `rabbit_mnesia:is_virgin_node/0', was checking only for one status file --- Makefile | 2 +- src/rabbit_mnesia.erl | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index f3729cfa..c63e3dfd 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,7 @@ $(SOURCE_DIR)/rabbit_framing_amqp_0_8.erl: codegen.py $(AMQP_CODEGEN_DIR)/amqp_c dialyze: $(BEAM_TARGETS) $(BASIC_PLT) dialyzer --plt $(BASIC_PLT) --no_native --fullpath \ - -Wrace_conditions $(BEAM_TARGETS) + $(BEAM_TARGETS) # rabbit.plt is used by rabbitmq-erlang-client's dialyze make target create-plt: $(RABBIT_PLT) diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index f19046a0..611f7dda 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -1106,16 +1106,17 @@ check_rabbit_consistency(Remote) -> %% mnesia tables aren't there because restarted RAM nodes won't have %% tables while still being non-virgin. What we do instead is to %% check if the mnesia directory is non existant or empty, with the -%% exception of the cluster status file, which will be there thanks to +%% exception of the cluster status files, which will be there thanks to %% `rabbit_node_monitor:prepare_cluster_status_file/0'. is_virgin_node() -> case rabbit_file:list_dir(dir()) of {error, enoent} -> true; - {ok, []} -> true; - {ok, [File]} -> (dir() ++ "/" ++ File) =:= - [rabbit_node_monitor:cluster_status_filename(), - rabbit_node_monitor:running_nodes_filename()]; - {ok, _} -> false + {ok, []} -> true; + {ok, [File1, File2]} -> + lists:usort([dir() ++ "/" ++ File1, dir() ++ "/" ++ File2]) =:= + lists:usort([rabbit_node_monitor:cluster_status_filename(), + rabbit_node_monitor:running_nodes_filename()]); + {ok, _} -> false end. find_good_node([]) -> -- cgit v1.2.1