summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2016-03-02 19:30:42 +0300
committerMichael Klishin <michael@clojurewerkz.org>2016-03-02 19:30:42 +0300
commit188d7a06e21d75220d0d0a718164f717a92cb70e (patch)
tree1b0d78fe3bcdafa0077e8d34c0820777b7a25adb
parent11a09bd729af49e843ddefec8d82425111f7a972 (diff)
parentc2b0c69b4d6eb366c215933e0d8320f2b66bc4ab (diff)
downloadrabbitmq-server-git-188d7a06e21d75220d0d0a718164f717a92cb70e.tar.gz
Merge branch 'stable' into rabbitmq-server-398
-rw-r--r--.gitignore3
-rw-r--r--Makefile13
-rw-r--r--docs/rabbitmqctl.1.xml46
-rw-r--r--packaging/RPMS/Fedora/rabbitmq-server.spec3
-rw-r--r--packaging/debs/Debian/debian/changelog6
-rw-r--r--packaging/windows-exe/rabbitmq_nsi.in2
-rwxr-xr-xscripts/rabbitmq-server-ha.ocf154
-rw-r--r--src/rabbit.app.src5
-rw-r--r--src/rabbit_control_main.erl97
9 files changed, 194 insertions, 135 deletions
diff --git a/.gitignore b/.gitignore
index 4a613c6d54..3e0b548789 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
*.beam
.erlang.mk/
cover/
+debug/
deps/
doc/
ebin/
@@ -11,6 +12,8 @@ etc/
logs/
plugins/
+PACKAGES/
+
rabbit.d
# Generated sources files.
diff --git a/Makefile b/Makefile
index fb5155f077..833334dcd6 100644
--- a/Makefile
+++ b/Makefile
@@ -132,7 +132,8 @@ $(TARGETS_IN_RABBITMQ_TEST): $(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST) \
grep -E '^xmlto version 0\.0\.([0-9]|1[1-8])$$' >/dev/null || \
opt='--stringparam man.indent.verbatims=0' ; \
xsltproc --novalid $(DOCS_DIR)/examples-to-end.xsl $< > $<.tmp && \
- (xmlto -o $(DOCS_DIR) $$opt man $< 2>&1 | (grep -qv '^Note: Writing' || :)) && \
+ xmlto -vv -o $(DOCS_DIR) $$opt man $< 2>&1 | (grep -v '^Note: Writing' || :) && \
+ test -f $@ && \
rm $<.tmp
# Use tmp files rather than a pipeline so that we get meaningful errors
@@ -388,12 +389,12 @@ install-man: manpages
$(inst_verbose) sections=$$(ls -1 docs/*.[1-9] \
| sed -E 's/.*\.([1-9])$$/\1/' | uniq | sort); \
for section in $$sections; do \
- mkdir -p $(DESTDIR)$(MANDIR)/man$$section; \
- for manpage in $(DOCS_DIR)/*.$$section; do \
- gzip < $$manpage \
+ mkdir -p $(DESTDIR)$(MANDIR)/man$$section; \
+ for manpage in $(DOCS_DIR)/*.$$section; do \
+ gzip < $$manpage \
> $(DESTDIR)$(MANDIR)/man$$section/$$(basename $$manpage).gz; \
- done; \
- done
+ done; \
+ done
install-windows: install-windows-erlapp install-windows-scripts install-windows-docs
diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml
index 0d87f4bafb..1ecf8d4d3a 100644
--- a/docs/rabbitmqctl.1.xml
+++ b/docs/rabbitmqctl.1.xml
@@ -540,7 +540,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>sync_queue</command> <arg choice="req">queue</arg></cmdsynopsis>
+ <term><cmdsynopsis><command>sync_queue</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="req">queue</arg></cmdsynopsis>
</term>
<listitem>
<variablelist>
@@ -569,7 +569,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>cancel_sync_queue</command> <arg choice="req">queue</arg></cmdsynopsis>
+ <term><cmdsynopsis><command>cancel_sync_queue</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="req">queue</arg></cmdsynopsis>
</term>
<listitem>
<variablelist>
@@ -589,7 +589,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>purge_queue</command> <arg choice="req">queue</arg></cmdsynopsis>
+ <term><cmdsynopsis><command>purge_queue</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="req">queue</arg></cmdsynopsis>
</term>
<listitem>
<variablelist>
@@ -808,11 +808,11 @@
</para>
<variablelist>
<varlistentry>
- <term><cmdsynopsis><command>add_vhost</command> <arg choice="req"><replaceable>vhostpath</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>add_vhost</command> <arg choice="req"><replaceable>vhost</replaceable></arg></cmdsynopsis></term>
<listitem>
<variablelist>
<varlistentry>
- <term>vhostpath</term>
+ <term>vhost</term>
<listitem><para>The name of the virtual host entry to create.</para></listitem>
</varlistentry>
</variablelist>
@@ -829,11 +829,11 @@
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>delete_vhost</command> <arg choice="req"><replaceable>vhostpath</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>delete_vhost</command> <arg choice="req"><replaceable>vhost</replaceable></arg></cmdsynopsis></term>
<listitem>
<variablelist>
<varlistentry>
- <term>vhostpath</term>
+ <term>vhost</term>
<listitem><para>The name of the virtual host entry to delete.</para></listitem>
</varlistentry>
</variablelist>
@@ -890,11 +890,11 @@
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>set_permissions</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="req"><replaceable>user</replaceable></arg> <arg choice="req"><replaceable>conf</replaceable></arg> <arg choice="req"><replaceable>write</replaceable></arg> <arg choice="req"><replaceable>read</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>set_permissions</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="req"><replaceable>user</replaceable></arg> <arg choice="req"><replaceable>conf</replaceable></arg> <arg choice="req"><replaceable>write</replaceable></arg> <arg choice="req"><replaceable>read</replaceable></arg></cmdsynopsis></term>
<listitem>
<variablelist>
<varlistentry>
- <term>vhostpath</term>
+ <term>vhost</term>
<listitem><para>The name of the virtual host to which to grant the user access, defaulting to <command>/</command>.</para></listitem>
</varlistentry>
<varlistentry>
@@ -930,11 +930,11 @@
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>clear_permissions</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="req"><replaceable>username</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>clear_permissions</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="req"><replaceable>username</replaceable></arg></cmdsynopsis></term>
<listitem>
<variablelist>
<varlistentry>
- <term>vhostpath</term>
+ <term>vhost</term>
<listitem><para>The name of the virtual host to which to deny the user access, defaulting to <command>/</command>.</para></listitem>
</varlistentry>
<varlistentry>
@@ -956,11 +956,11 @@
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>list_permissions</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>list_permissions</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg></cmdsynopsis></term>
<listitem>
<variablelist>
<varlistentry>
- <term>vhostpath</term>
+ <term>vhost</term>
<listitem><para>The name of the virtual host for which to list the users that have been granted access to it, and their permissions. Defaults to <command>/</command>.</para></listitem>
</varlistentry>
</variablelist>
@@ -1020,7 +1020,7 @@
</para>
<variablelist>
<varlistentry>
- <term><cmdsynopsis><command>set_parameter</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="req"><replaceable>component_name</replaceable></arg> <arg choice="req"><replaceable>name</replaceable></arg> <arg choice="req"><replaceable>value</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>set_parameter</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="req"><replaceable>component_name</replaceable></arg> <arg choice="req"><replaceable>name</replaceable></arg> <arg choice="req"><replaceable>value</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
Sets a parameter.
@@ -1056,7 +1056,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>clear_parameter</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="req"><replaceable>component_name</replaceable></arg> <arg choice="req"><replaceable>key</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>clear_parameter</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="req"><replaceable>component_name</replaceable></arg> <arg choice="req"><replaceable>key</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
Clears a parameter.
@@ -1084,7 +1084,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>list_parameters</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>list_parameters</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
Lists all parameters for a virtual host.
@@ -1109,7 +1109,7 @@
</para>
<variablelist>
<varlistentry>
- <term><cmdsynopsis><command>set_policy</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="opt">--priority <replaceable>priority</replaceable></arg> <arg choice="opt">--apply-to <replaceable>apply-to</replaceable></arg> <arg choice="req"><replaceable>name</replaceable></arg> <arg choice="req"><replaceable>pattern</replaceable></arg> <arg choice="req"><replaceable>definition</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>set_policy</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="opt">--priority <replaceable>priority</replaceable></arg> <arg choice="opt">--apply-to <replaceable>apply-to</replaceable></arg> <arg choice="req"><replaceable>name</replaceable></arg> <arg choice="req"><replaceable>pattern</replaceable></arg> <arg choice="req"><replaceable>definition</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
Sets a policy.
@@ -1156,7 +1156,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>clear_policy</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="req"><replaceable>name</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>clear_policy</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="req"><replaceable>name</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
Clears a policy.
@@ -1177,7 +1177,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>list_policies</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>list_policies</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
Lists all policies for a virtual host.
@@ -1210,7 +1210,7 @@
<variablelist>
<varlistentry role="usage-has-option-list">
- <term><cmdsynopsis><command>list_queues</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="opt" role="usage-option-list"><replaceable>queueinfoitem</replaceable> ...</arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>list_queues</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="opt" role="usage-option-list"><replaceable>queueinfoitem</replaceable> ...</arg></cmdsynopsis></term>
<listitem>
<para>
Returns queue details. Queue details of the <command>/</command> virtual host
@@ -1386,7 +1386,7 @@
</varlistentry>
<varlistentry role="usage-has-option-list">
- <term><cmdsynopsis><command>list_exchanges</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="opt" role="usage-option-list"><replaceable>exchangeinfoitem</replaceable> ...</arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>list_exchanges</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="opt" role="usage-option-list"><replaceable>exchangeinfoitem</replaceable> ...</arg></cmdsynopsis></term>
<listitem>
<para>
Returns exchange details. Exchange details of the <command>/</command> virtual host
@@ -1449,7 +1449,7 @@
</varlistentry>
<varlistentry role="usage-has-option-list">
- <term><cmdsynopsis><command>list_bindings</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="opt" role="usage-option-list"><replaceable>bindinginfoitem</replaceable> ...</arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>list_bindings</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg> <arg choice="opt" role="usage-option-list"><replaceable>bindinginfoitem</replaceable> ...</arg></cmdsynopsis></term>
<listitem>
<para>
Returns binding details. By default the bindings for
@@ -1791,7 +1791,7 @@
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>list_consumers</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>list_consumers</command> <arg choice="opt">-p <replaceable>vhost</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
List consumers, i.e. subscriptions to a queue's message
diff --git a/packaging/RPMS/Fedora/rabbitmq-server.spec b/packaging/RPMS/Fedora/rabbitmq-server.spec
index 7cf3177400..2826ad3ffc 100644
--- a/packaging/RPMS/Fedora/rabbitmq-server.spec
+++ b/packaging/RPMS/Fedora/rabbitmq-server.spec
@@ -130,6 +130,9 @@ done
rm -rf %{buildroot}
%changelog
+* Tue Mar 1 2016 michael@rabbitmq.com 3.6.1-1
+- New Upstream Release
+
* Tue Dec 22 2015 michael@rabbitmq.com 3.6.0-1
- New Upstream Release
diff --git a/packaging/debs/Debian/debian/changelog b/packaging/debs/Debian/debian/changelog
index 372afa8258..adf8ce5aa5 100644
--- a/packaging/debs/Debian/debian/changelog
+++ b/packaging/debs/Debian/debian/changelog
@@ -1,3 +1,9 @@
+rabbitmq-server (3.6.1-1) unstable; urgency=low
+
+ * New Upstream Release
+
+ -- Michael Klishin <michael@rabbitmq.com> Tue, 01 Mar 2016 13:19:57 +0000
+
rabbitmq-server (3.6.0-1) unstable; urgency=low
* New Upstream Release
diff --git a/packaging/windows-exe/rabbitmq_nsi.in b/packaging/windows-exe/rabbitmq_nsi.in
index 3c868b91e7..e66d2a99ed 100644
--- a/packaging/windows-exe/rabbitmq_nsi.in
+++ b/packaging/windows-exe/rabbitmq_nsi.in
@@ -10,6 +10,8 @@
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
!define uninstall "Software\Microsoft\Windows\CurrentVersion\Uninstall\RabbitMQ"
+!define MUI_FINISHPAGE_NOAUTOCLOSE
+!define MUI_UNFINISHPAGE_NOAUTOCLOSE
;--------------------------------
; Third-party functions
diff --git a/scripts/rabbitmq-server-ha.ocf b/scripts/rabbitmq-server-ha.ocf
index 5505c10581..16fba44290 100755
--- a/scripts/rabbitmq-server-ha.ocf
+++ b/scripts/rabbitmq-server-ha.ocf
@@ -45,7 +45,7 @@ OCF_RESKEY_erlang_cookie_default=false
OCF_RESKEY_erlang_cookie_file_default="/var/lib/rabbitmq/.erlang.cookie"
OCF_RESKEY_use_fqdn_default=false
OCF_RESKEY_fqdn_prefix_default=""
-OCF_RESKEY_max_rabbitmqctl_timeouts_default=1
+OCF_RESKEY_max_rabbitmqctl_timeouts_default=3
: ${HA_LOGTAG="lrmd"}
: ${HA_LOGFACILITY="daemon"}
@@ -752,6 +752,31 @@ get_alive_pacemaker_nodes_but()
fi
}
+# Get current master. If a parameter is provided,
+# do not check node with that name
+get_master_name_but()
+{
+ local node
+ for node in $(get_alive_pacemaker_nodes_but "$@")
+ do
+ ocf_log info "${LH} looking if $node is master"
+
+ if is_master $node; then
+ ocf_log info "${LH} master is $node"
+ echo $node
+ break
+ fi
+ done
+}
+
+# Returns 0 if we are clustered with provideded node
+is_clustered_with()
+{
+ get_running_nodes | grep -q $(rabbit_node_name $1);
+ return $?
+}
+
+
check_need_join_to() {
local join_to
local node
@@ -929,9 +954,10 @@ unjoin_nodes_from_cluster() {
local tries=0
until [ $tries -eq 5 ]; do
tries=$((tries+1))
- if get_running_nodes | grep -q $(rabbit_node_name $nodename)
- then
+ if is_clustered_with $nodename; then
ocf_log info "${LH} the ${nodename} is alive and cannot be kicked from the cluster yet"
+ else
+ break
fi
sleep 10
done
@@ -1321,18 +1347,18 @@ is_master() {
# separately. The second argument is used to distingush them.
check_timeouts() {
local op_rc=$1
- local crm_attr_name=$2
+ local timeouts_attr_name=$2
local op_name=$3
if [ $op_rc -ne 124 -a $op_rc -ne 137 ]; then
- ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name $crm_attr_name --update 0
+ ocf_run attrd_updater -p --name $timeouts_attr_name --update 0
return 0
fi
local count
- count=`crm_attribute -N $THIS_PCMK_NODE -l reboot --name $crm_attr_name --query 2>/dev/null`
+ count=`attrd_updater --name $timeouts_attr_name --query 2>/dev/null`
if [ $? -ne 0 ]; then
- # the crm_attribute exited with error. In that case most probably it printed garbage
+ # the attrd_updater exited with error. In that case most probably it printed garbage
# instead of the number we need. So defensively assume that it is zero.
count=0
@@ -1341,9 +1367,9 @@ check_timeouts() {
count=$((count+1))
# There is a slight chance that this piece of code will be executed twice simultaneously.
- # As a result, $crm_attr_name's value will be one less than it should be. But we don't need
+ # As a result, $timeouts_attr_name's value will be one less than it should be. But we don't need
# precise calculation here.
- ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name $crm_attr_name --update $count
+ ocf_run attrd_updater -p --name $timeouts_attr_name --update $count
if [ $count -lt $OCF_RESKEY_max_rabbitmqctl_timeouts ]; then
ocf_log warn "${LH} 'rabbitmqctl $op_name' timed out $count of max. $OCF_RESKEY_max_rabbitmqctl_timeouts time(s) in a row. Doing nothing for now."
@@ -1371,7 +1397,6 @@ get_monitor() {
local name
local node
local nodelist
- local rc_check=$OCF_SUCCESS
local max
local our_uptime
local node_uptime
@@ -1408,58 +1433,47 @@ get_monitor() {
if [ $rabbit_running -eq $OCF_SUCCESS ]
then
- ocf_log info "${LH} rabbit app is running. checking if we are the part of healthy cluster"
+ ocf_log info "${LH} rabbit app is running. checking if we are the part of healthy cluster"
+
+ if [ $rc -eq $OCF_RUNNING_MASTER ] ; then
+ # The master is always running inside of its cluster
+ ocf_log info "${LH} rabbit app is running and is master of cluster"
+
+ else
+ local master_name=$(get_master_name_but $THIS_PCMK_NODE)
+
+ if [ -z "$master_name" ]; then
+ ocf_log info "${LH} no master is elected currently. Skipping cluster health check."
+
+ elif is_clustered_with $master_name; then
+ ocf_log info "${LH} rabbit app is running and is member of healthy cluster"
- if [ $rc -eq $OCF_RUNNING_MASTER ] ; then
- # The master is always running inside of its cluster
- ocf_log info "${LH} rabbit app is running and is master of cluster"
- rc_check=$OCF_SUCCESS
else
- rc_check=$OCF_ERR_GENERIC
- nodelist=$(get_alive_pacemaker_nodes_but)
- for node in $nodelist
- do
- ocf_log info "${LH} rabbit app is running. looking for master on $node"
- is_master $node
- status_master=$?
- ocf_log info "${LH} fetched master attribute for $node. attr value is ${status_master}"
- if [ $status_master -eq 0 ] ; then
- ocf_log info "${LH} rabbit app is running. master is $node"
- if get_running_nodes | grep -q $(rabbit_node_name $node)
- then
- ocf_log info "${LH} rabbit app is running and is member of healthy cluster"
- rc_check=$OCF_SUCCESS
- break
- fi
- fi
- done
- [ $rc_check -eq $OCF_ERR_GENERIC ] && ocf_log err "${LH} rabbit node is running out of the cluster"
+ # Rabbit is running but is not connected to master
+ # Failing to avoid split brain
+ ocf_log err "${LH} rabbit node is running out of the cluster"
+ rc=$OCF_ERR_GENERIC
fi
+ fi
else
- if [ "$OCF_CHECK_LEVEL" -gt 20 ]; then
+ if [ "$OCF_CHECK_LEVEL" -gt 20 ]; then
ocf_log info "${LH} rabbit app is not running. checking if there is a master"
# Do not refetch the master status as we know it already
if [ $rc -eq $OCF_RUNNING_MASTER ]; then
ocf_log err "${LH} we are the master and rabbit app is not running. this is a failure"
exit $OCF_FAILED_MASTER
fi
- nodelist=$(get_alive_pacemaker_nodes_but $THIS_PCMK_NODE)
- rc_check=$OCF_SUCCESS
- for node in $nodelist
- do
- is_master $node
- status_master=$?
- ocf_log info "${LH} fetched master attribute for $node. attr value is ${status_master}"
- if [ $status_master -eq 0 ] ; then
- rc_check=$OCF_ERR_GENERIC
- ocf_log info "${LH} rabbit app is not running. master is $node. exiting to be restarted by pacemaker"
- break
- fi
- done
- fi
+
+ local master_name=$(get_master_name_but $THIS_PCMK_NODE)
+
+ if [ -n "$master_name" ]; then
+ ocf_log info "${LH} master exists and rabbit app is not running. Exiting to be restarted by pacemaker"
+ rc=$OCF_ERR_GENERIC
+ fi
+ fi
fi
- if [ $rc -eq $OCF_ERR_GENERIC -o $rc_check -eq $OCF_ERR_GENERIC ]; then
+ if [ $rc -eq $OCF_ERR_GENERIC ]; then
ocf_log err "${LH} get_status() returns generic error ${rc}"
ocf_log info "${LH} ensuring this slave does not get promoted."
master_score 0
@@ -1643,9 +1657,9 @@ action_start() {
return $OCF_SUCCESS
fi
- ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name 'rabbit_list_channels_timeouts' --update '0'
- ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name 'rabbit_get_alarms_timeouts' --update '0'
- ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name 'rabbit_list_queues_timeouts' --update '0'
+ ocf_run attrd_updater -p --name 'rabbit_list_channels_timeouts' --update '0'
+ ocf_run attrd_updater -p --name 'rabbit_get_alarms_timeouts' --update '0'
+ ocf_run attrd_updater -p --name 'rabbit_list_queues_timeouts' --update '0'
ocf_log info "${LH} Deleting start time attribute"
ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name 'rabbit-start-time' --delete
ocf_log info "${LH} Deleting master attribute"
@@ -1887,23 +1901,33 @@ action_notify() {
case "$OCF_RESKEY_CRM_meta_notify_operation" in
promote)
ocf_log info "${LH} post-promote begin."
+
+ rc=$OCF_SUCCESS
+
# Do nothing, if the list of nodes being promoted reported empty.
# Delegate recovery, if needed, to the "running out of the cluster" monitor's logic
if [ -z "${OCF_RESKEY_CRM_meta_notify_promote_uname}" ] ; then
- ocf_log warn "${LH} there are no nodes to join to reported on post-promote. Nothing to do."
- ocf_log info "${LH} post-promote end."
- return $OCF_SUCCESS
+ ocf_log warn "${LH} there are no nodes to join to reported on post-promote. Nothing to do."
+
+ elif my_host "${OCF_RESKEY_CRM_meta_notify_promote_uname}"; then
+ ocf_log info "${LH} ignoring post-promote of self"
+
+ elif is_clustered_with "${OCF_RESKEY_CRM_meta_notify_promote_uname}"; then
+ ocf_log info "${LH} we are already clustered with master - ${OCF_RESKEY_CRM_meta_notify_promote_uname}. Nothing to do."
+
+ else
+ # Note, this should fail when the mnesia is inconsistent.
+ # For example, when the "old" master processing the promition of the new one.
+ # Later this ex-master node will rejoin the cluster at post-start.
+ jjj_join "${OCF_RESKEY_CRM_meta_notify_promote_uname}"
+ rc=$?
+ if [ $rc -eq $OCF_ERR_GENERIC ] ; then
+ ocf_log err "${LH} Failed to join the cluster on post-promote. The resource will be restarted."
+ fi
fi
- # Note, this should fail when the mnesia is inconsistent.
- # For example, when the "old" master processing the promition of the new one.
- # Later this ex-master node will rejoin the cluster at post-start.
- jjj_join "${OCF_RESKEY_CRM_meta_notify_promote_uname}"
- rc=$?
+
ocf_log info "${LH} post-promote end."
- if [ $rc -eq $OCF_ERR_GENERIC ] ; then
- ocf_log err "${LH} Failed to join the cluster on post-promote. The resource will be restarted."
- return $OCF_ERR_GENERIC
- fi
+ return $rc
;;
start)
ocf_log info "${LH} post-start begin."
diff --git a/src/rabbit.app.src b/src/rabbit.app.src
index 4ee0191138..572c1f6bc6 100644
--- a/src/rabbit.app.src
+++ b/src/rabbit.app.src
@@ -95,5 +95,8 @@
{msg_store_credit_disc_bound, {2000, 500}},
{msg_store_io_batch_size, 2048},
%% see rabbitmq-server#143
- {credit_flow_default_credit, {200, 50}}
+ {credit_flow_default_credit, {200, 50}},
+ %% see rabbitmq-server#248
+ %% and rabbitmq-server#667
+ {channel_operation_timeout, 15000}
]}]}.
diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl
index c3322d371f..b805d21e48 100644
--- a/src/rabbit_control_main.erl
+++ b/src/rabbit_control_main.erl
@@ -583,7 +583,8 @@ action(list_permissions, Node, [], Opts, Inform, Timeout) ->
VHost = proplists:get_value(?VHOST_OPT, Opts),
Inform("Listing permissions in vhost \"~s\"", [VHost]),
call(Node, {rabbit_auth_backend_internal, list_vhost_permissions, [VHost]},
- rabbit_auth_backend_internal:vhost_perms_info_keys(), true, Timeout);
+ rabbit_auth_backend_internal:vhost_perms_info_keys(), true, Timeout,
+ true);
action(list_parameters, Node, [], Opts, Inform, Timeout) ->
VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)),
@@ -608,7 +609,8 @@ action(list_user_permissions, _Node, _Args = [], _Opts, _Inform, _Timeout) ->
action(list_user_permissions, Node, Args = [_Username], _Opts, Inform, Timeout) ->
Inform("Listing permissions for user ~p", Args),
call(Node, {rabbit_auth_backend_internal, list_user_permissions, Args},
- rabbit_auth_backend_internal:user_perms_info_keys(), true, Timeout);
+ rabbit_auth_backend_internal:user_perms_info_keys(), true, Timeout,
+ true);
action(list_queues, Node, Args, Opts, Inform, Timeout) ->
Inform("Listing queues", []),
@@ -751,20 +753,22 @@ default_if_empty(List, Default) when is_list(List) ->
true -> [list_to_atom(X) || X <- List]
end.
-display_info_message(Result, InfoItemKeys) ->
- display_row([format_info_item(
- case proplists:lookup(X, Result) of
- none when is_list(Result), length(Result) > 0 ->
- exit({error, {bad_info_key, X}});
- none -> Result;
- {X, Value} -> Value
- end) || X <- InfoItemKeys]).
+display_info_message(IsEscaped) ->
+ fun(Result, InfoItemKeys) ->
+ display_row([format_info_item(
+ case proplists:lookup(X, Result) of
+ none when is_list(Result), length(Result) > 0 ->
+ exit({error, {bad_info_key, X}});
+ none -> Result;
+ {X, Value} -> Value
+ end, IsEscaped) || X <- InfoItemKeys])
+ end.
display_info_list(Results, InfoItemKeys) when is_list(Results) ->
lists:foreach(
fun (Result) -> display_row(
- [format_info_item(proplists:get_value(X, Result)) ||
- X <- InfoItemKeys])
+ [format_info_item(proplists:get_value(X, Result), true)
+ || X <- InfoItemKeys])
end, lists:sort(Results)),
ok;
display_info_list(Other, _) ->
@@ -777,32 +781,33 @@ display_row(Row) ->
-define(IS_U8(X), (X >= 0 andalso X =< 255)).
-define(IS_U16(X), (X >= 0 andalso X =< 65535)).
-format_info_item(#resource{name = Name}) ->
- escape(Name);
-format_info_item({N1, N2, N3, N4} = Value) when
+format_info_item(#resource{name = Name}, IsEscaped) ->
+ escape(Name, IsEscaped);
+format_info_item({N1, N2, N3, N4} = Value, _IsEscaped) when
?IS_U8(N1), ?IS_U8(N2), ?IS_U8(N3), ?IS_U8(N4) ->
rabbit_misc:ntoa(Value);
-format_info_item({K1, K2, K3, K4, K5, K6, K7, K8} = Value) when
+format_info_item({K1, K2, K3, K4, K5, K6, K7, K8} = Value, _IsEscaped) when
?IS_U16(K1), ?IS_U16(K2), ?IS_U16(K3), ?IS_U16(K4),
?IS_U16(K5), ?IS_U16(K6), ?IS_U16(K7), ?IS_U16(K8) ->
rabbit_misc:ntoa(Value);
-format_info_item(Value) when is_pid(Value) ->
+format_info_item(Value, _IsEscaped) when is_pid(Value) ->
rabbit_misc:pid_to_string(Value);
-format_info_item(Value) when is_binary(Value) ->
- escape(Value);
-format_info_item(Value) when is_atom(Value) ->
- escape(atom_to_list(Value));
+format_info_item(Value, IsEscaped) when is_binary(Value) ->
+ escape(Value, IsEscaped);
+format_info_item(Value, IsEscaped) when is_atom(Value) ->
+ escape(atom_to_list(Value), IsEscaped);
format_info_item([{TableEntryKey, TableEntryType, _TableEntryValue} | _] =
- Value) when is_binary(TableEntryKey) andalso
- is_atom(TableEntryType) ->
- io_lib:format("~1000000000000p", [prettify_amqp_table(Value)]);
-format_info_item([T | _] = Value)
+ Value, IsEscaped) when is_binary(TableEntryKey) andalso
+ is_atom(TableEntryType) ->
+ io_lib:format("~1000000000000p", [prettify_amqp_table(Value, IsEscaped)]);
+format_info_item([T | _] = Value, IsEscaped)
when is_tuple(T) orelse is_pid(T) orelse is_binary(T) orelse is_atom(T) orelse
is_list(T) ->
"[" ++
lists:nthtail(2, lists:append(
- [", " ++ format_info_item(E) || E <- Value])) ++ "]";
-format_info_item(Value) ->
+ [", " ++ format_info_item(E, IsEscaped)
+ || E <- Value])) ++ "]";
+format_info_item(Value, _IsEscaped) ->
io_lib:format("~w", [Value]).
display_call_result(Node, MFA) ->
@@ -833,9 +838,12 @@ call(Node, {Mod, Fun, Args}) ->
rpc_call(Node, Mod, Fun, lists:map(fun list_to_binary_utf8/1, Args)).
call(Node, {Mod, Fun, Args}, InfoKeys, Timeout) ->
- call(Node, {Mod, Fun, Args}, InfoKeys, false, Timeout).
+ call(Node, {Mod, Fun, Args}, InfoKeys, false, Timeout, false).
call(Node, {Mod, Fun, Args}, InfoKeys, ToBinUtf8, Timeout) ->
+ call(Node, {Mod, Fun, Args}, InfoKeys, ToBinUtf8, Timeout, false).
+
+call(Node, {Mod, Fun, Args}, InfoKeys, ToBinUtf8, Timeout, IsEscaped) ->
Args0 = case ToBinUtf8 of
true -> lists:map(fun list_to_binary_utf8/1, Args);
false -> Args
@@ -855,7 +863,7 @@ call(Node, {Mod, Fun, Args}, InfoKeys, ToBinUtf8, Timeout) ->
end
end),
rabbit_control_misc:wait_for_info_messages(
- Pid, Ref, InfoKeys, fun display_info_message/2, Timeout).
+ Pid, Ref, InfoKeys, display_info_message(IsEscaped), Timeout).
list_to_binary_utf8(L) ->
B = list_to_binary(L),
@@ -868,9 +876,14 @@ list_to_binary_utf8(L) ->
%% characters. We don't escape characters above 127, since they may
%% form part of UTF-8 strings.
-escape(Atom) when is_atom(Atom) -> escape(atom_to_list(Atom));
-escape(Bin) when is_binary(Bin) -> escape(binary_to_list(Bin));
-escape(L) when is_list(L) -> escape_char(lists:reverse(L), []).
+escape(Atom, IsEscaped) when is_atom(Atom) ->
+ escape(atom_to_list(Atom), IsEscaped);
+escape(Bin, IsEscaped) when is_binary(Bin) ->
+ escape(binary_to_list(Bin), IsEscaped);
+escape(L, false) when is_list(L) ->
+ escape_char(lists:reverse(L), []);
+escape(L, true) when is_list(L) ->
+ L.
escape_char([$\\ | T], Acc) ->
escape_char(T, [$\\, $\\ | Acc]);
@@ -882,14 +895,18 @@ escape_char([X | T], Acc) ->
escape_char([], Acc) ->
Acc.
-prettify_amqp_table(Table) ->
- [{escape(K), prettify_typed_amqp_value(T, V)} || {K, T, V} <- Table].
-
-prettify_typed_amqp_value(longstr, Value) -> escape(Value);
-prettify_typed_amqp_value(table, Value) -> prettify_amqp_table(Value);
-prettify_typed_amqp_value(array, Value) -> [prettify_typed_amqp_value(T, V) ||
- {T, V} <- Value];
-prettify_typed_amqp_value(_Type, Value) -> Value.
+prettify_amqp_table(Table, IsEscaped) ->
+ [{escape(K, IsEscaped), prettify_typed_amqp_value(T, V, IsEscaped)}
+ || {K, T, V} <- Table].
+
+prettify_typed_amqp_value(longstr, Value, IsEscaped) ->
+ escape(Value, IsEscaped);
+prettify_typed_amqp_value(table, Value, IsEscaped) ->
+ prettify_amqp_table(Value, IsEscaped);
+prettify_typed_amqp_value(array, Value, IsEscaped) ->
+ [prettify_typed_amqp_value(T, V, IsEscaped) || {T, V} <- Value];
+prettify_typed_amqp_value(_Type, Value, _IsEscaped) ->
+ Value.
split_list([]) -> [];
split_list([_]) -> exit(even_list_needed);