summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-07-03 14:26:12 +0100
committerSimon MacMullen <simon@rabbitmq.com>2013-07-03 14:26:12 +0100
commit610ef3c25452403214c8aa0b36d02ec85374a12f (patch)
tree01bf0d49e37cc8b08c3390dfa6d92a8ff7dd4070
parent60ea4c8197f68a69e5b471ad528b6572e5d9b9d3 (diff)
downloadrabbitmq-server-610ef3c25452403214c8aa0b36d02ec85374a12f.tar.gz
Ensure that after we have done forget_cluster_node --offline we will boot the next time.bug25659
-rw-r--r--src/rabbit_mnesia.erl18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index c05f931c..d8db9229 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -302,7 +302,8 @@ remove_node_offline_node(Node) ->
%% they are loaded.
rabbit_table:force_load(),
rabbit_table:wait_for_replicated(),
- forget_cluster_node(Node, false)
+ forget_cluster_node(Node, false),
+ force_load_next_boot()
after
stop_mnesia()
end;
@@ -429,11 +430,13 @@ init_db(ClusterNodes, NodeType, CheckOtherNodes) ->
ok = create_schema();
{[], true, disc} ->
%% First disc node up
+ maybe_force_load(),
ok;
{[AnotherNode | _], _, _} ->
%% Subsequent node in cluster, catch up
ensure_version_ok(
rpc:call(AnotherNode, rabbit_version, recorded, [])),
+ maybe_force_load(),
ok = rabbit_table:wait_for_replicated(),
ok = rabbit_table:create_local_copy(NodeType)
end,
@@ -513,6 +516,19 @@ copy_db(Destination) ->
ok = ensure_mnesia_not_running(),
rabbit_file:recursive_copy(dir(), Destination).
+force_load_filename() ->
+ filename:join(rabbit_mnesia:dir(), "force_load").
+
+force_load_next_boot() ->
+ rabbit_file:write_file(force_load_filename(), <<"">>).
+
+maybe_force_load() ->
+ case rabbit_file:is_file(force_load_filename()) of
+ true -> rabbit_table:force_load(),
+ rabbit_file:delete(force_load_filename());
+ false -> ok
+ end.
+
%% This does not guarantee us much, but it avoids some situations that
%% will definitely end up badly
check_cluster_consistency() ->