Skip to content

Commit 59ce657

Browse files
committed
Merge branch 'master' into rabbitmq-server-1246-master
2 parents dd18cf3 + 72415b1 commit 59ce657

16 files changed

+386
-68
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ define PROJECT_ENV
1616
{ssl_options, []},
1717
{vm_memory_high_watermark, 0.4},
1818
{vm_memory_high_watermark_paging_ratio, 0.5},
19+
{vm_memory_calculation_strategy, rss},
1920
{memory_monitor_interval, 2500},
2021
{disk_free_limit, 50000000}, %% 50MB
2122
{msg_store_index_module, rabbit_msg_store_ets_index},
@@ -125,7 +126,7 @@ define PROJECT_ENV
125126
]
126127
endef
127128

128-
LOCAL_DEPS = sasl mnesia os_mon
129+
LOCAL_DEPS = sasl mnesia os_mon inets
129130
BUILD_DEPS = rabbitmq_cli
130131
DEPS = ranch lager rabbit_common
131132
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client meck proper

docs/rabbitmqctl.8

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,100 @@ has been granted access, and the permissions the user has for operations
784784
on resources in these virtual hosts:
785785
.sp
786786
.Dl rabbitmqctl list_user_permissions tonyg
787+
.\" ------------------------------------
788+
.It Cm set_topic_permissions Oo Fl p Ar vhost Oc Ar user Ar exchange Ar write Ar read
789+
.Bl -tag -width Ds
790+
.It Ar vhost
791+
The name of the virtual host to which to grant the user access,
792+
defaulting to
793+
.Qq / .
794+
.It Ar user
795+
The name of the user the permissions apply to in the target virtual host.
796+
.It Ar exchange
797+
The name of the topic exchange the authorisation check will be applied to.
798+
.It Ar write
799+
A regular expression matching the routing key of the published message.
800+
.It Ar read
801+
A regular expression matching the routing key of the consumed message.
802+
.El
803+
.Pp
804+
Sets user topic permissions.
805+
.Pp
806+
For example, this command instructs the RabbitMQ broker to let the
807+
user named
808+
.Qq tonyg
809+
publish and consume messages going through the
810+
.Qq amp.topic
811+
exchange of the
812+
.Qq /myvhost
813+
virtual host with a routing key starting with
814+
.Qq tonyg- :
815+
.sp
816+
.Dl rabbitmqctl set_topic_permissions -p /myvhost tonyg amq.topic Qo ^tonyg-.* Qc Qo ^tonyg-.* Qc
817+
.Pp
818+
Topic permissions support variable expansion for the following variables:
819+
username, vhost, and client_id. Note that client_id is expanded only when using MQTT.
820+
The previous example could be made more generic by using
821+
.Qq ^{username}-.* :
822+
.sp
823+
.Dl rabbitmqctl set_topic_permissions -p /myvhost tonyg amq.topic Qo ^{username}-.* Qc Qo ^{username}-.* Qc
824+
.\" ------------------------------------
825+
.It Cm clear_topic_permissions Oo Fl p Ar vhost Oc Ar username Oo Ar exchange Oc
826+
.Bl -tag -width Ds
827+
.It Ar vhost
828+
The name of the virtual host to which to clear the topic permissions,
829+
defaulting to
830+
.Qq / .
831+
.It Ar username
832+
The name of the user to clear topic permissions to the specified virtual host.
833+
.It Ar exchange
834+
The name of the topic exchange to clear topic permissions, defaulting to all the
835+
topic exchanges the given user has topic permissions for.
836+
.El
837+
.Pp
838+
Clear user topic permissions.
839+
.Pp
840+
For example, this command instructs the RabbitMQ broker to remove topic permissions for user
841+
named
842+
.Qq tonyg
843+
for the topic exchange
844+
.Qq amq.topic
845+
in the virtual host called
846+
.Qq /myvhost :
847+
.sp
848+
.Dl rabbitmqctl clear_topic_permissions -p /myvhost tonyg amq.topic
849+
.\" ------------------------------------
850+
.It Cm list_topic_permissions Op Fl p Ar vhost
851+
.Bl -tag -width Ds
852+
.It Ar vhost
853+
The name of the virtual host for which to list the users topic permissions.
854+
Defaults to
855+
.Qq / .
856+
.El
857+
.Pp
858+
Lists topic permissions in a virtual host.
859+
.Pp
860+
For example, this command instructs the RabbitMQ broker to list all the
861+
users which have been granted topic permissions in the virtual host called
862+
.Qq /myvhost:
863+
.sp
864+
.Dl rabbitmqctl list_topic_permissions -p /myvhost
865+
.\" ------------------------------------
866+
.It Cm list_user_topic_permissions Ar username
867+
.Bl -tag -width Ds
868+
.It Ar username
869+
The name of the user for which to list the topic permissions.
870+
.El
871+
.Pp
872+
Lists user topic permissions.
873+
.Pp
874+
For example, this command instructs the RabbitMQ broker to list all the
875+
virtual hosts to which the user named
876+
.Qq tonyg
877+
has been granted access, and the topic permissions the user has in these virtual hosts:
878+
.sp
879+
.Dl rabbitmqctl list_topic_user_permissions tonyg
880+
787881
.El
788882
.Ss Parameter Management
789883
Certain features of RabbitMQ (such as the federation plugin) are

