Skip to content

Commit 3d043e8

Browse files
authored
Merge pull request #14826 from rabbitmq/style-fixes
rabbit_db: Small style fixes
2 parents a1f9571 + dfb3514 commit 3d043e8

File tree

3 files changed

+34
-22
lines changed

3 files changed

+34
-22
lines changed

deps/rabbit/src/rabbit_db.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
%% License, v. 2.0. If a copy of the MPL was not distributed with this
33
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
%%
5-
%% Copyright (c) 2007-2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
5+
%% Copyright (c) 2023-2025 Broadcom. All Rights Reserved. The term “Broadcom”
6+
%% refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
67
%%
78

89
-module(rabbit_db).

deps/rabbit/src/rabbit_db_cluster.erl

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
%% License, v. 2.0. If a copy of the MPL was not distributed with this
33
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
%%
5-
%% Copyright (c) 2007-2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
5+
%% Copyright (c) 2023-2025 Broadcom. All Rights Reserved. The term “Broadcom”
6+
%% refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
67
%%
78

89
-module(rabbit_db_cluster).
@@ -50,7 +51,8 @@ ensure_feature_flags_are_in_sync(Nodes, NodeIsVirgin) ->
5051
RemoteNode :: node(),
5152
Ret :: Ok | Error,
5253
Ok :: {ok, [node()]} | {ok, already_member},
53-
Error :: {error, {inconsistent_cluster, string()} | {error, {erpc, noconnection}}}.
54+
Error :: {error, {inconsistent_cluster, string()} |
55+
{error, {erpc, noconnection}}}.
5456

5557
can_join(RemoteNode) ->
5658
?LOG_INFO(
@@ -82,7 +84,8 @@ can_join_using_khepri(RemoteNode) ->
8284
NodeType :: node_type(),
8385
Ret :: Ok | Error,
8486
Ok :: ok | {ok, already_member},
85-
Error :: {error, {inconsistent_cluster, string()} | {error, {erpc, noconnection}}}.
87+
Error :: {error, {inconsistent_cluster, string()} |
88+
{error, {erpc, noconnection}}}.
8689
%% @doc Adds this node to a cluster using `RemoteNode' to reach it.
8790

8891
join(ThisNode, _NodeType) when ThisNode =:= node() ->
@@ -219,15 +222,18 @@ join(RemoteNode, NodeType)
219222
true ->
220223
Error;
221224
false ->
222-
%% rabbit_mnesia:can_join_cluster/1 notice inconsistent_cluster,
223-
%% as RemoteNode thinks this node is already in the cluster.
224-
%% Attempt to leave the RemoteNode cluster, the discovery cluster,
225-
%% and simply retry the operation.
226-
?LOG_INFO("Mnesia: node ~tp thinks it's clustered "
227-
"with node ~tp, but ~tp disagrees. ~tp will ask "
228-
"to leave the cluster and try again.",
229-
[RemoteNode, node(), node(), node()]),
230-
ok = rabbit_mnesia:leave_then_rediscover_cluster(RemoteNode),
225+
%% rabbit_mnesia:can_join_cluster/1 notice
226+
%% inconsistent_cluster, as RemoteNode thinks this node is
227+
%% already in the cluster. Attempt to leave the RemoteNode
228+
%% cluster, the discovery cluster, and simply retry the
229+
%% operation.
230+
?LOG_INFO(
231+
"Mnesia: node ~tp thinks it's clustered "
232+
"with node ~tp, but ~tp disagrees. ~tp will ask "
233+
"to leave the cluster and try again.",
234+
[RemoteNode, node(), node(), node()]),
235+
ok = rabbit_mnesia:leave_then_rediscover_cluster(
236+
RemoteNode),
231237
join(RemoteNode, NodeType)
232238
end;
233239
{error, _} = Error ->

deps/rabbit/src/rabbit_khepri.erl

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ setup(_Context) ->
277277
{default_ra_system, ?RA_SYSTEM}]}],
278278
[{persistent, true}]),
279279
RaServerConfig = #{cluster_name => ?RA_CLUSTER_NAME,
280-
metrics_labels => #{ra_system => ?RA_SYSTEM, module => ?MODULE},
280+
metrics_labels => #{ra_system => ?RA_SYSTEM,
281+
module => ?MODULE},
281282
friendly_name => ?RA_FRIENDLY_NAME},
282283
case khepri:start(?RA_SYSTEM, RaServerConfig) of
283284
{ok, ?STORE_ID} ->
@@ -1486,12 +1487,14 @@ register_rabbit_route_by_source_projection() ->
14861487
%% So we exclude such bindings for two reasons:
14871488
%% 1. Lower overall ETS memory usage
14881489
%% 2. "Avoid inserting an extensive amount of objects with the same key.
1489-
%% It will hurt insert and lookup performance as well as real time characteristics
1490-
%% of the runtime environment (hash bucket linear search do not yield)."
1491-
%% Example: same source direct exchange with 100k different binding keys.
1492-
%% In future, rather than exchange types exclusion as done here, a nicer approach
1493-
%% would be that each exchange requiring routing lookup by only source exchange
1494-
%% advertises this access pattern, e.g. as a boolean flag in the #exchange.options field.
1490+
%% It will hurt insert and lookup performance as well as real time
1491+
%% characteristics of the runtime environment (hash bucket linear
1492+
%% search do not yield)." Example: same source direct exchange with
1493+
%% 100k different binding keys.
1494+
%% In future, rather than exchange types exclusion as done here, a nicer
1495+
%% approach would be that each exchange requiring routing lookup by only
1496+
%% source exchange advertises this access pattern, e.g. as a boolean flag
1497+
%% in the #exchange.options field.
14951498
Exchange = #if_data_matches{
14961499
pattern = #exchange{type = '$1', _ = '_'},
14971500
conditions = [{'andalso',
@@ -1938,8 +1941,10 @@ unload_disabled_plugins(Plugins) ->
19381941
fun() ->
19391942
lists:foreach(
19401943
fun
1941-
({Plugin, true}) -> _ = application:unload(Plugin);
1942-
({_Plugin, false}) -> ok
1944+
({Plugin, true}) ->
1945+
_ = application:unload(Plugin);
1946+
({_Plugin, false}) ->
1947+
ok
19431948
end, Plugins),
19441949
Parent ! plugins_unloading
19451950
end),

0 commit comments

Comments
 (0)