diff options
author | Tony Garnock-Jones <tonyg@lshift.net> | 2009-05-18 17:33:48 +0100 |
---|---|---|
committer | Tony Garnock-Jones <tonyg@lshift.net> | 2009-05-18 17:33:48 +0100 |
commit | 17c60aec273b88d3f36d3f63a659025ea687a961 (patch) | |
tree | 177a844421246f9f5df1bb13b1a5d3770d0149ad | |
parent | e2354db728162186143cf829e0ef6365f69ac184 (diff) | |
parent | 0fa9fcd0dcfb6618a6fca311b046e8215f9101ea (diff) | |
download | rabbitmq-server-17c60aec273b88d3f36d3f63a659025ea687a961.tar.gz |
merge bug20767 into v1_5
-rw-r--r-- | src/rabbit.erl | 12 | ||||
-rw-r--r-- | src/rabbit_mnesia.erl | 13 | ||||
-rw-r--r-- | src/rabbit_persister.erl | 2 |
3 files changed, 17 insertions, 10 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 97bbdd99..c8c814b6 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -238,10 +238,14 @@ print_banner() -> [Product, Version, ?PROTOCOL_VERSION_MAJOR, ?PROTOCOL_VERSION_MINOR, ?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE]), - io:format("Logging to ~p~nSASL logging to ~p~n~n", - [log_location(kernel), log_location(sasl)]). - - + Settings = [{"node", node()}, + {"log", log_location(kernel)}, + {"sasl log", log_location(sasl)}, + {"database dir", rabbit_mnesia:dir()}], + DescrLen = lists:max([length(K) || {K, _V} <- Settings]), + Format = "~-" ++ integer_to_list(DescrLen) ++ "s: ~s~n", + lists:foreach(fun ({K, V}) -> io:format(Format, [K, V]) end, Settings), + io:nl(). start_child(Mod) -> {ok,_} = supervisor:start_child(rabbit_sup, diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index d19c37cb..0c573073 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -31,7 +31,7 @@ -module(rabbit_mnesia). --export([ensure_mnesia_dir/0, status/0, init/0, is_db_empty/0, +-export([ensure_mnesia_dir/0, dir/0, status/0, init/0, is_db_empty/0, cluster/1, reset/0, force_reset/0]). -export([table_names/0]). @@ -47,6 +47,7 @@ -ifdef(use_specs). -spec(status/0 :: () -> [{'nodes' | 'running_nodes', [erlang_node()]}]). +-spec(dir/0 :: () -> string()). -spec(ensure_mnesia_dir/0 :: () -> 'ok'). -spec(init/0 :: () -> 'ok'). -spec(is_db_empty/0 :: () -> bool()). @@ -131,8 +132,10 @@ table_definitions() -> table_names() -> [Tab || {Tab, _} <- table_definitions()]. +dir() -> mnesia:system_info(directory). + ensure_mnesia_dir() -> - MnesiaDir = mnesia:system_info(directory) ++ "/", + MnesiaDir = dir() ++ "/", case filelib:ensure_dir(MnesiaDir) of {error, Reason} -> throw({error, {cannot_create_mnesia_dir, MnesiaDir, Reason}}); @@ -168,7 +171,7 @@ check_schema_integrity() -> %% it doesn't. cluster_nodes_config_filename() -> - mnesia:system_info(directory) ++ "/cluster_nodes.config". + dir() ++ "/cluster_nodes.config". create_cluster_nodes_config(ClusterNodes) -> FileName = cluster_nodes_config_filename(), @@ -284,7 +287,7 @@ create_schema() -> move_db() -> mnesia:stop(), - MnesiaDir = filename:dirname(mnesia:system_info(directory) ++ "/"), + MnesiaDir = filename:dirname(dir() ++ "/"), {{Year, Month, Day}, {Hour, Minute, Second}} = erlang:universaltime(), BackupDir = lists:flatten( io_lib:format("~s_~w~2..0w~2..0w~2..0w~2..0w~2..0w", @@ -401,7 +404,7 @@ reset(Force) -> ok = delete_cluster_nodes_config(), %% remove persistet messages and any other garbage we find lists:foreach(fun file:delete/1, - filelib:wildcard(mnesia:system_info(directory) ++ "/*")), + filelib:wildcard(dir() ++ "/*")), ok. leave_cluster([], _) -> ok; diff --git a/src/rabbit_persister.erl b/src/rabbit_persister.erl index 94033a4f..6e332484 100644 --- a/src/rabbit_persister.erl +++ b/src/rabbit_persister.erl @@ -254,7 +254,7 @@ log(State = #pstate{deadline = ExistingDeadline, pending_logs = Logs}, pending_logs = [Message | Logs]}. base_filename() -> - mnesia:system_info(directory) ++ "/rabbit_persister.LOG". + rabbit_mnesia:dir() ++ "/rabbit_persister.LOG". take_snapshot(LogHandle, OldFileName, Snapshot) -> ok = disk_log:sync(LogHandle), |