priv/schema/rabbitmq.schema renamed to priv/schema/rabbit.schema

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,14 @@ end}.
683683
{mapping, "memory_monitor_interval", "rabbit.memory_monitor_interval",
684684
[{datatype, integer}]}.
685685

686+
%% When set to rss, RabbitMQ will display the memory usage as reported
687+
%% by the operating system (RSS value), not by the Erlang VM.
688+
%%
689+
%% {vm_memory_calculation_strategy, rss},
690+
691+
{mapping, "vm_memory_calculation_strategy", "rabbit.vm_memory_calculation_strategy",
692+
[{datatype, {enum, [rss, erlang]}}]}.
693+
686694
%% Set disk free limit (in bytes). Once free disk space reaches this
687695
%% lower bound, a disk alarm will be set - see the documentation
688696
%% listed above for more details.

scripts/rabbitmq-env.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ if "!RABBITMQ_SCHEMA_DIR!" == "" (
202202
)
203203
)
204204

205-
206205
REM [ "x" = "x$RABBITMQ_LOG_BASE" ] && RABBITMQ_LOG_BASE=${LOG_BASE}
207206
if "!RABBITMQ_LOG_BASE!"=="" (
208207
if "!LOG_BASE!"=="" (
@@ -418,7 +417,7 @@ exit /b
418417

419418
:filter_path
420419
REM Ensure ERL_LIBS begins with valid path
421-
IF [%ERL_LIBS%] EQU [] (
420+
IF "%ERL_LIBS%"=="" (
422421
set ERL_LIBS=%~dps1%~n1%~x1
423422
) else (
424423
set ERL_LIBS=%ERL_LIBS%;%~dps1%~n1%~x1

scripts/rabbitmq-server

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ if [ ! -d ${RABBITMQ_GENERATED_CONFIG_DIR} ]; then
115115
mkdir -p "${RABBITMQ_GENERATED_CONFIG_DIR}"
116116
fi
117117

118-
if [ ! -f "${RABBITMQ_SCHEMA_DIR}/rabbitmq.schema" ]; then
119-
cp "${RABBITMQ_HOME}/priv/schema/rabbitmq.schema" "${RABBITMQ_SCHEMA_DIR}"
118+
if [ ! -f "${RABBITMQ_SCHEMA_DIR}/rabbit.schema" ]; then
119+
cp "${RABBITMQ_HOME}/priv/schema/rabbit.schema" "${RABBITMQ_SCHEMA_DIR}"
120120
fi
121121

122122
set -e

scripts/rabbitmq-server.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ if not exist "!RABBITMQ_GENERATED_CONFIG_DIR!" (
7979
mkdir "!RABBITMQ_GENERATED_CONFIG_DIR!"
8080
)
8181

82-
if not exist "!RABBITMQ_SCHEMA_DIR!\rabbitmq.schema" (
83-
copy "!RABBITMQ_HOME!\priv\schema\rabbitmq.schema" "!RABBITMQ_SCHEMA_DIR!\rabbitmq.schema"
82+
if not exist "!RABBITMQ_SCHEMA_DIR!\rabbit.schema" (
83+
copy "!RABBITMQ_HOME!\priv\schema\rabbit.schema" "!RABBITMQ_SCHEMA_DIR!\rabbit.schema"
8484
)
8585

8686
set RABBITMQ_EBIN_PATH="-pa !RABBITMQ_EBIN_ROOT!"

scripts/rabbitmq-service.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ if not exist "!RABBITMQ_GENERATED_CONFIG_DIR!" (
165165
mkdir "!RABBITMQ_GENERATED_CONFIG_DIR!"
166166
)
167167

168-
if not exist "!RABBITMQ_SCHEMA_DIR!\rabbitmq.schema" (
169-
copy "!RABBITMQ_HOME!\priv\schema\rabbitmq.schema" "!RABBITMQ_SCHEMA_DIR!\rabbitmq.schema"
168+
if not exist "!RABBITMQ_SCHEMA_DIR!\rabbit.schema" (
169+
copy "!RABBITMQ_HOME!\priv\schema\rabbit.schema" "!RABBITMQ_SCHEMA_DIR!\rabbit.schema"
170170
)
171171
REM Try to create advanced config file, if it doesn't exist
172172
REM It still can fail to be created, but at least not for default install

src/rabbit.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ decrypt_list([Value|Tail], Algo, Acc) ->
624624

625625
stop_apps(Apps) ->
626626
rabbit_log:info(
627-
lists:flatten(["Stopping RabbitMQ applications and their dependencies in the following order: ~n",
627+
lists:flatten(["Stopping RabbitMQ applications and their dependencies in the following order:~n",
628628
[" ~p~n" || _ <- Apps]]),
629629
lists:reverse(Apps)),
630630
ok = app_utils:stop_applications(

src/rabbit_node_monitor.erl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ init([]) ->
344344
Nodes = possibly_partitioned_nodes(),
345345
startup_log(Nodes),
346346
Monitors = lists:foldl(fun(Node, Monitors0) ->
347-
pmon:monitor({rabbit, Node}, Monitors0)
348-
end, pmon:new(), Nodes),
347+
pmon:monitor({rabbit, Node}, Monitors0)
348+
end, pmon:new(), Nodes),
349349
{ok, ensure_keepalive_timer(#state{monitors = Monitors,
350350
subscribers = pmon:new(),
351351
partitions = [],
@@ -420,12 +420,12 @@ handle_cast({check_partial_partition, Node, Rep, NodeGUID, MyGUID, RepGUID},
420420
fun () ->
421421
case rpc:call(Node, rabbit, is_running, []) of
422422
{badrpc, _} -> ok;
423-
_ ->
424-
rabbit_log:warning("Received a 'DOWN' message"
425-
" from ~p but still can"
426-
" communicate with it ~n",
427-
[Node]),
428-
cast(Rep, {partial_partition,
423+
_ ->
424+
rabbit_log:warning("Received a 'DOWN' message"
425+
" from ~p but still can"
426+
" communicate with it ~n",
427+
[Node]),
428+
cast(Rep, {partial_partition,
429429
Node, node(), RepGUID})
430430
end
431431
end);
@@ -499,18 +499,18 @@ handle_cast({node_up, Node, NodeType},
499499
rabbit_log:info("rabbit on node ~p up~n", [Node]),
500500
{AllNodes, DiscNodes, RunningNodes} = read_cluster_status(),
501501
write_cluster_status({add_node(Node, AllNodes),
502-
case NodeType of
503-
disc -> add_node(Node, DiscNodes);
504-
ram -> DiscNodes
505-
end,
506-
add_node(Node, RunningNodes)}),
502+
case NodeType of
503+
disc -> add_node(Node, DiscNodes);
504+
ram -> DiscNodes
505+
end,
506+
add_node(Node, RunningNodes)}),
507507
ok = handle_live_rabbit(Node),
508508
Monitors1 = case pmon:is_monitored({rabbit, Node}, Monitors) of
509-
true ->
510-
Monitors;
511-
false ->
512-
pmon:monitor({rabbit, Node}, Monitors)
513-
end,
509+
true ->
510+
Monitors;
511+
false ->
512+
pmon:monitor({rabbit, Node}, Monitors)
513+
end,
514514
{noreply, maybe_autoheal(State#state{monitors = Monitors1})};
515515

516516
handle_cast({joined_cluster, Node, NodeType}, State) ->
@@ -584,7 +584,7 @@ handle_info({mnesia_system_event,
584584
State1 = case pmon:is_monitored({rabbit, Node}, Monitors) of
585585
true -> State;
586586
false -> State#state{
587-
monitors = pmon:monitor({rabbit, Node}, Monitors)}
587+
monitors = pmon:monitor({rabbit, Node}, Monitors)}
588588
end,
589589
ok = handle_live_rabbit(Node),
590590
Partitions1 = lists:usort([Node | Partitions]),
@@ -893,4 +893,4 @@ startup_log([]) ->
893893
rabbit_log:info("Starting rabbit_node_monitor~n", []);
894894
startup_log(Nodes) ->
895895
rabbit_log:info("Starting rabbit_node_monitor, might be partitioned from ~p~n",
896-
[Nodes]).
896+
[Nodes]).

0 commit comments

Comments
 (0)