diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2011-03-07 18:06:53 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2011-03-07 18:06:53 +0000 |
commit | 4d806324368f812c4831724f868079f3a2835892 (patch) | |
tree | 53d7b35b8070ce9fd32a2a214d56957683f35d40 | |
parent | 13bbf692083e6ab07f771b797333f695dc18db32 (diff) | |
download | rabbitmq-server-4d806324368f812c4831724f868079f3a2835892.tar.gz |
Variety of small QA-related tweaks.
-rw-r--r-- | src/rabbit.erl | 2 | ||||
-rw-r--r-- | src/rabbit_mnesia.erl | 7 | ||||
-rw-r--r-- | src/rabbit_upgrade.erl | 20 |
3 files changed, 15 insertions, 14 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 21c1452f..e3288eaf 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -204,7 +204,7 @@ start() -> end. stop() -> - rabbit_mnesia:record_running_disc_nodes(), + ok = rabbit_mnesia:record_running_disc_nodes(), ok = rabbit_misc:stop_applications(?APPS). stop_and_halt() -> diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index 33e8764c..30083cc0 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -387,7 +387,8 @@ record_running_disc_nodes() -> sets:from_list(running_clustered_nodes()))) -- [node()], %% Don't check the result: we're shutting down anyway and this is %% a best-effort-basis. - rabbit_misc:write_term_file(FileName, [Nodes]). + rabbit_misc:write_term_file(FileName, [Nodes]), + ok. read_previous_run_disc_nodes() -> FileName = running_nodes_filename(), @@ -433,7 +434,7 @@ init_db(ClusterNodes, Force) -> ok = create_schema(); {[], true} -> %% We're the first node up - case rabbit_upgrade:maybe_upgrade(local) of + case rabbit_upgrade:maybe_upgrade_local() of ok -> ensure_schema_integrity(); version_not_available -> schema_ok_or_move() end; @@ -449,7 +450,7 @@ init_db(ClusterNodes, Force) -> true -> disc; false -> ram end), - case rabbit_upgrade:maybe_upgrade(local) of + case rabbit_upgrade:maybe_upgrade_local() of ok -> ok; %% If we're just starting up a new node we won't have diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl index dd253468..e466eb87 100644 --- a/src/rabbit_upgrade.erl +++ b/src/rabbit_upgrade.erl @@ -16,7 +16,7 @@ -module(rabbit_upgrade). --export([maybe_upgrade_mnesia/0, maybe_upgrade/1]). +-export([maybe_upgrade_mnesia/0, maybe_upgrade_local/0]). -export([read_version/0, write_version/0, desired_version/0, desired_version/1]). @@ -35,7 +35,7 @@ -type(scope() :: 'mnesia' | 'local'). -spec(maybe_upgrade_mnesia/0 :: () -> 'ok'). --spec(maybe_upgrade/1 :: (scope()) -> 'ok' | 'version_not_available'). +-spec(maybe_upgrade_local/0 :: () -> 'ok' | 'version_not_available'). -spec(read_version/0 :: () -> rabbit_types:ok_or_error2(version(), any())). -spec(write_version/0 :: () -> 'ok'). -spec(desired_version/0 :: () -> version()). @@ -128,7 +128,7 @@ upgrade_mode(AllNodes) -> case nodes_running(AllNodes) of [] -> AfterUs = rabbit_mnesia:read_previous_run_disc_nodes(), - case {am_i_disc_node(), AfterUs} of + case {is_disc_node(), AfterUs} of {true, []} -> primary; {true, _} -> @@ -169,7 +169,7 @@ upgrade_mode(AllNodes) -> end end. -am_i_disc_node() -> +is_disc_node() -> %% This is pretty ugly but we can't start Mnesia and ask it (will hang), %% we can't look at the config file (may not include us even if we're a %% disc node). @@ -210,13 +210,13 @@ secondary_upgrade(AllNodes) -> %% Note that we cluster with all nodes, rather than all disc nodes %% (as we can't know all disc nodes at this point). This is safe as %% we're not writing the cluster config, just setting up Mnesia. - ClusterNodes = case am_i_disc_node() of + ClusterNodes = case is_disc_node() of true -> AllNodes; false -> AllNodes -- [node()] end, rabbit_misc:ensure_ok(mnesia:start(), cannot_start_mnesia), - rabbit_mnesia:init_db(ClusterNodes, true), - write_version(mnesia), + ok = rabbit_mnesia:init_db(ClusterNodes, true), + ok = write_version(mnesia), ok. nodes_running(Nodes) -> @@ -230,11 +230,11 @@ node_running(Node) -> %% ------------------------------------------------------------------- -maybe_upgrade(Scope) -> - case upgrades_required(Scope) of +maybe_upgrade_local() -> + case upgrades_required(local) of version_not_available -> version_not_available; [] -> ok; - Upgrades -> apply_upgrades(Scope, Upgrades, + Upgrades -> apply_upgrades(local, Upgrades, fun() -> ok end) end. |