diff options
71 files changed, 1552 insertions, 553 deletions
diff --git a/LICENSE-MPL-RabbitMQ b/LICENSE-MPL-RabbitMQ index 7c2ee3ca0d..2d0a7b1db2 100644 --- a/LICENSE-MPL-RabbitMQ +++ b/LICENSE-MPL-RabbitMQ @@ -446,13 +446,19 @@ EXHIBIT A -Mozilla Public License. The Original Code is RabbitMQ. - The Initial Developers of the Original Code are LShift Ltd., - Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. - - Portions created by LShift Ltd., Cohesive Financial Technologies - LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 - LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit - Technologies Ltd.; + The Initial Developers of the Original Code are LShift Ltd, + Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. + + Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, + Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd + are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial + Technologies LLC, and Rabbit Technologies Ltd. + + Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift + Ltd. Portions created by Cohesive Financial Technologies LLC are + Copyright (C) 2007-2009 Cohesive Financial Technologies + LLC. Portions created by Rabbit Technologies Ltd are Copyright + (C) 2007-2009 Rabbit Technologies Ltd. All Rights Reserved. @@ -23,6 +23,7 @@ LOG_BASE=/tmp VERSION=0.0.0 TARBALL_NAME=rabbitmq-server-$(VERSION) +TARGET_SRC_DIR=dist/$(TARBALL_NAME) SIBLING_CODEGEN_DIR=../rabbitmq-codegen/ AMQP_CODEGEN_DIR=$(shell [ -d $(SIBLING_CODEGEN_DIR) ] && echo $(SIBLING_CODEGEN_DIR) || echo codegen) @@ -62,6 +63,9 @@ cleandb: stop-node run: all NODE_IP_ADDRESS=$(NODE_IP_ADDRESS) NODE_PORT=$(NODE_PORT) NODE_ONLY=true LOG_BASE=$(LOG_BASE) RABBIT_ARGS="$(RABBIT_ARGS) -s rabbit" MNESIA_DIR=$(MNESIA_DIR) ./scripts/rabbitmq-server +check-mnesia-schema: all + NODE_IP_ADDRESS=$(NODE_IP_ADDRESS) NODE_PORT=$(NODE_PORT) LOG_BASE=$(LOG_BASE) MNESIA_DIR=$(MNESIA_DIR) ./scripts/rabbitmq-mnesia-current + run-node: all NODE_IP_ADDRESS=$(NODE_IP_ADDRESS) NODE_PORT=$(NODE_PORT) NODE_ONLY=true LOG_BASE=$(LOG_BASE) RABBIT_ARGS="$(RABBIT_ARGS)" MNESIA_DIR=$(MNESIA_DIR) ./scripts/rabbitmq-server @@ -92,39 +96,27 @@ stop-cover: all ######################################################################## -generic_stage: - mkdir -p $(GENERIC_STAGE_DIR) - cp -r ebin include src $(GENERIC_STAGE_DIR) - cp LICENSE LICENSE-MPL-RabbitMQ $(GENERIC_STAGE_DIR) - - if [ -f INSTALL.in ]; then \ - cp INSTALL.in $(GENERIC_STAGE_DIR)/INSTALL; \ - elinks -dump -no-references -no-numbering $(WEB_URL)install.html \ - >> $(GENERIC_STAGE_DIR)/INSTALL; \ - cp BUILD.in $(GENERIC_STAGE_DIR)/BUILD; \ - elinks -dump -no-references -no-numbering $(WEB_URL)build-server.html \ - >> $(GENERIC_STAGE_DIR)/BUILD; \ - else \ - cp INSTALL $(GENERIC_STAGE_DIR); \ - cp BUILD $(GENERIC_STAGE_DIR); \ - fi - - sed -i 's/%%VERSION%%/$(VERSION)/' $(GENERIC_STAGE_DIR)/ebin/rabbit.app - srcdist: distclean - $(MAKE) VERSION=$(VERSION) GENERIC_STAGE_DIR=dist/$(TARBALL_NAME) generic_stage - - mkdir -p dist/$(TARBALL_NAME)/codegen - cp -r $(AMQP_CODEGEN_DIR)/* dist/$(TARBALL_NAME)/codegen/ - cp codegen.py Makefile dist/$(TARBALL_NAME) - - cp -r scripts dist/$(TARBALL_NAME) - cp -r docs dist/$(TARBALL_NAME) - chmod 0755 dist/$(TARBALL_NAME)/scripts/* + mkdir -p $(TARGET_SRC_DIR)/codegen + cp -r ebin src include LICENSE LICENSE-MPL-RabbitMQ $(TARGET_SRC_DIR) + cp INSTALL.in $(TARGET_SRC_DIR)/INSTALL + elinks -dump -no-references -no-numbering $(WEB_URL)install.html \ + >> $(TARGET_SRC_DIR)/INSTALL + cp BUILD.in $(TARGET_SRC_DIR)/BUILD + elinks -dump -no-references -no-numbering $(WEB_URL)build-server.html \ + >> $(TARGET_SRC_DIR)/BUILD + sed -i 's/%%VERSION%%/$(VERSION)/' $(TARGET_SRC_DIR)/ebin/rabbit.app + + cp -r $(AMQP_CODEGEN_DIR)/* $(TARGET_SRC_DIR)/codegen/ + cp codegen.py Makefile $(TARGET_SRC_DIR) + + cp -r scripts $(TARGET_SRC_DIR) + cp -r docs $(TARGET_SRC_DIR) + chmod 0755 $(TARGET_SRC_DIR)/scripts/* (cd dist; tar -zcf $(TARBALL_NAME).tar.gz $(TARBALL_NAME)) (cd dist; zip -r $(TARBALL_NAME).zip $(TARBALL_NAME)) - rm -rf dist/$(TARBALL_NAME) + rm -rf $(TARGET_SRC_DIR) distclean: clean make -C $(AMQP_CODEGEN_DIR) clean @@ -135,8 +127,9 @@ install: all @[ -n "$(TARGET_DIR)" ] || (echo "Please set TARGET_DIR."; false) @[ -n "$(SBIN_DIR)" ] || (echo "Please set SBIN_DIR."; false) @[ -n "$(MAN_DIR)" ] || (echo "Please set MAN_DIR."; false) - - $(MAKE) VERSION=$(VERSION) GENERIC_STAGE_DIR=$(TARGET_DIR) generic_stage + + mkdir -p $(TARGET_DIR) + cp -r ebin include LICENSE LICENSE-MPL-RabbitMQ INSTALL $(TARGET_DIR) chmod 0755 scripts/* mkdir -p $(SBIN_DIR) @@ -144,10 +137,9 @@ install: all cp scripts/rabbitmq-server $(SBIN_DIR) cp scripts/rabbitmqctl $(SBIN_DIR) cp scripts/rabbitmq-multi $(SBIN_DIR) + cp scripts/rabbitmq-mnesia-current $(SBIN_DIR) for manpage in docs/*.pod ; do \ pod2man -c "RabbitMQ AMQP Server" -d "" -r "" \ $$manpage | gzip --best > \ $(MAN_DIR)/man1/`echo $$manpage | sed -e 's:docs/\(.*\)\.pod:\1\.1\.gz:g'`; \ done - - rm -f $(TARGET_DIR)/BUILD diff --git a/codegen.py b/codegen.py index 5dbc57c7de..84741ea28d 100644 --- a/codegen.py +++ b/codegen.py @@ -10,13 +10,19 @@ ## ## The Original Code is RabbitMQ. ## -## The Initial Developers of the Original Code are LShift Ltd., -## Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +## The Initial Developers of the Original Code are LShift Ltd, +## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. ## -## Portions created by LShift Ltd., Cohesive Financial Technologies -## LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -## LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -## Technologies Ltd.; +## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +## Technologies LLC, and Rabbit Technologies Ltd. +## +## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +## Ltd. Portions created by Cohesive Financial Technologies LLC are +## Copyright (C) 2007-2009 Cohesive Financial Technologies +## LLC. Portions created by Rabbit Technologies Ltd are Copyright +## (C) 2007-2009 Rabbit Technologies Ltd. ## ## All Rights Reserved. ## @@ -58,7 +64,8 @@ erlangDefaultValueTypeConvMap = { str : lambda x: "<<\"" + x + "\">>", int : lambda x: str(x), float : lambda x: str(x), - dict: convertTable + dict: convertTable, + unicode: lambda x: "<<\"" + x.encode("utf-8") + "\">>" } def erlangize(s): diff --git a/docs/rabbitmq-multi.pod b/docs/rabbitmq-multi.pod index 65d058337c..82c3911681 100644 --- a/docs/rabbitmq-multi.pod +++ b/docs/rabbitmq-multi.pod @@ -44,14 +44,7 @@ rabbitmq-server(1), rabbitmqctl(1) =head1 AUTHOR -Originally written by The RabbitMQ Team <info@lshift.net> - -=head1 COPYRIGHT - -This package, the RabbitMQ server is licensed under the MPL. - -If you have any questions regarding licensing, please contact us at -info@rabbitmq.com. +The RabbitMQ Team <info@rabbitmq.com> =head1 REFERENCES diff --git a/docs/rabbitmq-server.pod b/docs/rabbitmq-server.pod index 1eaf2dfdfb..e3152b5873 100644 --- a/docs/rabbitmq-server.pod +++ b/docs/rabbitmq-server.pod @@ -66,14 +66,7 @@ rabbitmq-multi(1), rabbitmqctl(1) =head1 AUTHOR -Originally written by The RabbitMQ Team <info@lshift.net> - -=head1 COPYRIGHT - -This package, the RabbitMQ server is licensed under the MPL. - -If you have any questions regarding licensing, please contact us at -info@rabbitmq.com. +The RabbitMQ Team <info@rabbitmq.com> =head1 REFERENCES diff --git a/docs/rabbitmqctl.pod b/docs/rabbitmqctl.pod index b34cbca754..1de311717a 100644 --- a/docs/rabbitmqctl.pod +++ b/docs/rabbitmqctl.pod @@ -143,14 +143,7 @@ rabbitmq-multi(1), rabbitmq-server(1) =head1 AUTHOR -Originally written by The RabbitMQ Team <info@lshift.net> - -=head1 COPYRIGHT - -This package, the RabbitMQ server is licensed under the MPL. - -If you have any questions regarding licensing, please contact us at -info@rabbitmq.com. +The RabbitMQ Team <info@rabbitmq.com> =head1 REFERENCES diff --git a/include/rabbit.hrl b/include/rabbit.hrl index 267e018b44..d07aeaf845 100644 --- a/include/rabbit.hrl +++ b/include/rabbit.hrl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -63,7 +69,7 @@ -include("rabbit_framing_spec.hrl"). -type(maybe(T) :: T | 'none'). --type(node() :: atom()). +-type(erlang_node() :: atom()). -type(socket() :: port()). -type(thunk(T) :: fun(() -> T)). -type(info_key() :: atom()). @@ -125,7 +131,7 @@ -type(msg_id() :: non_neg_integer()). -type(msg() :: {queue_name(), pid(), msg_id(), bool(), message()}). -type(listener() :: - #listener{node :: node(), + #listener{node :: erlang_node(), protocol :: atom(), host :: string() | atom(), port :: non_neg_integer()}). @@ -135,7 +141,7 @@ %%---------------------------------------------------------------------------- --define(COPYRIGHT_MESSAGE, "Copyright (C) 2007-2008 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd."). +-define(COPYRIGHT_MESSAGE, "Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd."). -define(INFORMATION_MESSAGE, "Licensed under the MPL. See http://www.rabbitmq.com/"). -ifdef(debug). diff --git a/include/rabbit_framing_spec.hrl b/include/rabbit_framing_spec.hrl index 130001535a..f45fa6caf4 100644 --- a/include/rabbit_framing_spec.hrl +++ b/include/rabbit_framing_spec.hrl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/packaging/Makefile b/packaging/Makefile deleted file mode 100644 index 44a9b328e8..0000000000 --- a/packaging/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -check_tools: - @sh ./checks.sh - @echo All the needed tools seem to be installed, great! diff --git a/packaging/RPMS/Fedora/Makefile b/packaging/RPMS/Fedora/Makefile index 33032f118f..2c028e702b 100644 --- a/packaging/RPMS/Fedora/Makefile +++ b/packaging/RPMS/Fedora/Makefile @@ -18,9 +18,11 @@ prepare: cp init.d SOURCES/rabbitmq-server.init cp rabbitmqctl_wrapper SOURCES/rabbitmq-server.wrapper cp rabbitmq-server.logrotate SOURCES/rabbitmq-server.logrotate + cp rabbitmq-server-preserve-db.sh SOURCES server: prepare - rpmbuild -ba SPECS/rabbitmq-server.spec $(DEFINES) --target noarch + rpmbuild -ba SPECS/rabbitmq-server.spec $(DEFINES) --target i386 + rpmbuild -ba SPECS/rabbitmq-server.spec $(DEFINES) --target x86_64 clean: rm -rf SOURCES SPECS RPMS SRPMS BUILD tmp diff --git a/packaging/RPMS/Fedora/init.d b/packaging/RPMS/Fedora/init.d index 397beeaa22..27f150f997 100644 --- a/packaging/RPMS/Fedora/init.d +++ b/packaging/RPMS/Fedora/init.d @@ -18,7 +18,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON_NAME=rabbitmq-multi -DAEMON=/usr/sbin/$DAEMON_NAME +DAEMON=/usr/lib/rabbitmq/bin/$DAEMON_NAME NAME=rabbitmq-server DESC=rabbitmq-server USER=rabbitmq @@ -64,7 +64,7 @@ start_rabbitmq () { stop_rabbitmq () { set +e status_rabbitmq quiet - if [ $RETVAL == 0 ] ; then + if [ $RETVAL = 0 ] ; then su $USER -s /bin/sh -c "$DAEMON stop_all" > /var/log/rabbitmq/shutdown_log 2> /var/log/rabbitmq/shutdown_err RETVAL=$? if [ $RETVAL != 0 ] ; then diff --git a/packaging/RPMS/Fedora/rabbitmq-server-preserve-db.sh b/packaging/RPMS/Fedora/rabbitmq-server-preserve-db.sh new file mode 100644 index 0000000000..e885b6b80f --- /dev/null +++ b/packaging/RPMS/Fedora/rabbitmq-server-preserve-db.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +if [ "$1x" = "x" ]; then + echo "You haven't specified the initial location of the RabbitMQ database" + exit 1 +fi + +if [ ! -d "$1" ]; then + echo "The directory containing the RabbitMQ database doesn't exist" + exit 1 +fi + +echo +echo "The RabbitMQ database schema has changed." +echo "If your RabbitMQ database contains important data," +echo "such as user accounts, durable exchanges and queues," +echo "or persistent messages, then we recommend you contact" +echo "support@rabbitmq.com for assistance with the upgrade." +echo "The current RabbitMQ database will be moved to the" +echo "directory: " + +CURRENT_MNESIA_DIR=$1 +DATE=`date +'%d_%m_%Y'` +TMP_OLD_MNESIA_DIR=$CURRENT_MNESIA_DIR.$$.${DATE} +mv "$CURRENT_MNESIA_DIR" "$TMP_OLD_MNESIA_DIR" + +echo "$TMP_OLD_MNESIA_DIR" +echo
\ No newline at end of file diff --git a/packaging/RPMS/Fedora/rabbitmq-server.spec b/packaging/RPMS/Fedora/rabbitmq-server.spec index 214f6918fd..fbee9ef3d7 100644 --- a/packaging/RPMS/Fedora/rabbitmq-server.spec +++ b/packaging/RPMS/Fedora/rabbitmq-server.spec @@ -7,15 +7,16 @@ Source: http://www.rabbitmq.com/releases/rabbitmq-server/v%{version}/%{name}-%{v Source1: rabbitmq-server.init Source2: rabbitmq-server.wrapper Source3: rabbitmq-server.logrotate +Source4: rabbitmq-server-preserve-db.sh URL: http://www.rabbitmq.com/ Vendor: LShift Ltd., Cohesive Financial Technologies LLC., Rabbit Technlogies Ltd. %if 0%{?debian} %else -BuildRequires: python, python-json +BuildRequires: erlang, python-simplejson %endif Requires: erlang, logrotate Packager: Hubert Plociniczak <hubert@lshift.net> -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%{_arch}-root Summary: The RabbitMQ server Requires(post): chkconfig Requires(pre): chkconfig initscripts @@ -25,10 +26,16 @@ 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. +%ifarch x86_64 + %define _defaultlibdir /usr/lib64 +%else + %define _defaultlibdir /usr/lib +%endif -%define _erllibdir %(erl -noshell -eval "io:format('~s~n', [code:lib_dir()]), halt().") -%define _maindir %{buildroot}%{_erllibdir}/rabbitmq_server-%{version} +%define _erllibdir %{_defaultlibdir}/erlang/lib +%define _rabbitbindir %{_defaultlibdir}/rabbitmq/bin +%define _maindir %{buildroot}%{_erllibdir}/rabbitmq_server-%{version} %pre if [ $1 -gt 1 ]; then @@ -47,9 +54,8 @@ make rm -rf %{buildroot} make install TARGET_DIR=%{_maindir} \ - SBIN_DIR=%{buildroot}%{_sbindir} \ + SBIN_DIR=%{buildroot}%{_rabbitbindir} \ MAN_DIR=%{buildroot}%{_mandir} - VERSION=%{version} mkdir -p %{buildroot}/var/lib/rabbitmq/mnesia mkdir -p %{buildroot}/var/log/rabbitmq @@ -59,14 +65,14 @@ mkdir -p %{buildroot}/etc/rc.d/init.d/ install -m 0755 %SOURCE1 %{buildroot}/etc/rc.d/init.d/rabbitmq-server chmod 0755 %{buildroot}/etc/rc.d/init.d/rabbitmq-server -mv %{buildroot}/usr/sbin/rabbitmqctl %{buildroot}/usr/sbin/rabbitmqctl_real -install -m 0755 %SOURCE2 %{buildroot}/usr/sbin/rabbitmqctl - -cp %{buildroot}%{_mandir}/man1/rabbitmqctl.1.gz %{buildroot}%{_mandir}/man1/rabbitmqctl_real.1.gz +mkdir -p %{buildroot}%{_sbindir} +install -m 0755 %SOURCE2 %{buildroot}%{_sbindir}/rabbitmqctl mkdir -p %{buildroot}/etc/logrotate.d install %SOURCE3 %{buildroot}/etc/logrotate.d/rabbitmq-server +rm %{_maindir}/LICENSE %{_maindir}/LICENSE-MPL-RabbitMQ %{_maindir}/INSTALL + %post # create rabbitmq group if ! getent group rabbitmq >/dev/null; then @@ -82,6 +88,11 @@ fi chown -R rabbitmq:rabbitmq /var/lib/rabbitmq chown -R rabbitmq:rabbitmq /var/log/rabbitmq +su rabbitmq -s /bin/sh -c %{_rabbitbindir}/rabbitmq-mnesia-current +if [ $? = 1 ]; then + /bin/sh %SOURCE4 /var/lib/rabbitmq/mnesia +fi + /sbin/chkconfig --add %{name} /sbin/service rabbitmq-server start @@ -98,18 +109,16 @@ fi %files %defattr(-,root,root,-) %{_erllibdir}/rabbitmq_server-%{version}/ +%{_rabbitbindir}/ %{_mandir}/man1/rabbitmq-multi.1.gz %{_mandir}/man1/rabbitmq-server.1.gz %{_mandir}/man1/rabbitmqctl.1.gz -%{_mandir}/man1/rabbitmqctl_real.1.gz -%{_sbindir}/rabbitmq-multi -%{_sbindir}/rabbitmq-server %{_sbindir}/rabbitmqctl -%{_sbindir}/rabbitmqctl_real -/var/lib/rabbitmq/ -/var/log/rabbitmq/ +%dir /var/lib/rabbitmq +%dir /var/log/rabbitmq /etc/rc.d/init.d/rabbitmq-server %config(noreplace) /etc/logrotate.d/rabbitmq-server +%doc LICENSE LICENSE-MPL-RabbitMQ INSTALL %clean rm -rf %{buildroot} diff --git a/packaging/RPMS/Fedora/rabbitmqctl_wrapper b/packaging/RPMS/Fedora/rabbitmqctl_wrapper index c484bb27ea..6b387d2997 100644 --- a/packaging/RPMS/Fedora/rabbitmqctl_wrapper +++ b/packaging/RPMS/Fedora/rabbitmqctl_wrapper @@ -10,5 +10,10 @@ for arg in "$@" ; do done cd / -su rabbitmq -s /bin/sh -c "/usr/sbin/rabbitmqctl_real ${CMDLINE}" - +if [ `id -u` = 0 ] ; then + su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/rabbitmqctl ${CMDLINE}" +else + /usr/lib/rabbitmq/bin/rabbitmqctl + echo -e "\nOnly root should run rabbitmqctl\n" + exit 1 +fi diff --git a/packaging/checks.sh b/packaging/checks.sh deleted file mode 100755 index 63e88701f3..0000000000 --- a/packaging/checks.sh +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/sh - -# We check for the presence of the tools necessary to build a release on a -# Debian based OS. - -TOOLS_STOP=0 - -checker () { - if [ ! `which $1` ] - then - echo "$1 is missing, please install it" - TOOLS_STOP=1 - NEW_NAME=`echo $1 | sed -e 's/-/_/g'` - eval "$NEW_NAME=1" - else - echo "$1 found" - fi -}; - -echo ~~~~~~~~~~~~ Looking for mandatory programs ~~~~~~~~~~~~ - -for i in cdbs-edit-patch reprepro rpm elinks wget zip gpg rsync -do - checker $i -done -echo ~~~~~~~~~~~~~~~~~~~~~~~~~~ DONE ~~~~~~~~~~~~~~~~~~~~~~~ - -if [ 1 = $TOOLS_STOP ] -then - [ $cdbs_edit_patch ] && cdbs_edit_patch="cdbs " - [ $reprepro ] && reprepro="reprepro " - [ $rpm ] && rpm="rpm " - [ $elinks ] && elinks="elinks " - [ $wget ] && wget="wget " - [ $zip ] && zip="zip " - [ $gpg ] && gpg="gpg " - [ $rsync ] && rsync="rsync " - - echo - echo We suggest you run the command - echo "apt-get install ${cdbs_edit_patch}${reprepro}${rpm}${elinks}${wget}${zip}${gpg}${rsync}" - echo -fi - -exit $TOOLS_STOP diff --git a/packaging/debs/Debian/Makefile b/packaging/debs/Debian/Makefile index 3e74cb5231..9479feb001 100644 --- a/packaging/debs/Debian/Makefile +++ b/packaging/debs/Debian/Makefile @@ -16,7 +16,6 @@ all: @echo 'Please choose a target from the Makefile.' package: clean - make -C ../.. check_tools cp $(TARBALL_DIR)/$(TARBALL) $(DEBIAN_ORIG_TARBALL) tar -zxvf $(DEBIAN_ORIG_TARBALL) cp -r debian $(UNPACKED_DIR) diff --git a/packaging/debs/Debian/debian/control b/packaging/debs/Debian/debian/control index 749791a4bd..f6761713dd 100644 --- a/packaging/debs/Debian/debian/control +++ b/packaging/debs/Debian/debian/control @@ -2,12 +2,12 @@ Source: rabbitmq-server Section: net Priority: extra Maintainer: Tony Garnock-Jones <tonyg@rabbitmq.com> -Build-Depends: cdbs, debhelper (>= 5), erlang-nox, erlang-dev, python-json +Build-Depends: cdbs, debhelper (>= 5), erlang-nox, erlang-dev, python-simplejson Standards-Version: 3.7.2 Package: rabbitmq-server Architecture: all -Depends: erlang-nox, adduser, logrotate +Depends: erlang-nox, adduser, logrotate, debconf 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/debs/Debian/debian/copyright b/packaging/debs/Debian/debian/copyright index 9f9f8672bc..f9a2b6515a 100644 --- a/packaging/debs/Debian/debian/copyright +++ b/packaging/debs/Debian/debian/copyright @@ -5,7 +5,7 @@ It was downloaded from http://www.rabbitmq.com/ Upstream Author: The RabbitMQ team <info@rabbitmq.com> -Copyright: 2006-2008 Rabbit Technologies Ltd. +Copyright: 2006-2009 Rabbit Technologies Ltd. License: The RabbitMQ server is licensed under the MPL. @@ -461,13 +461,19 @@ EXHIBIT A -Mozilla Public License. The Original Code is RabbitMQ. - The Initial Developers of the Original Code are LShift Ltd., - Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. + The Initial Developers of the Original Code are LShift Ltd, + Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. - Portions created by LShift Ltd., Cohesive Financial Technologies - LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 - LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit - Technologies Ltd.; + Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, + Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd + are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial + Technologies LLC, and Rabbit Technologies Ltd. + + Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift + Ltd. Portions created by Cohesive Financial Technologies LLC are + Copyright (C) 2007-2009 Cohesive Financial Technologies + LLC. Portions created by Rabbit Technologies Ltd are Copyright + (C) 2007-2009 Rabbit Technologies Ltd. All Rights Reserved. @@ -485,7 +491,7 @@ EXHIBIT A -Mozilla Public License. If you have any questions regarding licensing, please contact us at info@rabbitmq.com. -The Debian packaging is (C) 2007-2008, Rabbit Technologies Ltd. <info@rabbitmq.com> +The Debian packaging is (C) 2007-2009, Rabbit Technologies Ltd. <info@rabbitmq.com> and is licensed under the MPL 1.1, see above. diff --git a/packaging/debs/Debian/debian/dirs b/packaging/debs/Debian/debian/dirs index 74f8631437..1a707bc191 100644 --- a/packaging/debs/Debian/debian/dirs +++ b/packaging/debs/Debian/debian/dirs @@ -1,3 +1,4 @@ +usr/lib/rabbitmq/bin usr/lib/erlang/lib usr/sbin usr/share/man diff --git a/packaging/debs/Debian/debian/init.d b/packaging/debs/Debian/debian/init.d index a93f306692..ace474c59f 100644 --- a/packaging/debs/Debian/debian/init.d +++ b/packaging/debs/Debian/debian/init.d @@ -10,7 +10,7 @@ ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/sbin/rabbitmq-multi +DAEMON=/usr/lib/rabbitmq/bin/rabbitmq-multi NAME=rabbitmq-server DESC=rabbitmq-server USER=rabbitmq @@ -51,7 +51,7 @@ start_rabbitmq () { stop_rabbitmq () { set +e status_rabbitmq quiet - if [ $RETVAL == 0 ] ; then + if [ $RETVAL = 0 ] ; then su $USER -s /bin/sh -c "$DAEMON stop_all" > /var/log/rabbitmq/shutdown_log 2> /var/log/rabbitmq/shutdown_err RETVAL=$? if [ $RETVAL != 0 ] ; then diff --git a/packaging/debs/Debian/debian/postinst b/packaging/debs/Debian/debian/postinst index f92131d0c8..13d8552f3d 100644 --- a/packaging/debs/Debian/debian/postinst +++ b/packaging/debs/Debian/debian/postinst @@ -34,6 +34,28 @@ chown -R rabbitmq:rabbitmq /var/log/rabbitmq case "$1" in configure) + . /usr/share/debconf/confmodule + + if ! su rabbitmq -s /bin/sh -c /usr/lib/rabbitmq/bin/rabbitmq-mnesia-current ; then + db_beginblock + db_input high rabbitmq-server/mnesia-dir-note || true + db_input high rabbitmq-server/do-what-with-mnesia-dir || true + db_endblock + db_go + + db_get rabbitmq-server/do-what-with-mnesia-dir + if [ "$RET" = "Delete it" ]; then + rm -r /var/lib/rabbitmq/mnesia/ + elif [ "$RET" = "Move it elsewhere" ]; then + db_input high rabbitmq-server/move-mnesia-dir-where || true + db_go + + db_get rabbitmq-server/move-mnesia-dir-where + + mkdir -p "`dirname $RET`" + mv /var/lib/rabbitmq/mnesia "$RET" + fi + fi ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/packaging/debs/Debian/debian/rabbitmqctl_wrapper b/packaging/debs/Debian/debian/rabbitmqctl_wrapper index c484bb27ea..d53a6ca9c6 100644 --- a/packaging/debs/Debian/debian/rabbitmqctl_wrapper +++ b/packaging/debs/Debian/debian/rabbitmqctl_wrapper @@ -10,5 +10,12 @@ for arg in "$@" ; do done cd / -su rabbitmq -s /bin/sh -c "/usr/sbin/rabbitmqctl_real ${CMDLINE}" + +if [ `id -u` = 0 ] ; then + su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/rabbitmqctl ${CMDLINE}" +else + /usr/lib/rabbitmq/bin/rabbitmqctl + echo -e "\nOnly root should run rabbitmqctl\n" + exit 1 +fi diff --git a/packaging/debs/Debian/debian/rules b/packaging/debs/Debian/debian/rules index 39af711c13..fa4cb855cc 100644 --- a/packaging/debs/Debian/debian/rules +++ b/packaging/debs/Debian/debian/rules @@ -3,17 +3,16 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/makefile.mk -RABBIT_LIB=$(DEB_DESTDIR)usr/lib/erlang/lib/rabbitmq_server-$(DEB_UPSTREAM_VERSION) +RABBIT_LIB=$(DEB_DESTDIR)usr/lib/erlang/lib/rabbitmq_server-$(DEB_UPSTREAM_VERSION)/ +RABBIT_BIN=$(DEB_DESTDIR)usr/lib/rabbitmq/bin/ -DEB_MAKE_INSTALL_TARGET := install TARGET_DIR=$(RABBIT_LIB)/ SBIN_DIR=$(DEB_DESTDIR)usr/sbin MAN_DIR=$(DEB_DESTDIR)usr/share/man +DEB_MAKE_INSTALL_TARGET := install TARGET_DIR=$(RABBIT_LIB) SBIN_DIR=$(RABBIT_BIN) MAN_DIR=$(DEB_DESTDIR)usr/share/man/ DOCDIR=$(DEB_DESTDIR)usr/share/doc/rabbitmq-server/ install/rabbitmq-server:: mkdir -p $(DOCDIR) - rm $(RABBIT_LIB)/LICENSE* - mv $(DEB_DESTDIR)usr/sbin/rabbitmqctl $(DEB_DESTDIR)usr/sbin/rabbitmqctl_real + rm $(RABBIT_LIB)LICENSE* cp debian/rabbitmqctl_wrapper $(DEB_DESTDIR)usr/sbin/rabbitmqctl cp debian/rabbitmq-server.logrotate $(DEB_DESTDIR)etc/logrotate.d/rabbitmq-server - cp $(DEB_DESTDIR)usr/share/man/man1/rabbitmqctl.1.gz $(DEB_DESTDIR)usr/share/man/man1/rabbitmqctl_real.1.gz chmod a+x $(DEB_DESTDIR)usr/sbin/rabbitmqctl diff --git a/packaging/debs/Debian/debian/templates b/packaging/debs/Debian/debian/templates new file mode 100644 index 0000000000..89f5754bd7 --- /dev/null +++ b/packaging/debs/Debian/debian/templates @@ -0,0 +1,16 @@ +Template: rabbitmq-server/mnesia-dir-note +Type: note +Description: Schema changed + The RabbitMQ database schema has changed. If your RabbitMQ database contains important data, such as user accounts, durable exchanges and queues, or persistent messages, then we recommend you contact support@rabbitmq.com for assistance with the upgrade. If you want to experiment with the new version in the meantime, simply move the database directory to a safe place. In all other cases just remove the directory. + + +Template: rabbitmq-server/do-what-with-mnesia-dir +Type: select +Choices: Delete it, Move it elsewhere, Keep it in place (WILL BREAK) +Default: Delete it +Description: What do you want to do with the RabbitMQ database directory? + +Template: rabbitmq-server/move-mnesia-dir-where +Type: string +Default: /var/lib/rabbitmq/mnesia-old/ +Description: Where do you want to move the RabbitMQ database directory? diff --git a/packaging/windows/Makefile b/packaging/windows/Makefile index f9437da7ca..9d16fd9fb3 100644 --- a/packaging/windows/Makefile +++ b/packaging/windows/Makefile @@ -10,6 +10,7 @@ dist: mkdir $(SOURCE_DIR)/sbin mv $(SOURCE_DIR)/scripts/rabbitmq-server.bat $(SOURCE_DIR)/sbin + mv $(SOURCE_DIR)/scripts/rabbitmq-service.bat $(SOURCE_DIR)/sbin mv $(SOURCE_DIR)/scripts/rabbitmqctl.bat $(SOURCE_DIR)/sbin mv $(SOURCE_DIR)/scripts/rabbitmq-multi.bat $(SOURCE_DIR)/sbin rm -rf $(SOURCE_DIR)/scripts @@ -18,6 +19,8 @@ dist: rm -rf $(SOURCE_DIR)/docs mv $(SOURCE_DIR) $(TARGET_DIR) + pod2text --loose rabbitmq-service.pod $(TARGET_DIR)/readme-service.txt + unix2dos $(TARGET_DIR)/readme-service.txt zip -r $(TARGET_ZIP).zip $(TARGET_DIR) rm -rf $(TARGET_DIR) diff --git a/packaging/windows/rabbitmq-service.pod b/packaging/windows/rabbitmq-service.pod new file mode 100644 index 0000000000..c762826fa8 --- /dev/null +++ b/packaging/windows/rabbitmq-service.pod @@ -0,0 +1,131 @@ +=head1 NAME + +rabbitmq-service - manage RabbitMQ AMQP service + +=head1 SYNOPSIS + +rabbitmq-service.bat command + +=head1 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. + +Running B<rabbitmq-service> allows the RabbitMQ broker to be run as a +service on NT/2000/2003/XP/Vista® environments. The RabbitMQ broker +service can be started and stopped using the Windows® services +applet. + +By default the service will run in the authentication context of the +local system account. It is therefore necessary to synchronise Erlang +cookies between the local system account (typically +C<C:\WINDOWS\.erlang.cookie> and the account that will be used to +run B<rabbitmqctl>. + +=head1 COMMANDS + +=head2 help + +Display usage information. + +=head2 install + +Install the service. The service will not be started. +Subsequent invocations will update the service parameters if +relevant environment variables were modified. + +=head2 remove + +Remove the service. If the service is running then it will +automatically be stopped before being removed. No files will be +deleted as a consequence and B<rabbitmq-server> will remain operable. + +=head2 start + +Start the service. The service must have been correctly installed +beforehand. + +=head2 stop + +Stop the service. The service must be running for this command to +have any effect. + +=head2 disable + +Disable the service. This is the equivalent of setting the startup +type to B<Disabled> using the service control panel. + +=head2 enable + +Enable the service. This is the equivalent of setting the startup +type to B<Automatic> using the service control panel. + +=head1 ENVIRONMENT + +=head2 SERVICENAME + +Defaults to RabbitMQ. +This is the location of log and database directories. + +=head2 RABBITMQ_BASE + +Defaults to the application data directory of the current user. +This is the location of log and database directories. + +=head2 NODENAME + +Defaults to "rabbit". This can be useful if you want to run more +than one node per machine - B<NODENAME> should be unique per +erlang-node-and-machine combination. See clustering on a single +machine guide +at L<http://www.rabbitmq.com/clustering.html#single-machine> for +details. + +=head2 NODE_IP_ADDRESS + +Defaults to "0.0.0.0". This can be changed if you only want to bind +to one network interface. + +=head2 NODE_PORT + +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. + +=head2 CLUSTER_CONFIG_FILE + +If this file is present it is used by the server to +auto-configure a RabbitMQ cluster. See the clustering guide +at L<http://www.rabbitmq.com/clustering.html> for details. + +=head2 CONSOLE_LOG + +Set this varable to B<new> or B<reuse> to have the console +output from the server redirected to a file named B<SERVICENAME>.debug +in the application data directory of the user that installed the service. +Under Vista this will be F<C:\Documents and Settings\User\AppData\username\SERVICENAME>. +Under previous versions of Windows this will be +F<C:\Documents and Settings\username\Application Data\SERVICENAME>. +If B<CONSOLE_LOG> is set to B<new> then a new file will be created +each time the service starts. If B<CONSOLE_LOG> is set to B<reuse> +then the file will be overwritten each time the service starts. +The default behaviour when B<CONSOLE_LOG> is not set or set to a +value other than B<new> or B<reuse> is to discard the server output. + +=head1 EXAMPLES + +Start a previously-installed RabbitMQ AMQP service: + + rabbitmq-service start + +=head1 AUTHOR + +The RabbitMQ Team <info@rabbitmq.com> + +=head1 REFERENCES + +RabbitMQ Web Site: http://www.rabbitmq.com diff --git a/scripts/rabbitmq-mnesia-current b/scripts/rabbitmq-mnesia-current new file mode 100755 index 0000000000..e69e497639 --- /dev/null +++ b/scripts/rabbitmq-mnesia-current @@ -0,0 +1,56 @@ +#!/bin/sh +## The contents of this file are subject to the Mozilla Public License +## Version 1.1 (the "License"); you may not use this file except in +## compliance with the License. You may obtain a copy of the License at +## http://www.mozilla.org/MPL/ +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +## License for the specific language governing rights and limitations +## under the License. +## +## The Original Code is RabbitMQ. +## +## The Initial Developers of the Original Code are LShift Ltd, +## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. +## +## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +## Technologies LLC, and Rabbit Technologies Ltd. +## +## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +## Ltd. Portions created by Cohesive Financial Technologies LLC are +## Copyright (C) 2007-2009 Cohesive Financial Technologies +## LLC. Portions created by Rabbit Technologies Ltd are Copyright +## (C) 2007-2009 Rabbit Technologies Ltd. +## +## All Rights Reserved. +## +## Contributor(s): ______________________________________. +## + +[ "x" = "x$NODENAME" ] && NODENAME=rabbit +[ "x" = "x$NODE_IP_ADDRESS" ] && NODE_IP_ADDRESS=0.0.0.0 +[ "x" = "x$NODE_PORT" ] && NODE_PORT=5672 + +CLUSTER_CONFIG_FILE=/etc/default/rabbitmq_cluster.config + +[ "x" = "x$LOG_BASE" ] && LOG_BASE=/var/log/rabbitmq +[ "x" = "x$MNESIA_BASE" ] && MNESIA_BASE=/var/lib/rabbitmq/mnesia +[ "x" = "x$MNESIA_DIR" ] && MNESIA_DIR=${MNESIA_BASE}/${NODENAME} + +if [ -f "$CLUSTER_CONFIG_FILE" ]; then + CLUSTER_CONFIG="-rabbit cluster_config \"$CLUSTER_CONFIG_FILE\"" +else + CLUSTER_CONFIG="" +fi + +exec erl \ + -pa "`dirname $0`/../ebin" \ + -noshell \ + -sname ${NODENAME} \ + -eval 'halt(case rabbit_mnesia:schema_current() of true -> 0; false -> 1 end).' \ + -mnesia dir "\"${MNESIA_DIR}\"" \ + -kernel error_logger '{file,"'/dev/null'"}' \ + ${CLUSTER_CONFIG} diff --git a/scripts/rabbitmq-multi b/scripts/rabbitmq-multi index 5e4f4b3862..8c889a1afa 100755 --- a/scripts/rabbitmq-multi +++ b/scripts/rabbitmq-multi @@ -11,13 +11,19 @@ ## ## The Original Code is RabbitMQ. ## -## The Initial Developers of the Original Code are LShift Ltd., -## Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +## The Initial Developers of the Original Code are LShift Ltd, +## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. ## -## Portions created by LShift Ltd., Cohesive Financial Technologies -## LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -## LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -## Technologies Ltd.; +## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +## Technologies LLC, and Rabbit Technologies Ltd. +## +## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +## Ltd. Portions created by Cohesive Financial Technologies LLC are +## Copyright (C) 2007-2009 Cohesive Financial Technologies +## LLC. Portions created by Rabbit Technologies Ltd are Copyright +## (C) 2007-2009 Rabbit Technologies Ltd. ## ## All Rights Reserved. ## diff --git a/scripts/rabbitmq-multi.bat b/scripts/rabbitmq-multi.bat index 819c99af5c..7899b70db7 100644..100755 --- a/scripts/rabbitmq-multi.bat +++ b/scripts/rabbitmq-multi.bat @@ -11,13 +11,19 @@ REM under the License. REM
REM The Original Code is RabbitMQ.
REM
-REM The Initial Developers of the Original Code are LShift Ltd.,
-REM Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
+REM The Initial Developers of the Original Code are LShift Ltd,
+REM Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
REM
-REM Portions created by LShift Ltd., Cohesive Financial Technologies
-REM LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008
-REM LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit
-REM Technologies Ltd.;
+REM Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+REM Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+REM are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+REM Technologies LLC, and Rabbit Technologies Ltd.
+REM
+REM Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+REM Ltd. Portions created by Cohesive Financial Technologies LLC are
+REM Copyright (C) 2007-2009 Cohesive Financial Technologies
+REM LLC. Portions created by Rabbit Technologies Ltd are Copyright
+REM (C) 2007-2009 Rabbit Technologies Ltd.
REM
REM All Rights Reserved.
REM
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server index c953a75312..f2971cb3d8 100755 --- a/scripts/rabbitmq-server +++ b/scripts/rabbitmq-server @@ -11,13 +11,19 @@ ## ## The Original Code is RabbitMQ. ## -## The Initial Developers of the Original Code are LShift Ltd., -## Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +## The Initial Developers of the Original Code are LShift Ltd, +## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. ## -## Portions created by LShift Ltd., Cohesive Financial Technologies -## LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -## LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -## Technologies Ltd.; +## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +## Technologies LLC, and Rabbit Technologies Ltd. +## +## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +## Ltd. Portions created by Cohesive Financial Technologies LLC are +## Copyright (C) 2007-2009 Cohesive Financial Technologies +## LLC. Portions created by Rabbit Technologies Ltd are Copyright +## (C) 2007-2009 Rabbit Technologies Ltd. ## ## All Rights Reserved. ## @@ -53,7 +59,7 @@ else CLUSTER_CONFIG="" fi -erl \ +exec erl \ -pa "`dirname $0`/../ebin" \ ${START_RABBIT} \ -sname ${NODENAME} \ @@ -66,7 +72,7 @@ erl \ -sasl sasl_error_logger '{file,"'${SASL_LOGS}'"}' \ -os_mon start_cpu_sup true \ -os_mon start_disksup false \ - -os_mon start_memsup true \ + -os_mon start_memsup false \ -os_mon start_os_sup false \ -os_mon memsup_system_only true \ -os_mon system_memory_high_watermark 0.95 \ diff --git a/scripts/rabbitmq-server.bat b/scripts/rabbitmq-server.bat index 38b8cc5307..41d75f8141 100644..100755 --- a/scripts/rabbitmq-server.bat +++ b/scripts/rabbitmq-server.bat @@ -11,13 +11,19 @@ REM under the License. REM
REM The Original Code is RabbitMQ.
REM
-REM The Initial Developers of the Original Code are LShift Ltd.,
-REM Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
+REM The Initial Developers of the Original Code are LShift Ltd,
+REM Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
REM
-REM Portions created by LShift Ltd., Cohesive Financial Technologies
-REM LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008
-REM LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit
-REM Technologies Ltd.;
+REM Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+REM Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+REM are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+REM Technologies LLC, and Rabbit Technologies Ltd.
+REM
+REM Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+REM Ltd. Portions created by Cohesive Financial Technologies LLC are
+REM Copyright (C) 2007-2009 Cohesive Financial Technologies
+REM LLC. Portions created by Rabbit Technologies Ltd are Copyright
+REM (C) 2007-2009 Rabbit Technologies Ltd.
REM
REM All Rights Reserved.
REM
@@ -107,7 +113,7 @@ set MNESIA_DIR=%MNESIA_BASE%/%NODENAME%-mnesia -sasl sasl_error_logger {file,\""%LOG_BASE%/%NODENAME%-sasl.log"\"} ^
-os_mon start_cpu_sup true ^
-os_mon start_disksup false ^
--os_mon start_memsup true ^
+-os_mon start_memsup false ^
-os_mon start_os_sup false ^
-os_mon memsup_system_only true ^
-os_mon system_memory_high_watermark 0.95 ^
diff --git a/scripts/rabbitmq-service.bat b/scripts/rabbitmq-service.bat new file mode 100755 index 0000000000..6a1804f3aa --- /dev/null +++ b/scripts/rabbitmq-service.bat @@ -0,0 +1,195 @@ +@echo off
+REM The contents of this file are subject to the Mozilla Public License
+REM Version 1.1 (the "License"); you may not use this file except in
+REM compliance with the License. You may obtain a copy of the License at
+REM http://www.mozilla.org/MPL/
+REM
+REM Software distributed under the License is distributed on an "AS IS"
+REM basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+REM License for the specific language governing rights and limitations
+REM under the License.
+REM
+REM The Original Code is RabbitMQ.
+REM
+REM The Initial Developers of the Original Code are LShift Ltd,
+REM Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+REM
+REM Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+REM Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+REM are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+REM Technologies LLC, and Rabbit Technologies Ltd.
+REM
+REM Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+REM Ltd. Portions created by Cohesive Financial Technologies LLC are
+REM Copyright (C) 2007-2009 Cohesive Financial Technologies
+REM LLC. Portions created by Rabbit Technologies Ltd are Copyright
+REM (C) 2007-2009 Rabbit Technologies Ltd.
+REM
+REM All Rights Reserved.
+REM
+REM Contributor(s): ______________________________________.
+REM
+
+if "%SERVICENAME%"=="" (
+ set SERVICENAME=RabbitMQ
+)
+
+if "%RABBITMQ_BASE%"=="" (
+ set RABBITMQ_BASE=%APPDATA%\%SERVICENAME%
+)
+
+if "%NODENAME%"=="" (
+ set NODENAME=rabbit
+)
+
+if "%NODE_IP_ADDRESS%"=="" (
+ set NODE_IP_ADDRESS=0.0.0.0
+)
+
+if "%NODE_PORT%"=="" (
+ set NODE_PORT=5672
+)
+
+if "%ERLANG_SERVICE_MANAGER_PATH%"=="" (
+ set ERLANG_SERVICE_MANAGER_PATH=C:\Program Files\erl5.5.5\erts-5.5.5\bin
+)
+
+set CONSOLE_FLAG=
+set CONSOLE_LOG_VALID=
+for %%i in (new reuse) do if "%%i" == "%CONSOLE_LOG%" set CONSOLE_LOG_VALID=TRUE
+if "%CONSOLE_LOG_VALID%" == "TRUE" (
+ set CONSOLE_FLAG=-debugtype %CONSOLE_LOG%
+)
+
+rem *** End of configuration ***
+
+if not exist "%ERLANG_SERVICE_MANAGER_PATH%\erlsrv.exe" (
+ echo.
+ echo **********************************************
+ echo ERLANG_SERVICE_MANAGER_PATH not set correctly.
+ echo **********************************************
+ echo.
+ echo %ERLANG_SERVICE_MANAGER_PATH%\erlsrv.exe not found!
+ echo Please set ERLANG_SERVICE_MANAGER_PATH to the folder containing "erlsrv.exe".
+ echo.
+ exit /B 1
+)
+
+rem erlang prefers forwardslash as separator in paths
+set RABBITMQ_BASE_UNIX=%RABBITMQ_BASE:\=/%
+set MNESIA_BASE=%RABBITMQ_BASE_UNIX%/db
+set LOG_BASE=%RABBITMQ_BASE_UNIX%/log
+
+
+rem We save the previous logs in their respective backup
+rem Log management (rotation, filtering based on size...) is left as an exercise for the user.
+
+set BACKUP_EXTENSION=.1
+
+set LOGS="%RABBITMQ_BASE%\log\%NODENAME%.log"
+set SASL_LOGS="%RABBITMQ_BASE%\log\%NODENAME%-sasl.log"
+
+set LOGS_BACKUP="%RABBITMQ_BASE%\log\%NODENAME%.log%BACKUP_EXTENSION%"
+set SASL_LOGS_BACKUP="%RABBITMQ_BASE%\log\%NODENAME%-sasl.log%BACKUP_EXTENSION%"
+
+if exist %LOGS% (
+ type %LOGS% >> %LOGS_BACKUP%
+)
+if exist %SASL_LOGS% (
+ type %SASL_LOGS% >> %SASL_LOGS_BACKUP%
+)
+
+rem End of log management
+
+
+set CLUSTER_CONFIG_FILE=%RABBITMQ_BASE%\rabbitmq_cluster.config
+set CLUSTER_CONFIG=
+if not exist "%CLUSTER_CONFIG_FILE%" GOTO L1
+set CLUSTER_CONFIG=-rabbit cluster_config \""%CLUSTER_CONFIG_FILE:\=/%"\"
+:L1
+
+set MNESIA_DIR=%MNESIA_BASE%/%NODENAME%-mnesia
+
+
+if "%1" == "install" goto INSTALL_SERVICE
+for %%i in (start stop disable enable list remove) do if "%%i" == "%1" goto MODIFY_SERVICE
+
+echo.
+echo *********************
+echo Service control usage
+echo *********************
+echo.
+echo %~n0 help - Display this help
+echo %~n0 install - Install the %SERVICENAME% service
+echo %~n0 remove - Remove the %SERVICENAME% service
+echo.
+echo The following actions can also be accomplished by using
+echo Windows Services Management Console (services.msc):
+echo.
+echo %~n0 start - Start the %SERVICENAME% service
+echo %~n0 stop - Stop the %SERVICENAME% service
+echo %~n0 disable - Disable the %SERVICENAME% service
+echo %~n0 enable - Enable the %SERVICENAME% service
+echo.
+exit /B
+
+
+:INSTALL_SERVICE
+
+if not exist "%RABBITMQ_BASE%" (
+ echo Creating base directory %RABBITMQ_BASE% & md "%RABBITMQ_BASE%"
+)
+
+"%ERLANG_SERVICE_MANAGER_PATH%\erlsrv" list %SERVICENAME% 2>NUL 1>NUL
+if errorlevel 1 (
+ "%ERLANG_SERVICE_MANAGER_PATH%\erlsrv" add %SERVICENAME%
+) else (
+ echo %SERVICENAME% service is already present - only updating service parameters
+)
+
+set RABBIT_EBIN=%~dp0..\ebin
+
+set ERLANG_SERVICE_ARGUMENTS= ^
+-pa "%RABBIT_EBIN%" ^
+-boot start_sasl ^
+-s rabbit ^
++W w ^
++A30 ^
+-kernel inet_default_listen_options "[{nodelay,true},{sndbuf,16384},{recbuf,4096}]" ^
+-kernel inet_default_connect_options "[{nodelay,true}]" ^
+-rabbit tcp_listeners "[{\"%NODE_IP_ADDRESS%\",%NODE_PORT%}]" ^
+-kernel error_logger {file,\""%LOG_BASE%/%NODENAME%.log"\"} ^
+-sasl errlog_type error ^
+-sasl sasl_error_logger {file,\""%LOG_BASE%/%NODENAME%-sasl.log"\"} ^
+-os_mon start_cpu_sup true ^
+-os_mon start_disksup false ^
+-os_mon start_memsup true ^
+-os_mon start_os_sup false ^
+-os_mon memsup_system_only true ^
+-os_mon system_memory_high_watermark 0.95 ^
+-mnesia dir \""%MNESIA_DIR%"\" ^
+%CLUSTER_CONFIG% ^
+%RABBIT_ARGS% ^
+%*
+
+set ERLANG_SERVICE_ARGUMENTS=%ERLANG_SERVICE_ARGUMENTS:\=\\%
+set ERLANG_SERVICE_ARGUMENTS=%ERLANG_SERVICE_ARGUMENTS:"=\"%
+
+"%ERLANG_SERVICE_MANAGER_PATH%\erlsrv" set %SERVICENAME% ^
+-machine "%ERLANG_SERVICE_MANAGER_PATH%\erl.exe" ^
+-env ERL_CRASH_DUMP="%RABBITMQ_BASE_UNIX%/log" ^
+-workdir "%RABBITMQ_BASE%" ^
+-stopaction "rabbit:stop_and_halt()." ^
+-sname %NODENAME% ^
+%CONSOLE_FLAG% ^
+-args "%ERLANG_SERVICE_ARGUMENTS%" > NUL
+goto END
+
+
+:MODIFY_SERVICE
+
+"%ERLANG_SERVICE_MANAGER_PATH%\erlsrv" %1 %SERVICENAME%
+goto END
+
+
+:END
\ No newline at end of file diff --git a/scripts/rabbitmqctl b/scripts/rabbitmqctl index 419dcf632a..b941b85005 100755 --- a/scripts/rabbitmqctl +++ b/scripts/rabbitmqctl @@ -11,30 +11,29 @@ ## ## The Original Code is RabbitMQ. ## -## The Initial Developers of the Original Code are LShift Ltd., -## Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +## The Initial Developers of the Original Code are LShift Ltd, +## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. ## -## Portions created by LShift Ltd., Cohesive Financial Technologies -## LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -## LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -## Technologies Ltd.; +## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +## Technologies LLC, and Rabbit Technologies Ltd. +## +## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +## Ltd. Portions created by Cohesive Financial Technologies LLC are +## Copyright (C) 2007-2009 Cohesive Financial Technologies +## LLC. Portions created by Rabbit Technologies Ltd are Copyright +## (C) 2007-2009 Rabbit Technologies Ltd. ## ## All Rights Reserved. ## ## Contributor(s): ______________________________________. ## -[ "x" = "x$NODENAME" ] && NODENAME=rabbit -MNESIA_BASE=/var/lib/rabbitmq/mnesia -LOG_BASE=/var/log/rabbitmq -ERL_ARGS= -MNESIA_DIR=${MNESIA_BASE}/${NODENAME} - exec erl \ -pa "`dirname $0`/../ebin" \ -noinput \ -hidden \ - ${ERL_ARGS} \ -sname rabbitmqctl$$ \ -s rabbit_control \ -extra "$@" diff --git a/scripts/rabbitmqctl.bat b/scripts/rabbitmqctl.bat index 1ee7e825b9..33a10777d0 100644..100755 --- a/scripts/rabbitmqctl.bat +++ b/scripts/rabbitmqctl.bat @@ -11,13 +11,19 @@ REM under the License. REM
REM The Original Code is RabbitMQ.
REM
-REM The Initial Developers of the Original Code are LShift Ltd.,
-REM Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
+REM The Initial Developers of the Original Code are LShift Ltd,
+REM Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
REM
-REM Portions created by LShift Ltd., Cohesive Financial Technologies
-REM LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008
-REM LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit
-REM Technologies Ltd.;
+REM Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+REM Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+REM are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+REM Technologies LLC, and Rabbit Technologies Ltd.
+REM
+REM Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+REM Ltd. Portions created by Cohesive Financial Technologies LLC are
+REM Copyright (C) 2007-2009 Cohesive Financial Technologies
+REM LLC. Portions created by Rabbit Technologies Ltd are Copyright
+REM (C) 2007-2009 Rabbit Technologies Ltd.
REM
REM All Rights Reserved.
REM
diff --git a/src/buffering_proxy.erl b/src/buffering_proxy.erl index fcb7b412e2..344b719a3c 100644 --- a/src/buffering_proxy.erl +++ b/src/buffering_proxy.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit.erl b/src/rabbit.erl index a33c5b7bcb..1152ef5998 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -57,8 +63,8 @@ -spec(rotate_logs/1 :: (file_suffix()) -> 'ok' | {'error', any()}). -spec(status/0 :: () -> [{running_applications, [{atom(), string(), string()}]} | - {nodes, [node()]} | - {running_nodes, [node()]}]). + {nodes, [erlang_node()]} | + {running_nodes, [erlang_node()]}]). -spec(log_location/1 :: ('sasl' | 'kernel') -> log_location()). -endif. diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl index 0b39c53e39..b73090fc44 100644 --- a/src/rabbit_access_control.erl +++ b/src/rabbit_access_control.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl index d9c1c45042..8570aa7cf2 100644 --- a/src/rabbit_alarm.erl +++ b/src/rabbit_alarm.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -50,22 +56,57 @@ %%---------------------------------------------------------------------------- start() -> + ok = alarm_handler:add_alarm_handler(?MODULE), + case whereis(memsup) of + undefined -> + Mod = case os:type() of + %% memsup doesn't take account of buffers or + %% cache when considering "free" memory - + %% therefore on Linux we can get memory alarms + %% very easily without any pressure existing on + %% memory at all. Therefore we need to use our + %% own simple memory monitor. + %% + {unix, linux} -> rabbit_memsup_linux; + + %% Start memsup programmatically rather than via + %% the rabbitmq-server script. This is not quite + %% the right thing to do as os_mon checks to see + %% if memsup is available before starting it, + %% but as memsup is available everywhere (even + %% on VXWorks) it should be ok. + %% + %% One benefit of the programmatic startup is + %% that we can add our alarm_handler before + %% memsup is running, thus ensuring that we + %% notice memory alarms that go off on startup. + %% + _ -> memsup + end, + %% This is based on os_mon:childspec(memsup, true) + {ok, _} = supervisor:start_child( + os_mon_sup, + {memsup, {Mod, start_link, []}, + permanent, 2000, worker, [Mod]}), + ok; + _ -> + ok + end, %% The default memsup check interval is 1 minute, which is way too - %% long - rabbit can gobble up all memory in a matter of - %% seconds. Unfortunately the memory_check_interval configuration - %% parameter and memsup:set_check_interval/1 function only provide - %% a granularity of minutes. So we have to peel off one layer of - %% the API to get to the underlying layer which operates at the + %% long - rabbit can gobble up all memory in a matter of seconds. + %% Unfortunately the memory_check_interval configuration parameter + %% and memsup:set_check_interval/1 function only provide a + %% granularity of minutes. So we have to peel off one layer of the + %% API to get to the underlying layer which operates at the %% granularity of milliseconds. %% %% Note that the new setting will only take effect after the first %% check has completed, i.e. after one minute. So if rabbit eats %% all the memory within the first minute after startup then we %% are out of luck. - ok = os_mon:call(memsup, {set_check_interval, ?MEMSUP_CHECK_INTERVAL}, - infinity), - - ok = alarm_handler:add_alarm_handler(?MODULE). + ok = os_mon:call(memsup, + {set_check_interval, ?MEMSUP_CHECK_INTERVAL}, + infinity). stop() -> ok = alarm_handler:delete_alarm_handler(?MODULE). @@ -118,7 +159,7 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}. %%---------------------------------------------------------------------------- - + alert(Alert, Alertees) -> dict:fold(fun (Pid, {M, F, A}, Acc) -> ok = erlang:apply(M, F, A ++ [Pid, Alert]), diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index 749c130a2c..2b9abb2990 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -95,7 +101,7 @@ -spec(basic_cancel/4 :: (amqqueue(), pid(), ctag(), any()) -> 'ok'). -spec(notify_sent/2 :: (pid(), pid()) -> 'ok'). -spec(internal_delete/1 :: (queue_name()) -> 'ok' | not_found()). --spec(on_node_down/1 :: (node()) -> 'ok'). +-spec(on_node_down/1 :: (erlang_node()) -> 'ok'). -spec(pseudo_queue/2 :: (binary(), pid()) -> amqqueue()). -endif. diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index a9addd5293..709e355ee0 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -749,7 +755,9 @@ handle_info({'DOWN', _MonitorRef, process, DownPid, _Reason}, State) -> handle_ch_down(DownPid, State); handle_info(timeout, State) -> - {noreply, State, hibernate}; + %% TODO: Once we drop support for R11B-5, we can change this to + %% {noreply, State, hibernate}; + proc_lib:hibernate(gen_server, enter_loop, [?MODULE, [], State]); handle_info(Info, State) -> ?LOGDEBUG("Info in queue: ~p~n", [Info]), diff --git a/src/rabbit_amqqueue_sup.erl b/src/rabbit_amqqueue_sup.erl index c68e2b3eda..46d23a4075 100644 --- a/src/rabbit_amqqueue_sup.erl +++ b/src/rabbit_amqqueue_sup.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_binary_generator.erl b/src/rabbit_binary_generator.erl index 8b16abec70..6cfa9e6d17 100644 --- a/src/rabbit_binary_generator.erl +++ b/src/rabbit_binary_generator.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_binary_parser.erl b/src/rabbit_binary_parser.erl index e942521504..4ef382aaf5 100644 --- a/src/rabbit_binary_parser.erl +++ b/src/rabbit_binary_parser.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 1eb421cad4..5d7fde90ef 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index bc588279b4..98d57c3141 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -26,43 +32,67 @@ -module(rabbit_control). -include("rabbit.hrl"). --export([start/0, stop/0, action/3]). +-export([start/0, stop/0, action/4]). + +-record(params, {quiet, node, command, args}). -define(RPC_TIMEOUT, 30000). start() -> - case init:get_plain_arguments() of - [] -> + FullCommand = init:get_plain_arguments(), + #params{quiet = Quiet, node = Node, command = Command, args = Args} = + parse_args(FullCommand, #params{quiet = false, + node = rabbit_misc:localnode(rabbit)}), + Inform = case Quiet of + true -> fun(_Format, _Args1) -> ok end; + false -> fun(Format, Args1) -> + io:format(Format ++ " ...~n", Args1) + end + end, + %% The reason we don't use a try/catch here is that rpc:call turns + %% thrown errors into normal return values + case catch action(Command, Node, Args, Inform) of + ok -> + case Quiet of + true -> ok; + false -> io:format("...done.~n") + end, + init:stop(); + {'EXIT', {function_clause, [{?MODULE, action, _} | _]}} -> + error("invalid command '~s'", + [lists:flatten( + rabbit_misc:intersperse( + " ", [atom_to_list(Command) | Args]))]), usage(); - FullCommand -> - {Node, Command, Args} = parse_args(FullCommand), - case catch action(Command, Node, Args) of - ok -> - io:format("done.~n"), - init:stop(); - {'EXIT', {function_clause, [{?MODULE, action, _} | _]}} -> - io:format("Invalid command ~p~n", [FullCommand]), - usage(); - Other -> - io:format("~nrabbit_control action ~p failed:~n~p~n", [Command, Other]), - halt(2) - end + {error, Reason} -> + error("~p", [Reason]), + halt(2); + Other -> + error("~p", [Other]), + halt(2) end. -parse_args(["-n", NodeS, Command | Args]) -> +error(Format, Args) -> + rabbit_misc:format_stderr("Error: " ++ Format ++ "~n", Args). + +parse_args(["-n", NodeS | Args], Params) -> Node = case lists:member($@, NodeS) of true -> list_to_atom(NodeS); false -> rabbit_misc:localnode(list_to_atom(NodeS)) end, - {Node, list_to_atom(Command), Args}; -parse_args([Command | Args]) -> - {rabbit_misc:localnode(rabbit), list_to_atom(Command), Args}. + parse_args(Args, Params#params{node = Node}); +parse_args(["-q" | Args], Params) -> + parse_args(Args, Params#params{quiet = true}); +parse_args([Command | Args], Params) -> + Params#params{command = list_to_atom(Command), args = Args}; +parse_args([], _) -> + usage(). stop() -> ok. usage() -> - io:format("Usage: rabbitmqctl [-n <node>] <command> [<arg> ...] + io:format("Usage: rabbitmqctl [-q] [-n <node>] <command> [<arg> ...] Available commands: @@ -89,6 +119,9 @@ Available commands: list_user_vhosts <UserName> list_vhost_users <VHostPath> +Quiet output mode is selected with the \"-q\" flag. Informational messages +are suppressed when quiet mode is in effect. + <node> should be the name of the master node of the RabbitMQ cluster. It defaults to the node named \"rabbit\" on the local host. On a host named \"server.example.com\", the master node will usually be rabbit@server (unless @@ -98,95 +131,95 @@ output of hostname -s is usually the correct suffix to use after the \"@\" sign. "), halt(1). -action(stop, Node, []) -> - io:format("Stopping and halting node ~p ...", [Node]), +action(stop, Node, [], Inform) -> + Inform("Stopping and halting node ~p", [Node]), call(Node, {rabbit, stop_and_halt, []}); -action(stop_app, Node, []) -> - io:format("Stopping node ~p ...", [Node]), +action(stop_app, Node, [], Inform) -> + Inform("Stopping node ~p", [Node]), call(Node, {rabbit, stop, []}); -action(start_app, Node, []) -> - io:format("Starting node ~p ...", [Node]), +action(start_app, Node, [], Inform) -> + Inform("Starting node ~p", [Node]), call(Node, {rabbit, start, []}); -action(reset, Node, []) -> - io:format("Resetting node ~p ...", [Node]), +action(reset, Node, [], Inform) -> + Inform("Resetting node ~p", [Node]), call(Node, {rabbit_mnesia, reset, []}); -action(force_reset, Node, []) -> - io:format("Forcefully resetting node ~p ...", [Node]), +action(force_reset, Node, [], Inform) -> + Inform("Forcefully resetting node ~p", [Node]), call(Node, {rabbit_mnesia, force_reset, []}); -action(cluster, Node, ClusterNodeSs) -> +action(cluster, Node, ClusterNodeSs, Inform) -> ClusterNodes = lists:map(fun list_to_atom/1, ClusterNodeSs), - io:format("Clustering node ~p with ~p ...", + Inform("Clustering node ~p with ~p", [Node, ClusterNodes]), rpc_call(Node, rabbit_mnesia, cluster, [ClusterNodes]); -action(status, Node, []) -> - io:format("Status of node ~p ...", [Node]), +action(status, Node, [], Inform) -> + Inform("Status of node ~p", [Node]), Res = call(Node, {rabbit, status, []}), - io:format("~n~p~n", [Res]), + io:format("~p~n", [Res]), ok; -action(rotate_logs, Node, []) -> - io:format("Reopening logs for node ~p ...", [Node]), +action(rotate_logs, Node, [], Inform) -> + Inform("Reopening logs for node ~p", [Node]), call(Node, {rabbit, rotate_logs, [""]}); -action(rotate_logs, Node, Args = [Suffix]) -> - io:format("Rotating logs to files with suffix ~p ...", [Suffix]), +action(rotate_logs, Node, Args = [Suffix], Inform) -> + Inform("Rotating logs to files with suffix ~p", [Suffix]), call(Node, {rabbit, rotate_logs, Args}); -action(add_user, Node, Args = [Username, _Password]) -> - io:format("Creating user ~p ...", [Username]), +action(add_user, Node, Args = [Username, _Password], Inform) -> + Inform("Creating user ~p", [Username]), call(Node, {rabbit_access_control, add_user, Args}); -action(delete_user, Node, Args = [_Username]) -> - io:format("Deleting user ~p ...", Args), +action(delete_user, Node, Args = [_Username], Inform) -> + Inform("Deleting user ~p", Args), call(Node, {rabbit_access_control, delete_user, Args}); -action(change_password, Node, Args = [Username, _Newpassword]) -> - io:format("Changing password for user ~p ...", [Username]), +action(change_password, Node, Args = [Username, _Newpassword], Inform) -> + Inform("Changing password for user ~p", [Username]), call(Node, {rabbit_access_control, change_password, Args}); -action(list_users, Node, []) -> - io:format("Listing users ..."), +action(list_users, Node, [], Inform) -> + Inform("Listing users", []), display_list(call(Node, {rabbit_access_control, list_users, []})); -action(add_vhost, Node, Args = [_VHostPath]) -> - io:format("Creating vhost ~p ...", Args), +action(add_vhost, Node, Args = [_VHostPath], Inform) -> + Inform("Creating vhost ~p", Args), call(Node, {rabbit_access_control, add_vhost, Args}); -action(delete_vhost, Node, Args = [_VHostPath]) -> - io:format("Deleting vhost ~p ...", Args), +action(delete_vhost, Node, Args = [_VHostPath], Inform) -> + Inform("Deleting vhost ~p", Args), call(Node, {rabbit_access_control, delete_vhost, Args}); -action(list_vhosts, Node, []) -> - io:format("Listing vhosts ..."), +action(list_vhosts, Node, [], Inform) -> + Inform("Listing vhosts", []), display_list(call(Node, {rabbit_access_control, list_vhosts, []})); -action(map_user_vhost, Node, Args = [_Username, _VHostPath]) -> - io:format("Mapping user ~p to vhost ~p ...", Args), +action(map_user_vhost, Node, Args = [_Username, _VHostPath], Inform) -> + Inform("Mapping user ~p to vhost ~p", Args), call(Node, {rabbit_access_control, map_user_vhost, Args}); -action(unmap_user_vhost, Node, Args = [_Username, _VHostPath]) -> - io:format("Unmapping user ~p from vhost ~p ...", Args), +action(unmap_user_vhost, Node, Args = [_Username, _VHostPath], Inform) -> + Inform("Unmapping user ~p from vhost ~p", Args), call(Node, {rabbit_access_control, unmap_user_vhost, Args}); -action(list_user_vhosts, Node, Args = [_Username]) -> - io:format("Listing vhosts for user ~p...", Args), +action(list_user_vhosts, Node, Args = [_Username], Inform) -> + Inform("Listing vhosts for user ~p", Args), display_list(call(Node, {rabbit_access_control, list_user_vhosts, Args})); -action(list_vhost_users, Node, Args = [_VHostPath]) -> - io:format("Listing users for vhosts ~p...", Args), +action(list_vhost_users, Node, Args = [_VHostPath], Inform) -> + Inform("Listing users for vhosts ~p", Args), display_list(call(Node, {rabbit_access_control, list_vhost_users, Args})). display_list(L) when is_list(L) -> lists:foreach(fun (I) -> - io:format("~n~s", [binary_to_list(I)]) + io:format("~s~n", [binary_to_list(I)]) end, lists:sort(L)), - io:nl(); + ok; display_list(Other) -> Other. call(Node, {Mod, Fun, Args}) -> diff --git a/src/rabbit_error_logger.erl b/src/rabbit_error_logger.erl index 9220d7b46f..dc5824f1c9 100644 --- a/src/rabbit_error_logger.erl +++ b/src/rabbit_error_logger.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_error_logger_file_h.erl b/src/rabbit_error_logger_file_h.erl index d67b02ef42..9a9220b53e 100644 --- a/src/rabbit_error_logger_file_h.erl +++ b/src/rabbit_error_logger_file_h.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -53,9 +59,11 @@ init({{File, _}, error}) -> %% log rotation init({File, []}) -> init(File); -init({_File, _Type} = FileInfo) -> +init({File, _Type} = FileInfo) -> + rabbit_misc:ensure_parent_dirs_exist(File), error_logger_file_h:init(FileInfo); init(File) -> + rabbit_misc:ensure_parent_dirs_exist(File), error_logger_file_h:init(File). handle_event(Event, State) -> diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index dd8e5ff948..299747d141 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -298,9 +304,17 @@ exchanges_for_queue(QueueName) -> has_bindings(ExchangeName) -> MatchHead = #route{binding = #binding{exchange_name = ExchangeName, - queue_name = '$1', _ = '_'}}, - continue(mnesia:select(route, [{MatchHead, [], ['$1']}], 1, read)). + try + continue(mnesia:select(route, [{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(MatchHead) of + [] -> false; + [_|_] -> true + end + end. continue('$end_of_table') -> false; continue({[_|_], _}) -> true; diff --git a/src/rabbit_framing_channel.erl b/src/rabbit_framing_channel.erl index 76c0461399..060bed4893 100644 --- a/src/rabbit_framing_channel.erl +++ b/src/rabbit_framing_channel.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_heartbeat.erl b/src/rabbit_heartbeat.erl index 6e825578d3..0a68c9adad 100644 --- a/src/rabbit_heartbeat.erl +++ b/src/rabbit_heartbeat.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -67,7 +73,7 @@ heartbeater(Sock, TimeoutMillisec, StatName, Threshold, Handler, MonitorRef) -> {'DOWN', MonitorRef, process, _Object, _Info} -> ok; Other -> exit({unexpected_message, Other}) after TimeoutMillisec -> - case prim_inet:getstat(Sock, [StatName]) of + case inet:getstat(Sock, [StatName]) of {ok, [{StatName, NewStatVal}]} -> if NewStatVal =/= StatVal -> F({NewStatVal, 0}); diff --git a/src/rabbit_load.erl b/src/rabbit_load.erl index 8deec8ebee..7bf85347fb 100644 --- a/src/rabbit_load.erl +++ b/src/rabbit_load.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -34,11 +40,11 @@ -ifdef(use_specs). --type(node() :: atom()). --type(load() :: {{non_neg_integer(), float()}, node()}). +-type(erlang_node() :: atom()). +-type(load() :: {{non_neg_integer(), float()}, erlang_node()}). -spec(local_load/0 :: () -> load()). -spec(remote_loads/0 :: () -> [load()]). --spec(pick/0 :: () -> node()). +-spec(pick/0 :: () -> erlang_node()). -endif. diff --git a/src/rabbit_log.erl b/src/rabbit_log.erl index a8f839f0a6..f408336e94 100644 --- a/src/rabbit_log.erl +++ b/src/rabbit_log.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -32,7 +38,7 @@ -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). --export([debug/1, debug/2, info/1, info/2, +-export([debug/1, debug/2, message/4, info/1, info/2, warning/1, warning/2, error/1, error/2]). -import(io). @@ -67,6 +73,10 @@ debug(Fmt) -> debug(Fmt, Args) when is_list(Args) -> gen_server:cast(?SERVER, {debug, Fmt, Args}). +message(Direction, Channel, MethodRecord, Content) -> + gen_server:cast(?SERVER, + {message, Direction, Channel, MethodRecord, Content}). + info(Fmt) -> gen_server:cast(?SERVER, {info, Fmt}). @@ -100,6 +110,14 @@ handle_cast({debug, Fmt, Args}, State) -> io:format("debug:: "), io:format(Fmt, Args), error_logger:info_msg("debug:: " ++ Fmt, Args), {noreply, State}; +handle_cast({message, Direction, Channel, MethodRecord, Content}, State) -> + io:format("~s ch~p ~p~n", + [case Direction of + in -> "-->"; + out -> "<--" end, + Channel, + {MethodRecord, Content}]), + {noreply, State}; handle_cast({info, Fmt}, State) -> error_logger:info_msg(Fmt), {noreply, State}; diff --git a/src/rabbit_memsup_linux.erl b/src/rabbit_memsup_linux.erl new file mode 100644 index 0000000000..ffdc7e9946 --- /dev/null +++ b/src/rabbit_memsup_linux.erl @@ -0,0 +1,156 @@ +%% The contents of this file are subject to the Mozilla Public License +%% Version 1.1 (the "License"); you may not use this file except in +%% compliance with the License. You may obtain a copy of the License at +%% http://www.mozilla.org/MPL/ +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +%% License for the specific language governing rights and limitations +%% under the License. +%% +%% The Original Code is RabbitMQ. +%% +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. +%% +%% All Rights Reserved. +%% +%% Contributor(s): ______________________________________. +%% + +-module(rabbit_memsup_linux). + +-behaviour(gen_server). + +-export([start_link/0]). + +-export([init/1, handle_call/3, handle_cast/2, handle_info/2, + terminate/2, code_change/3]). + +-export([update/0]). + +-define(SERVER, memsup). %% must be the same as the standard memsup + +-define(DEFAULT_MEMORY_CHECK_INTERVAL, 1000). + +-record(state, {memory_fraction, alarmed, timeout, timer}). + +%%---------------------------------------------------------------------------- + +-ifdef(use_specs). + +-spec(start_link/0 :: () -> {'ok', pid()} | 'ignore' | {'error', any()}). +-spec(update/0 :: () -> 'ok'). + +-endif. + +%%---------------------------------------------------------------------------- + +start_link() -> + gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). + + +update() -> + gen_server:cast(?SERVER, update). + +%%---------------------------------------------------------------------------- + +init(_Args) -> + Fraction = os_mon:get_env(memsup, system_memory_high_watermark), + TRef = start_timer(?DEFAULT_MEMORY_CHECK_INTERVAL), + {ok, #state{alarmed = false, + memory_fraction = Fraction, + timeout = ?DEFAULT_MEMORY_CHECK_INTERVAL, + timer = TRef}}. + +start_timer(Timeout) -> + {ok, TRef} = timer:apply_interval(Timeout, ?MODULE, update, []), + TRef. + +%% Export the same API as the real memsup. Note that +%% get_sysmem_high_watermark gives an int in the range 0 - 100, while +%% set_sysmem_high_watermark takes a float in the range 0.0 - 1.0. +handle_call(get_sysmem_high_watermark, _From, State) -> + {reply, trunc(100 * State#state.memory_fraction), State}; + +handle_call({set_sysmem_high_watermark, Float}, _From, State) -> + {reply, ok, State#state{memory_fraction = Float}}; + +handle_call(get_check_interval, _From, State) -> + {reply, State#state.timeout, State}; + +handle_call({set_check_interval, Timeout}, _From, State) -> + {ok, cancel} = timer:cancel(State#state.timer), + {reply, ok, State#state{timeout = Timeout, timer = start_timer(Timeout)}}; + +handle_call(_Request, _From, State) -> + {noreply, State}. + +handle_cast(update, State = #state{alarmed = Alarmed, + memory_fraction = MemoryFraction}) -> + File = read_proc_file("/proc/meminfo"), + Lines = string:tokens(File, "\n"), + Dict = dict:from_list(lists:map(fun parse_line/1, Lines)), + MemTotal = dict:fetch('MemTotal', Dict), + MemUsed = MemTotal + - dict:fetch('MemFree', Dict) + - dict:fetch('Buffers', Dict) + - dict:fetch('Cached', Dict), + NewAlarmed = MemUsed / MemTotal > MemoryFraction, + case {Alarmed, NewAlarmed} of + {false, true} -> + alarm_handler:set_alarm({system_memory_high_watermark, []}); + {true, false} -> + alarm_handler:clear_alarm(system_memory_high_watermark); + _ -> + ok + end, + {noreply, State#state{alarmed = NewAlarmed}}; + +handle_cast(_Request, State) -> + {noreply, State}. + +handle_info(_Info, State) -> + {noreply, State}. + +terminate(_Reason, _State) -> + ok. + +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +%%---------------------------------------------------------------------------- + +-define(BUFFER_SIZE, 1024). + +%% file:read_file does not work on files in /proc as it seems to get +%% the size of the file first and then read that many bytes. But files +%% in /proc always have length 0, we just have to read until we get +%% eof. +read_proc_file(File) -> + {ok, IoDevice} = file:open(File, [read, raw]), + Res = read_proc_file(IoDevice, []), + file:close(IoDevice), + lists:flatten(lists:reverse(Res)). + +read_proc_file(IoDevice, Acc) -> + case file:read(IoDevice, ?BUFFER_SIZE) of + {ok, Res} -> read_proc_file(IoDevice, [Res | Acc]); + eof -> Acc + end. + +%% A line looks like "FooBar: 123456 kB" +parse_line(Line) -> + [Name, Value | _] = string:tokens(Line, ": "), + {list_to_atom(Name), list_to_integer(Value)}. diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 3c8da720ff..973e163b7a 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -42,7 +48,8 @@ -export([intersperse/2, upmap/2, map_in_order/2]). -export([guid/0, string_guid/1, binstring_guid/1]). -export([dirty_read_all/1, dirty_foreach_key/2, dirty_dump_log/1]). --export([append_file/2]). +-export([append_file/2, ensure_parent_dirs_exist/1]). +-export([format_stderr/2]). -import(mnesia). -import(lists). @@ -86,7 +93,7 @@ -spec(with_user_and_vhost/3 :: (username(), vhost(), thunk(A)) -> A). -spec(execute_mnesia_transaction/1 :: (thunk(A)) -> A). -spec(ensure_ok/2 :: ('ok' | {'error', any()}, atom()) -> 'ok'). --spec(localnode/1 :: (atom()) -> node()). +-spec(localnode/1 :: (atom()) -> erlang_node()). -spec(tcp_name/3 :: (atom(), ip_address(), ip_port()) -> atom()). -spec(intersperse/2 :: (A, [A]) -> [A]). -spec(upmap/2 :: (fun ((A) -> B), [A]) -> [B]). @@ -99,6 +106,8 @@ 'ok' | 'aborted'). -spec(dirty_dump_log/1 :: (string()) -> 'ok' | {'error', any()}). -spec(append_file/2 :: (string(), string()) -> 'ok' | {'error', any()}). +-spec(ensure_parent_dirs_exist/1 :: (string()) -> 'ok'). +-spec(format_stderr/2 :: (string(), [any()]) -> 'true'). -endif. @@ -377,3 +386,15 @@ append_file(File, _, Suffix) -> {ok, Data} -> file:write_file([File, Suffix], Data, [append]); Error -> Error end. + +ensure_parent_dirs_exist(Filename) -> + case filelib:ensure_dir(Filename) of + ok -> ok; + {error, Reason} -> + throw({error, {cannot_create_parent_dirs, Filename, Reason}}) + end. + +format_stderr(Fmt, Args) -> + Port = open_port({fd, 0, 2}, [out]), + port_command(Port, io_lib:format(Fmt, Args)), + port_close(Port). diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index 9b67135def..57dd92563d 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -30,6 +36,9 @@ -export([table_names/0]). +%% Called by rabbitmq-mnesia-current script +-export([schema_current/0]). + %% create_tables/0 exported for helping embed RabbitMQ in or alongside %% other mnesia-using Erlang applications, such as ejabberd -export([create_tables/0]). @@ -40,14 +49,15 @@ -ifdef(use_specs). --spec(status/0 :: () -> [{'nodes' | 'running_nodes', [node()]}]). +-spec(status/0 :: () -> [{'nodes' | 'running_nodes', [erlang_node()]}]). -spec(ensure_mnesia_dir/0 :: () -> 'ok'). -spec(init/0 :: () -> 'ok'). -spec(is_db_empty/0 :: () -> bool()). --spec(cluster/1 :: ([node()]) -> 'ok'). +-spec(cluster/1 :: ([erlang_node()]) -> 'ok'). -spec(reset/0 :: () -> 'ok'). -spec(force_reset/0 :: () -> 'ok'). -spec(create_tables/0 :: () -> 'ok'). +-spec(schema_current/0 :: () -> bool()). -endif. @@ -91,6 +101,20 @@ cluster(ClusterNodes) -> reset() -> reset(false). force_reset() -> reset(true). +%% This is invoked by rabbitmq-mnesia-current. +schema_current() -> + application:start(mnesia), + ok = ensure_mnesia_running(), + ok = ensure_mnesia_dir(), + ok = init_db(read_cluster_nodes_config()), + try + ensure_schema_integrity(), + true + catch + {error, {schema_integrity_check_failed, _Reason}} -> + false + end. + %%-------------------------------------------------------------------- table_definitions() -> diff --git a/src/rabbit_multi.erl b/src/rabbit_multi.erl index c6a7e9200d..e5b5960363 100644 --- a/src/rabbit_multi.erl +++ b/src/rabbit_multi.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -46,18 +52,22 @@ start() -> io:format("done.~n"), init:stop(); {'EXIT', {function_clause, [{?MODULE, action, _} | _]}} -> - io:format("Invalid command ~p~n", [FullCommand]), + error("invalid command '~s'", + [lists:flatten( + rabbit_misc:intersperse(" ", FullCommand))]), usage(); timeout -> - io:format("timeout starting some nodes.~n"), + error("timeout starting some nodes.", []), halt(1); Other -> - io:format("~nrabbit_multi action ~p failed:~n~p~n", - [Command, Other]), + error("~p", [Other]), halt(2) end end. +error(Format, Args) -> + rabbit_misc:format_stderr("Error: " ++ Format ++ "~n", Args). + parse_args([Command | Args]) -> {list_to_atom(Command), Args}. @@ -223,8 +233,7 @@ write_pids_file(Pids) -> {ok, Device} -> Device; {error, Reason} -> - throw({error, {cannot_create_pids_file, - FileName, Reason}}) + throw({cannot_create_pids_file, FileName, Reason}) end, try ok = io:write(Handle, Pids), @@ -233,8 +242,7 @@ write_pids_file(Pids) -> case file:close(Handle) of ok -> ok; {error, Reason1} -> - throw({error, {cannot_create_pids_file, - FileName, Reason1}}) + throw({cannot_create_pids_file, FileName, Reason1}) end end, ok. @@ -244,8 +252,7 @@ delete_pids_file() -> case file:delete(FileName) of ok -> ok; {error, enoent} -> ok; - {error, Reason} -> throw({error, {cannot_delete_pids_file, - FileName, Reason}}) + {error, Reason} -> throw({cannot_delete_pids_file, FileName, Reason}) end. read_pids_file() -> @@ -253,8 +260,7 @@ read_pids_file() -> case file:consult(FileName) of {ok, [Pids]} -> Pids; {error, enoent} -> []; - {error, Reason} -> throw({error, {cannot_read_pids_file, - FileName, Reason}}) + {error, Reason} -> throw({cannot_read_pids_file, FileName, Reason}) end. kill_wait(Pid, TimeLeft, Forceful) when TimeLeft < 0 -> diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl index 2ed57d7783..99ea37d884 100644 --- a/src/rabbit_networking.erl +++ b/src/rabbit_networking.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -48,13 +54,13 @@ -spec(start_tcp_listener/2 :: (host(), ip_port()) -> 'ok'). -spec(stop_tcp_listener/2 :: (host(), ip_port()) -> 'ok'). -spec(active_listeners/0 :: () -> [listener()]). --spec(node_listeners/1 :: (node()) -> [listener()]). +-spec(node_listeners/1 :: (erlang_node()) -> [listener()]). -spec(connections/0 :: () -> [connection()]). -spec(connection_info/1 :: (connection()) -> [info()]). -spec(connection_info/2 :: (connection(), [info_key()]) -> [info()]). -spec(connection_info_all/0 :: () -> [[info()]]). -spec(connection_info_all/1 :: ([info_key()]) -> [[info()]]). --spec(on_node_down/1 :: (node()) -> 'ok'). +-spec(on_node_down/1 :: (erlang_node()) -> 'ok'). -spec(check_tcp_listener_address/3 :: (atom(), host(), ip_port()) -> {ip_address(), atom()}). diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index 2fb582a9b9..14a69a472e 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_persister.erl b/src/rabbit_persister.erl index 91016d9d63..c34ad85100 100644 --- a/src/rabbit_persister.erl +++ b/src/rabbit_persister.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index da8651da8f..10c6e0ca09 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_router.erl b/src/rabbit_router.erl index a233764766..ad653a2f2a 100644 --- a/src/rabbit_router.erl +++ b/src/rabbit_router.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -36,6 +42,9 @@ -define(SERVER, ?MODULE). +%% cross-node routing optimisation is disabled because of bug 19758. +-define(BUG19758, true). + %%---------------------------------------------------------------------------- -ifdef(use_specs). @@ -51,6 +60,14 @@ start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). +-ifdef(BUG19758). + +deliver(QPids, Mandatory, Immediate, Txn, Message) -> + check_delivery(Mandatory, Immediate, + run_bindings(QPids, Mandatory, Immediate, Txn, Message)). + +-else. + deliver(QPids, Mandatory, Immediate, Txn, Message) -> %% we reduce inter-node traffic by grouping the qpids by node and %% only delivering one copy of the message to each node involved, @@ -114,6 +131,8 @@ deliver_per_node(NodeQPids, Mandatory, Immediate, R), check_delivery(Mandatory, Immediate, {Routed, lists:append(Handled)}). +-endif. + %%-------------------------------------------------------------------- init([]) -> diff --git a/src/rabbit_sasl_report_file_h.erl b/src/rabbit_sasl_report_file_h.erl index 3374d63d0b..9e4c9c8a31 100644 --- a/src/rabbit_sasl_report_file_h.erl +++ b/src/rabbit_sasl_report_file_h.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -54,9 +60,11 @@ init({{File, _}, error}) -> %% doing any log rotation init({File, []}) -> init(File); -init({_File, _Type} = FileInfo) -> +init({File, _Type} = FileInfo) -> + rabbit_misc:ensure_parent_dirs_exist(File), sasl_report_file_h:init(FileInfo); init(File) -> + rabbit_misc:ensure_parent_dirs_exist(File), sasl_report_file_h:init({File, sasl_error_logger_type()}). handle_event(Event, State) -> @@ -71,8 +79,9 @@ handle_call(Event, State) -> terminate(Reason, State) -> sasl_report_file_h:terminate(Reason, State). -code_change(OldVsn, State, Extra) -> - sasl_report_file_h:code_change(OldVsn, State, Extra). +code_change(_OldVsn, State, _Extra) -> + %% There is no sasl_report_file_h:code_change/3 + {ok, State}. %%---------------------------------------------------------------------- diff --git a/src/rabbit_sup.erl b/src/rabbit_sup.erl index ea55869004..730d7909bc 100644 --- a/src/rabbit_sup.erl +++ b/src/rabbit_sup.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index fff02d7363..3bba661a08 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -131,6 +137,8 @@ test_topic_matching() -> passed. test_app_management() -> + true = rabbit_mnesia:schema_current(), + %% starting, stopping, status ok = control_action(stop_app, []), ok = control_action(stop_app, []), @@ -236,25 +244,51 @@ test_log_management_during_startup() -> ok = error_logger:tty(false), ok = delete_log_handlers([sasl_report_tty_h]), ok = case catch control_action(start_app, []) of - ok -> exit(got_success_but_expected_failure); - {error, {cannot_log_to_tty, _, _}} -> ok - end, + ok -> exit({got_success_but_expected_failure, + log_rotation_tty_no_handlers_test}); + {error, {cannot_log_to_tty, _, _}} -> ok + end, %% fix sasl logging ok = application:set_env(sasl, sasl_error_logger, {file, SaslLog}), - %% start application with logging to invalid directory + %% start application with logging to non-existing directory TmpLog = "/tmp/rabbit-tests/test.log", - file:delete(TmpLog), + delete_file(TmpLog), ok = application:set_env(kernel, error_logger, {file, TmpLog}), ok = delete_log_handlers([rabbit_error_logger_file_h]), ok = add_log_handlers([{error_logger_file_h, MainLog}]), - ok = case catch control_action(start_app, []) of - ok -> exit(got_success_but_expected_failure); - {error, {cannot_log_to_file, _, _}} -> ok - end, + ok = control_action(start_app, []), + + %% start application with logging to directory with no + %% write permissions + TmpDir = "/tmp/rabbit-tests", + ok = set_permissions(TmpDir, 8#00400), + ok = delete_log_handlers([rabbit_error_logger_file_h]), + ok = add_log_handlers([{error_logger_file_h, MainLog}]), + ok = case control_action(start_app, []) of + ok -> exit({got_success_but_expected_failure, + log_rotation_no_write_permission_dir_test}); + {error, {cannot_log_to_file, _, _}} -> ok + end, + + %% start application with logging to a subdirectory which + %% parent directory has no write permissions + TmpTestDir = "/tmp/rabbit-tests/no-permission/test/log", + ok = application:set_env(kernel, error_logger, {file, TmpTestDir}), + ok = add_log_handlers([{error_logger_file_h, MainLog}]), + ok = case control_action(start_app, []) of + ok -> exit({got_success_but_expected_failure, + log_rotatation_parent_dirs_test}); + {error, {cannot_log_to_file, _, + {error, {cannot_create_parent_dirs, _, eacces}}}} -> ok + end, + ok = set_permissions(TmpDir, 8#00700), + ok = set_permissions(TmpLog, 8#00600), + ok = delete_file(TmpLog), + ok = file:del_dir(TmpDir), %% start application with standard error_logger_file_h %% handler not installed @@ -465,7 +499,7 @@ test_user_management() -> control_action(Command, Args) -> control_action(Command, node(), Args). control_action(Command, Node, Args) -> - case catch rabbit_control:action(Command, Node, Args) of + case catch rabbit_control:action(Command, Node, Args, fun io:format/2) of ok -> io:format("done.~n"), ok; @@ -494,6 +528,14 @@ test_logs_working(MainLogFile, SaslLogFile) -> [true, true] = non_empty_files([MainLogFile, SaslLogFile]), ok. +set_permissions(Path, Mode) -> + case file:read_file_info(Path) of + {ok, FInfo} -> file:write_file_info( + Path, + FInfo#file_info{mode=Mode}); + Error -> Error + end. + clean_logs(Files, Suffix) -> [begin ok = delete_file(File), diff --git a/src/rabbit_tracer.erl b/src/rabbit_tracer.erl index 5365b8732f..0c023f2aab 100644 --- a/src/rabbit_tracer.erl +++ b/src/rabbit_tracer.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl index a2688625be..9cf9f8aef9 100644 --- a/src/rabbit_writer.erl +++ b/src/rabbit_writer.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/tcp_acceptor.erl b/src/tcp_acceptor.erl index 3e4c5ee423..aa8b8ad5a7 100644 --- a/src/tcp_acceptor.erl +++ b/src/tcp_acceptor.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/tcp_acceptor_sup.erl b/src/tcp_acceptor_sup.erl index a3144e410c..f2bad5bc2e 100644 --- a/src/tcp_acceptor_sup.erl +++ b/src/tcp_acceptor_sup.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/tcp_client_sup.erl b/src/tcp_client_sup.erl index 4e1b9c6b30..d92066a6c3 100644 --- a/src/tcp_client_sup.erl +++ b/src/tcp_client_sup.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/tcp_listener.erl b/src/tcp_listener.erl index dc38b5941c..92a47cf127 100644 --- a/src/tcp_listener.erl +++ b/src/tcp_listener.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/tcp_listener_sup.erl b/src/tcp_listener_sup.erl index 9347240668..901a0da3b7 100644 --- a/src/tcp_listener_sup.erl +++ b/src/tcp_listener_sup.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% |
