diff options
author | Tony Garnock-Jones <tonyg@lshift.net> | 2009-05-27 14:32:17 +0100 |
---|---|---|
committer | Tony Garnock-Jones <tonyg@lshift.net> | 2009-05-27 14:32:17 +0100 |
commit | b8fcc6c9cee25635a25c3f44dd3f1a1baa758449 (patch) | |
tree | a17f8993ae059c09624309f16e960aafaf96adb5 | |
parent | e75a9bce465ae68efd8b90d042c605b4b90cc8d9 (diff) | |
parent | 77b82d6213b973473085aa5224abb9b06c2a7936 (diff) | |
download | rabbitmq-server-b8fcc6c9cee25635a25c3f44dd3f1a1baa758449.tar.gz |
merge default into bug20654
-rw-r--r-- | docs/rabbitmqctl.1.pod | 2 | ||||
-rw-r--r-- | packaging/RPMS/Fedora/init.d | 2 | ||||
-rw-r--r-- | packaging/RPMS/Fedora/rabbitmq-server.spec | 32 | ||||
-rw-r--r-- | packaging/debs/Debian/debian/changelog | 6 | ||||
-rw-r--r-- | packaging/debs/Debian/debian/control | 2 | ||||
-rw-r--r-- | packaging/macports/net/rabbitmq-server/Portfile | 18 | ||||
-rw-r--r-- | packaging/windows/rabbitmq-service.pod | 6 | ||||
-rw-r--r-- | src/rabbit.erl | 12 | ||||
-rw-r--r-- | src/rabbit_amqqueue.erl | 4 | ||||
-rw-r--r-- | src/rabbit_channel.erl | 9 | ||||
-rw-r--r-- | src/rabbit_exchange.erl | 19 | ||||
-rw-r--r-- | src/rabbit_misc.erl | 4 | ||||
-rw-r--r-- | src/rabbit_mnesia.erl | 13 | ||||
-rw-r--r-- | src/rabbit_persister.erl | 2 |
14 files changed, 77 insertions, 54 deletions
diff --git a/docs/rabbitmqctl.1.pod b/docs/rabbitmqctl.1.pod index a0232a40..42156896 100644 --- a/docs/rabbitmqctl.1.pod +++ b/docs/rabbitmqctl.1.pod @@ -201,7 +201,7 @@ name URL-encoded name of the exchange type - exchange type (B<direct>, B<topic> or B<fanout>) + exchange type (B<direct>, B<topic>, B<fanout>, or B<headers>) durable whether the exchange survives server restarts diff --git a/packaging/RPMS/Fedora/init.d b/packaging/RPMS/Fedora/init.d index a9155f3b..77a6a89a 100644 --- a/packaging/RPMS/Fedora/init.d +++ b/packaging/RPMS/Fedora/init.d @@ -8,6 +8,8 @@ ### BEGIN INIT INFO # Provides: rabbitmq-server +# Default-Start: +# Default-Stop: # Required-Start: $remote_fs $network # Required-Stop: $remote_fs $network # Description: RabbitMQ broker diff --git a/packaging/RPMS/Fedora/rabbitmq-server.spec b/packaging/RPMS/Fedora/rabbitmq-server.spec index 54c7def5..3c3be609 100644 --- a/packaging/RPMS/Fedora/rabbitmq-server.spec +++ b/packaging/RPMS/Fedora/rabbitmq-server.spec @@ -28,20 +28,17 @@ scalable implementation of an AMQP broker. %define _maindir %{buildroot}%{_rabbit_erllibdir} -%pre -if [ $1 -gt 1 ]; then - #Upgrade - stop and remove previous instance of rabbitmq-server init.d script - /sbin/service rabbitmq-server stop - /sbin/chkconfig --del rabbitmq-server -fi - %prep %setup -q %build cp %{S:2} %{_rabbit_wrapper} sed -i 's|/usr/lib/|%{_libdir}/|' %{_rabbit_wrapper} -make %{?_smp_mflags} + +# The rabbitmq build needs escript, which is missing from /usr/bin in +# some versions of the erlang RPM. See +# <https://bugzilla.redhat.com/show_bug.cgi?id=481302> +PATH=%{_libdir}/erlang/bin:$PATH make %{?_smp_mflags} %install rm -rf %{buildroot} @@ -73,7 +70,14 @@ echo '%defattr(-,root,root, -)' >> %{_builddir}/filelist.%{name}.rpm ! -regex '\.\(%{_rabbit_erllibdir}\|%{_rabbit_libdir}\).*' \ | sed -e 's/^\.//' >> %{_builddir}/filelist.%{name}.rpm) -%post +%pre + +if [ $1 -gt 1 ]; then + #Upgrade - stop and remove previous instance of rabbitmq-server init.d script + /sbin/service rabbitmq-server stop + /sbin/chkconfig --del rabbitmq-server +fi + # create rabbitmq group if ! getent group rabbitmq >/dev/null; then groupadd -r rabbitmq @@ -81,10 +85,11 @@ fi # create rabbitmq user if ! getent passwd rabbitmq >/dev/null; then - useradd -r -g rabbitmq -d %{_localstatedir}/lib/rabbitmq rabbitmq \ - -c "RabbitMQ messaging server" rabbitmq + useradd -r -g rabbitmq -d %{_localstatedir}/lib/rabbitmq rabbitmq \ + -c "RabbitMQ messaging server" fi +%post /sbin/chkconfig --add %{name} %preun @@ -106,12 +111,15 @@ fi %{_rabbit_libdir} %{_initrddir}/rabbitmq-server %config(noreplace) %{_sysconfdir}/logrotate.d/rabbitmq-server -%doc LICENSE LICENSE-MPL-RabbitMQ INSTALL +%doc LICENSE LICENSE-MPL-RabbitMQ %clean rm -rf %{buildroot} %changelog +* Tue May 19 2009 Matthias Radestock <matthias@lshift.net> 1.5.5-1 +- Maintenance release for the 1.5.x series + * Mon Apr 6 2009 Matthias Radestock <matthias@lshift.net> 1.5.4-1 - Maintenance release for the 1.5.x series diff --git a/packaging/debs/Debian/debian/changelog b/packaging/debs/Debian/debian/changelog index d1ccd3a0..7c5673f7 100644 --- a/packaging/debs/Debian/debian/changelog +++ b/packaging/debs/Debian/debian/changelog @@ -1,3 +1,9 @@ +rabbitmq-server (1.5.5-1) hardy; urgency=low + + * New Upstream Release + + -- Matthias Radestock <matthias@lshift.net> Tue, 19 May 2009 09:57:54 +0100 + rabbitmq-server (1.5.4-1) hardy; urgency=low * New Upstream Release diff --git a/packaging/debs/Debian/debian/control b/packaging/debs/Debian/debian/control index b2b3ab02..21636072 100644 --- a/packaging/debs/Debian/debian/control +++ b/packaging/debs/Debian/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.8.0 Package: rabbitmq-server Architecture: all -Depends: erlang-nox, adduser, logrotate, ${misc:Depends} +Depends: erlang-nox, erlang-os-mon | erlang-nox (<< 1:13.b-dfsg1-1), adduser, logrotate, ${misc:Depends} Description: An AMQP server written in Erlang RabbitMQ is an implementation of AMQP, the emerging standard for high performance enterprise messaging. The RabbitMQ server is a robust and diff --git a/packaging/macports/net/rabbitmq-server/Portfile b/packaging/macports/net/rabbitmq-server/Portfile index d9d16dbb..65913256 100644 --- a/packaging/macports/net/rabbitmq-server/Portfile +++ b/packaging/macports/net/rabbitmq-server/Portfile @@ -1,15 +1,15 @@ # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4 # $Id$ -PortSystem 1.0 - -name rabbitmq-server -version 1.5.3 -categories net -maintainers tonyg@rabbitmq.com -platforms darwin -description The RabbitMQ AMQP Server -long_description \ +PortSystem 1.0 +name rabbitmq-server +version 1.5.5 +revision 0 +categories net +maintainers tonyg@rabbitmq.com +platforms darwin +description The RabbitMQ AMQP Server +long_description \ RabbitMQ is an implementation of AMQP, the emerging standard for \ high performance enterprise messaging. The RabbitMQ server is a \ robust and scalable implementation of an AMQP broker. diff --git a/packaging/windows/rabbitmq-service.pod b/packaging/windows/rabbitmq-service.pod index 7c4d3ef2..8a2d2e5b 100644 --- a/packaging/windows/rabbitmq-service.pod +++ b/packaging/windows/rabbitmq-service.pod @@ -92,8 +92,10 @@ Defaults to 5672. =head2 ERLANG_SERVICE_MANAGER_PATH -Defaults to F<C:\Program Files\erl5.5.5\erts-5.5.5\bin>. This is -the installation location of the Erlang service manager. +Defaults to F<C:\Program Files\erl5.5.5\erts-5.5.5\bin> +(or F<C:\Program Files (x86)\erl5.5.5\erts-5.5.5\bin> for 64-bit +environments). This is the installation location of the Erlang service +manager. =head2 CLUSTER_CONFIG_FILE diff --git a/src/rabbit.erl b/src/rabbit.erl index 0de93e99..1ddb5151 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -211,10 +211,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_amqqueue.erl b/src/rabbit_amqqueue.erl index eb076e94..0316788f 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -201,9 +201,7 @@ with(Name, F, E) -> with(Name, F) -> with(Name, F, fun () -> {error, not_found} end). with_or_die(Name, F) -> - with(Name, F, fun () -> rabbit_misc:protocol_error( - not_found, "no ~s", [rabbit_misc:rs(Name)]) - end). + with(Name, F, fun () -> rabbit_misc:not_found(Name) end). list(VHostPath) -> mnesia:dirty_match_object( diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index ff0ca704..738e9017 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -605,8 +605,7 @@ handle_method(#'exchange.delete'{exchange = ExchangeNameBin, check_configure_permitted(ExchangeName, State), case rabbit_exchange:delete(ExchangeName, IfUnused) of {error, not_found} -> - rabbit_misc:protocol_error( - not_found, "no ~s", [rabbit_misc:rs(ExchangeName)]); + rabbit_misc:not_found(ExchangeName); {error, in_use} -> die_precondition_failed( "~s in use", [rabbit_misc:rs(ExchangeName)]); @@ -772,11 +771,9 @@ binding_action(Fun, ExchangeNameBin, QueueNameBin, RoutingKey, Arguments, check_read_permitted(ExchangeName, State), case Fun(ExchangeName, QueueName, ActualRoutingKey, Arguments) of {error, exchange_not_found} -> - rabbit_misc:protocol_error( - not_found, "no ~s", [rabbit_misc:rs(ExchangeName)]); + rabbit_misc:not_found(ExchangeName); {error, queue_not_found} -> - rabbit_misc:protocol_error( - not_found, "no ~s", [rabbit_misc:rs(QueueName)]); + rabbit_misc:not_found(QueueName); {error, exchange_and_queue_not_found} -> rabbit_misc:protocol_error( not_found, "no ~s and no ~s", [rabbit_misc:rs(ExchangeName), diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index 0992b52b..71fce21b 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -158,9 +158,7 @@ lookup(Name) -> lookup_or_die(Name) -> case lookup(Name) of {ok, X} -> X; - {error, not_found} -> - rabbit_misc:protocol_error( - not_found, "no ~s", [rabbit_misc:rs(Name)]) + {error, not_found} -> rabbit_misc:not_found(Name) end. list(VHostPath) -> @@ -352,16 +350,13 @@ exchanges_for_queue(QueueName) -> sets:from_list( mnesia:select(rabbit_reverse_route, [{MatchHead, [], ['$1']}]))). -has_bindings(ExchangeName) -> - MatchHead = #route{binding = #binding{exchange_name = ExchangeName, - _ = '_'}}, +contains(Table, MatchHead) -> try - continue(mnesia:select(rabbit_route, [{MatchHead, [], ['$_']}], - 1, read)) + continue(mnesia:select(Table, [{MatchHead, [], ['$_']}], 1, read)) catch exit:{aborted, {badarg, _}} -> %% work around OTP-7025, which was fixed in R12B-1, by %% falling back on a less efficient method - case mnesia:match_object(rabbit_route, MatchHead, read) of + case mnesia:match_object(Table, MatchHead, read) of [] -> false; [_|_] -> true end @@ -571,7 +566,11 @@ maybe_auto_delete(Exchange = #exchange{auto_delete = true}) -> ok. conditional_delete(Exchange = #exchange{name = ExchangeName}) -> - case has_bindings(ExchangeName) of + Match = #route{binding = #binding{exchange_name = ExchangeName, _ = '_'}}, + %% we need to check for durable routes here too in case a bunch of + %% routes to durable queues have been removed temporarily as a + %% result of a node failure + case contains(rabbit_route, Match) orelse contains(rabbit_durable_route, Match) of false -> unconditional_delete(Exchange); true -> {error, in_use} end. diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index af044607..72e16f0f 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -36,6 +36,7 @@ -export([method_record_type/1, polite_pause/0, polite_pause/1]). -export([die/1, frame_error/2, protocol_error/3, protocol_error/4]). +-export([not_found/1]). -export([get_config/1, get_config/2, set_config/2]). -export([dirty_read/1]). -export([r/3, r/2, r_arg/4, rs/1]). @@ -72,6 +73,7 @@ (atom() | amqp_error(), string(), [any()]) -> no_return()). -spec(protocol_error/4 :: (atom() | amqp_error(), string(), [any()], atom()) -> no_return()). +-spec(not_found/1 :: (r(atom())) -> no_return()). -spec(get_config/1 :: (atom()) -> {'ok', any()} | not_found()). -spec(get_config/2 :: (atom(), A) -> A). -spec(set_config/2 :: (atom(), any()) -> 'ok'). @@ -141,6 +143,8 @@ protocol_error(Error, Explanation, Params, Method) -> CompleteExplanation = lists:flatten(io_lib:format(Explanation, Params)), exit({amqp, Error, CompleteExplanation, Method}). +not_found(R) -> protocol_error(not_found, "no ~s", [rs(R)]). + get_config(Key) -> case dirty_read({rabbit_config, Key}) of {ok, {rabbit_config, Key, V}} -> {ok, V}; diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index 15213861..575ecb0a 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()). @@ -148,8 +149,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}}); @@ -185,7 +188,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(), @@ -301,7 +304,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", @@ -418,7 +421,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 f4fa4599..d0d60ddf 100644 --- a/src/rabbit_persister.erl +++ b/src/rabbit_persister.erl @@ -259,7 +259,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), |