summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/amqqueue.erl6
-rw-r--r--src/gm.erl2
-rw-r--r--src/lager_exchange_backend.erl4
-rw-r--r--src/lqueue.erl6
-rw-r--r--src/rabbit_amqqueue.erl7
-rw-r--r--src/rabbit_amqqueue_process.erl6
-rw-r--r--src/rabbit_backing_queue.erl4
-rw-r--r--src/rabbit_basic.erl5
-rw-r--r--src/rabbit_channel.erl17
-rw-r--r--src/rabbit_feature_flags.erl2
-rw-r--r--src/rabbit_ff_registry.erl4
-rw-r--r--src/rabbit_fifo.erl12
-rw-r--r--src/rabbit_fifo_client.erl16
-rw-r--r--src/rabbit_fifo_index.erl2
-rw-r--r--src/rabbit_guid.erl2
-rw-r--r--src/rabbit_lager.erl4
-rw-r--r--src/rabbit_mirror_queue_coordinator.erl2
-rw-r--r--src/rabbit_mirror_queue_misc.erl2
-rw-r--r--src/rabbit_msg_store.erl4
-rw-r--r--src/rabbit_networking.erl8
-rw-r--r--src/rabbit_node_monitor.erl2
-rw-r--r--src/rabbit_priority_queue.erl4
-rw-r--r--src/rabbit_queue_consumers.erl4
-rw-r--r--src/rabbit_queue_index.erl2
-rw-r--r--src/rabbit_quorum_queue.erl13
-rw-r--r--src/rabbit_reader.erl4
-rw-r--r--src/rabbit_trace.erl2
-rw-r--r--src/rabbit_upgrade.erl4
-rw-r--r--src/rabbit_variable_queue.erl4
29 files changed, 71 insertions, 83 deletions
diff --git a/src/amqqueue.erl b/src/amqqueue.erl
index 83b65cd048..b9c278cdab 100644
--- a/src/amqqueue.erl
+++ b/src/amqqueue.erl
@@ -107,7 +107,7 @@
%% implicit
%% update
%% as above
- gm_pids = [] :: [pid()] | none | '_', %% transient
+ gm_pids = [] :: [{pid(), pid()} | pid()] | none | '_', %% transient
decorators :: [atom()] | none | undefined | '_', %% transient,
%% recalculated
%% as above
@@ -359,14 +359,14 @@ get_exclusive_owner(#amqqueue{exclusive_owner = Owner}) ->
get_exclusive_owner(Queue) ->
amqqueue_v1:get_exclusive_owner(Queue).
--spec get_gm_pids(amqqueue()) -> [pid()] | none.
+-spec get_gm_pids(amqqueue()) -> [{pid(), pid()} | pid()] | none.
get_gm_pids(#amqqueue{gm_pids = GMPids}) ->
GMPids;
get_gm_pids(Queue) ->
amqqueue_v1:get_gm_pids(Queue).
--spec set_gm_pids(amqqueue(), [pid()] | none) -> amqqueue().
+-spec set_gm_pids(amqqueue(), [{pid(), pid()} | pid()] | none) -> amqqueue().
set_gm_pids(#amqqueue{} = Queue, GMPids) ->
Queue#amqqueue{gm_pids = GMPids};
diff --git a/src/gm.erl b/src/gm.erl
index 02ee76cd60..7b9bbc8c8a 100644
--- a/src/gm.erl
+++ b/src/gm.erl
@@ -1271,7 +1271,7 @@ neighbour_cast(N, Msg) -> ?INSTR_MOD:cast(get_pid(N), Msg).
neighbour_call(N, Msg) -> ?INSTR_MOD:call(get_pid(N), Msg, infinity).
%% ---------------------------------------------------------------------------
-%% View monitoring and maintanence
+%% View monitoring and maintenance
%% ---------------------------------------------------------------------------
ensure_neighbour(_Ver, Self, {Self, undefined}, Self) ->
diff --git a/src/lager_exchange_backend.erl b/src/lager_exchange_backend.erl
index 6e492f649d..2b657e9041 100644
--- a/src/lager_exchange_backend.erl
+++ b/src/lager_exchange_backend.erl
@@ -165,8 +165,8 @@ handle_log_event({log, Message},
headers = Headers},
Body = rabbit_data_coercion:to_binary(Formatter:format(Message, FormatConfig)),
case rabbit_basic:publish(LogExch, RoutingKey, AmqpMsg, Body) of
- {ok, _DeliveredQPids} -> ok;
- {error, not_found} -> ok
+ ok -> ok;
+ {error, not_found} -> ok
end,
{ok, State};
false ->
diff --git a/src/lqueue.erl b/src/lqueue.erl
index cb5e0a3a9c..272108c808 100644
--- a/src/lqueue.erl
+++ b/src/lqueue.erl
@@ -52,17 +52,17 @@ is_empty(_) -> false.
in(V, {L, Q}) -> {L+1, ?QUEUE:in(V, Q)}.
--spec in_r(value(), ?MODULE()) -> ?MODULE().
+-spec in_r(value(), ?MODULE(T)) -> ?MODULE(T).
in_r(V, {L, Q}) -> {L+1, ?QUEUE:in_r(V, Q)}.
--spec out(?MODULE(T)) -> {result(T), ?MODULE()}.
+-spec out(?MODULE(T)) -> {result(T), ?MODULE(T)}.
out({0, _Q} = Q) -> {empty, Q};
out({L, Q}) -> {Result, Q1} = ?QUEUE:out(Q),
{Result, {L-1, Q1}}.
--spec out_r(?MODULE(T)) -> {result(T), ?MODULE()}.
+-spec out_r(?MODULE(T)) -> {result(T), ?MODULE(T)}.
out_r({0, _Q} = Q) -> {empty, Q};
out_r({L, Q}) -> {Result, Q1} = ?QUEUE:out_r(Q),
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index 8ddb649bc8..dbf8693a96 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -77,7 +77,7 @@
-type qpids() :: [pid()].
-type qlen() :: rabbit_types:ok(non_neg_integer()).
-type qfun(A) :: fun ((amqqueue:amqqueue()) -> A | no_return()).
--type qmsg() :: {name(), pid(), msg_id(), boolean(), rabbit_types:message()}.
+-type qmsg() :: {name(), pid() | {atom(), pid()}, msg_id(), boolean(), rabbit_types:message()}.
-type msg_id() :: non_neg_integer().
-type ok_or_errors() ::
'ok' | {'error', [{'error' | 'exit' | 'throw', any()}]}.
@@ -244,7 +244,9 @@ recover_durable_queues(QueuesAndRecoveryTerms) ->
rabbit_framing:amqp_table(),
rabbit_types:maybe(pid()),
rabbit_types:username()) ->
- {'new' | 'existing' | 'absent' | 'owner_died', amqqueue:amqqueue()} |
+ {'new' | 'existing' | 'owner_died', amqqueue:amqqueue()} |
+ {'new', amqqueue:amqqueue(), rabbit_fifo_client:state()} |
+ {'absent', amqqueue:amqqueue(), absent_reason()} |
rabbit_types:channel_exit().
declare(QueueName, Durable, AutoDelete, Args, Owner, ActingUser) ->
@@ -1038,6 +1040,7 @@ notify_policy_changed(Q) when ?amqqueue_is_quorum(Q) ->
-spec consumers(amqqueue:amqqueue()) ->
[{pid(), rabbit_types:ctag(), boolean(), non_neg_integer(),
+ boolean(), atom(),
rabbit_framing:amqp_table(), rabbit_types:username()}].
consumers(Q) when ?amqqueue_is_classic(Q) ->
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index c3ba4a5c59..e1978a9173 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -1195,7 +1195,7 @@ prioritise_cast(Msg, _Len, State) ->
%% will be rate limited by how fast consumers receive messages -
%% i.e. by notify_sent. We prioritise ack and resume to discourage
%% starvation caused by prioritising notify_sent. We don't vary their
-%% prioritiy since acks should stay in order (some parts of the queue
+%% priority since acks should stay in order (some parts of the queue
%% stack are optimised for that) and to make things easier to reason
%% about. Finally, we prioritise ack over resume since it should
%% always reduce memory use.
@@ -1592,10 +1592,10 @@ handle_cast({force_event_refresh, Ref},
[emit_consumer_created(
Ch, CTag, false, AckRequired, QName, Prefetch,
Args, Ref, ActingUser) ||
- {Ch, CTag, AckRequired, Prefetch, Args, ActingUser}
+ {Ch, CTag, AckRequired, Prefetch, _, _, Args, ActingUser}
<- AllConsumers];
{Ch, CTag} ->
- [{Ch, CTag, AckRequired, Prefetch, Args, ActingUser}] = AllConsumers,
+ [{Ch, CTag, AckRequired, Prefetch, _, _, Args, ActingUser}] = AllConsumers,
emit_consumer_created(
Ch, CTag, true, AckRequired, QName, Prefetch, Args, Ref, ActingUser)
end,
diff --git a/src/rabbit_backing_queue.erl b/src/rabbit_backing_queue.erl
index c3e570b26f..187f55288d 100644
--- a/src/rabbit_backing_queue.erl
+++ b/src/rabbit_backing_queue.erl
@@ -158,7 +158,7 @@
%% Drop messages from the head of the queue while the supplied
%% predicate on message properties returns true. Returns the first
-%% message properties for which the predictate returned false, or
+%% message properties for which the predicate returned false, or
%% 'undefined' if the whole backing queue was traversed w/o the
%% predicate ever returning false.
-callback dropwhile(msg_pred(), state())
@@ -259,7 +259,7 @@
-callback set_queue_mode(queue_mode(), state()) -> state().
--callback zip_msgs_and_acks(delivered_publish(),
+-callback zip_msgs_and_acks([delivered_publish()],
[ack()], Acc, state())
-> Acc.
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl
index 40c60ece45..cfd7709d15 100644
--- a/src/rabbit_basic.erl
+++ b/src/rabbit_basic.erl
@@ -30,7 +30,7 @@
-type properties_input() ::
rabbit_framing:amqp_property_record() | [{atom(), any()}].
-type publish_result() ::
- {ok, [pid()]} | rabbit_types:error('not_found').
+ ok | rabbit_types:error('not_found').
-type header() :: any().
-type headers() :: rabbit_framing:amqp_table() | 'undefined'.
@@ -76,8 +76,7 @@ publish(Delivery = #delivery{
publish(X, Delivery) ->
Qs = rabbit_amqqueue:lookup(rabbit_exchange:route(X, Delivery)),
- DeliveredQPids = rabbit_amqqueue:deliver(Qs, Delivery),
- {ok, DeliveredQPids}.
+ rabbit_amqqueue:deliver(Qs, Delivery).
-spec delivery
(boolean(), boolean(), rabbit_types:message(), undefined | integer()) ->
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index ffd7c8fabc..036aa9a60c 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -869,9 +869,7 @@ send(Command, #ch{writer_pid = WriterPid}) ->
ok = rabbit_writer:send_command(WriterPid, Command).
format_soft_error(#amqp_error{name = N, explanation = E, method = M}) ->
- io_lib:format("operation ~s caused a channel exception ~s: ~ts", [M, N, E]);
-format_soft_error(Reason) ->
- Reason.
+ io_lib:format("operation ~s caused a channel exception ~s: ~ts", [M, N, E]).
handle_exception(Reason, State = #ch{protocol = Protocol,
channel = Channel,
@@ -1455,7 +1453,7 @@ handle_method(#'basic.qos'{prefetch_size = Size}, _, _State) when Size /= 0 ->
handle_method(#'basic.qos'{global = false,
prefetch_count = PrefetchCount},
_, State = #ch{limiter = Limiter}) ->
- %% Ensures that if default was set, it's overriden
+ %% Ensures that if default was set, it's overridden
Limiter1 = rabbit_limiter:unlimit_prefetch(Limiter),
{reply, #'basic.qos_ok'{}, State#ch{consumer_prefetch = PrefetchCount,
limiter = Limiter1}};
@@ -2145,19 +2143,14 @@ send_confirms_and_nacks(State) ->
send_nacks([], _, State) ->
State;
-send_nacks(_Rs, _, State = #ch{state = closing,
- tx = none}) -> %% optimisation
+send_nacks(_Rs, _, State = #ch{state = closing}) -> %% optimisation
State;
-send_nacks(Rs, Cs, State = #ch{tx = none}) ->
+send_nacks(Rs, Cs, State) ->
coalesce_and_send(Rs, Cs,
fun(MsgSeqNo, Multiple) ->
#'basic.nack'{delivery_tag = MsgSeqNo,
multiple = Multiple}
- end, State);
-send_nacks(_MXs, _, State = #ch{state = closing}) -> %% optimisation
- State#ch{tx = failed};
-send_nacks(_, _, State) ->
- maybe_complete_tx(State#ch{tx = failed}).
+ end, State).
send_confirms([], _, State) ->
State;
diff --git a/src/rabbit_feature_flags.erl b/src/rabbit_feature_flags.erl
index 8ba38179a5..74f5a34db0 100644
--- a/src/rabbit_feature_flags.erl
+++ b/src/rabbit_feature_flags.erl
@@ -1411,7 +1411,7 @@ does_node_support(Node, FeatureNames, Timeout) ->
%% If rabbit_feature_flags:is_supported_locally/1 is undefined
%% on the remote node, we consider it to be a 3.7.x node.
%%
- %% Theoritically, it could be an older version (3.6.x and
+ %% Theoretically, it could be an older version (3.6.x and
%% older). But the RabbitMQ version consistency check
%% (rabbit_misc:version_minor_equivalent/2) called from
%% rabbit_mnesia:check_rabbit_consistency/2 already blocked
diff --git a/src/rabbit_ff_registry.erl b/src/rabbit_ff_registry.erl
index e18a4b3456..46d439001f 100644
--- a/src/rabbit_ff_registry.erl
+++ b/src/rabbit_ff_registry.erl
@@ -148,7 +148,7 @@ is_registry_written_to_disk() ->
always_return_true() ->
%% This function is here to trick Dialyzer. We want some functions
%% in this initial on-disk registry to always return `true` or
- %% `false`. However the generated regsitry will return actual
+ %% `false`. However the generated registry will return actual
%% booleans. The `-spec()` correctly advertises a return type of
%% `boolean()`. But in the meantime, Dialyzer only knows about this
%% copy which, without the trick below, would always return either
@@ -161,7 +161,7 @@ always_return_true() ->
%% That's why this function makes a call which we know the result,
%% but not Dialyzer, to "create" that hard-coded `true` return
%% value.
- rand:uniform(1) > 0.
+ erlang:get({?MODULE, always_undefined}) =:= undefined.
always_return_false() ->
not always_return_true().
diff --git a/src/rabbit_fifo.erl b/src/rabbit_fifo.erl
index 4f548568be..ee0f65950c 100644
--- a/src/rabbit_fifo.erl
+++ b/src/rabbit_fifo.erl
@@ -156,7 +156,7 @@
#update_config{}.
-type command() :: protocol() | ra_machine:builtin_command().
-%% all the command types suppored by ra fifo
+%% all the command types supported by ra fifo
-type client_msg() :: delivery().
%% the messages `rabbit_fifo' can send to consumers.
@@ -323,7 +323,7 @@ apply(Meta,
case Cons0 of
#{ConsumerId := Con0} ->
% need to increment metrics before completing as any snapshot
- % states taken need to includ them
+ % states taken need to include them
complete_and_checkout(Meta, MsgIds, ConsumerId,
Con0, [], State);
_ ->
@@ -693,7 +693,7 @@ get_checked_out(Cid, From, To, #state{consumers = Consumers}) ->
end.
init_aux(Name) when is_atom(Name) ->
- %% TODO: catch specific exeption throw if table already exists
+ %% TODO: catch specific exception throw if table already exists
ok = ra_machine_ets:create_table(rabbit_fifo_usage,
[named_table, set, public,
{write_concurrency, true}]),
@@ -1108,7 +1108,7 @@ increase_credit(#consumer{lifetime = once,
increase_credit(#consumer{lifetime = auto,
credit_mode = credited,
credit = Credit}, _) ->
- %% credit_mode: credit also doens't automatically increment credit
+ %% credit_mode: credit also doesn't automatically increment credit
Credit;
increase_credit(#consumer{credit = Current}, Credit) ->
Current + Credit.
@@ -2139,7 +2139,7 @@ enq_check_settle_duplicate_test() ->
run_snapshot_test(?FUNCTION_NAME, Commands).
run_snapshot_test(Name, Commands) ->
- %% create every incremental permuation of the commands lists
+ %% create every incremental permutation of the commands lists
%% and run the snapshot tests against that
[begin
run_snapshot_test0(Name, C)
@@ -2208,7 +2208,7 @@ state_enter_test() ->
[{mod_call, m, f, [a, the_name]}] = state_enter(leader, S0),
ok.
-state_enter_montors_and_notifications_test() ->
+state_enter_monitors_and_notifications_test() ->
Oth = spawn(fun () -> ok end),
{State0, _} = enq(1, 1, first, test_init(test)),
Cid = {<<"adf">>, self()},
diff --git a/src/rabbit_fifo_client.erl b/src/rabbit_fifo_client.erl
index ef0991f675..04918c3eb9 100644
--- a/src/rabbit_fifo_client.erl
+++ b/src/rabbit_fifo_client.erl
@@ -165,7 +165,7 @@ enqueue(Msg, State) ->
%% @doc Dequeue a message from the queue.
%%
-%% This is a syncronous call. I.e. the call will block until the command
+%% This is a synchronous call. I.e. the call will block until the command
%% has been accepted by the ra process or it times out.
%%
%% @param ConsumerTag a unique tag to identify this particular consumer.
@@ -297,7 +297,7 @@ discard(ConsumerTag, [_|_] = MsgIds,
%% @doc Register with the rabbit_fifo queue to "checkout" messages as they
%% become available.
%%
-%% This is a syncronous call. I.e. the call will block until the command
+%% This is a synchronous call. I.e. the call will block until the command
%% has been accepted by the ra process or it times out.
%%
%% @param ConsumerTag a unique tag to identify this particular consumer.
@@ -316,7 +316,7 @@ checkout(ConsumerTag, NumUnsettled, ConsumerInfo, State0) ->
%% @doc Register with the rabbit_fifo queue to "checkout" messages as they
%% become available.
%%
-%% This is a syncronous call. I.e. the call will block until the command
+%% This is a synchronous call. I.e. the call will block until the command
%% has been accepted by the ra process or it times out.
%%
%% @param ConsumerTag a unique tag to identify this particular consumer.
@@ -374,7 +374,7 @@ credit(ConsumerTag, Credit, Drain,
%% @doc Cancels a checkout with the rabbit_fifo queue for the consumer tag
%%
-%% This is a syncronous call. I.e. the call will block until the command
+%% This is a synchronous call. I.e. the call will block until the command
%% has been accepted by the ra process or it times out.
%%
%% @param ConsumerTag a unique tag to identify this particular consumer.
@@ -407,12 +407,8 @@ purge(Node) ->
stat(Leader) ->
%% short timeout as we don't want to spend too long if it is going to
%% fail anyway
- case ra:local_query(Leader, fun rabbit_fifo:query_stat/1, 250) of
- {ok, {_, {R, C}}, _} ->
- {ok, R, C};
- Err ->
- Err
- end.
+ {ok, {_, {R, C}}, _} = ra:local_query(Leader, fun rabbit_fifo:query_stat/1, 250),
+ {ok, R, C}.
%% @doc returns the cluster name
-spec cluster_name(state()) -> cluster_name().
diff --git a/src/rabbit_fifo_index.erl b/src/rabbit_fifo_index.erl
index 82a75b4adc..3bda9bab26 100644
--- a/src/rabbit_fifo_index.erl
+++ b/src/rabbit_fifo_index.erl
@@ -87,7 +87,7 @@ find_next(Next, Last, Map) ->
_ ->
% in degenerate cases the range here could be very large
% and hence this could be very slow
- % the typical case should idealy be better
+ % the typical case should ideally be better
% assuming fifo-ish deletion of entries
find_next(Next+1, Last, Map)
end.
diff --git a/src/rabbit_guid.erl b/src/rabbit_guid.erl
index 6f03a1a04f..5728ac88d7 100644
--- a/src/rabbit_guid.erl
+++ b/src/rabbit_guid.erl
@@ -92,7 +92,7 @@ advance_blocks({B1, B2, B3, B4}, I) ->
%% hashing {B5, I}. The new hash is used as last block, and the
%% other three blocks are XORed with it.
%%
- %% Doing this is convenient because it avoids cascading conflits,
+ %% Doing this is convenient because it avoids cascading conflicts,
%% while being very fast. The conflicts are avoided by propagating
%% the changes through all the blocks at each round by XORing, so
%% the only occasion in which a collision will take place is when
diff --git a/src/rabbit_lager.erl b/src/rabbit_lager.erl
index 1a72d15009..bfdd26fee3 100644
--- a/src/rabbit_lager.erl
+++ b/src/rabbit_lager.erl
@@ -396,7 +396,7 @@ prepare_rabbit_log_config() ->
set_env_default_log_console();
FileName when is_list(FileName) ->
case os:getenv("RABBITMQ_LOGS_source") of
- %% The user explicitely sets $RABBITMQ_LOGS;
+ %% The user explicitly sets $RABBITMQ_LOGS;
%% we should override a file location even
%% if it's set in rabbitmq.config
"environment" -> set_env_default_log_file(FileName, override);
@@ -406,7 +406,7 @@ prepare_rabbit_log_config() ->
%% Upgrade log file never overrides the value set in rabbitmq.config
case UpgradeFile of
- %% No special env for upgrade logs - rederect to the default sink
+ %% No special env for upgrade logs - redirect to the default sink
undefined -> ok;
%% Redirect logs to default output.
DefaultFile -> ok;
diff --git a/src/rabbit_mirror_queue_coordinator.erl b/src/rabbit_mirror_queue_coordinator.erl
index 96474b0d4e..b502da201a 100644
--- a/src/rabbit_mirror_queue_coordinator.erl
+++ b/src/rabbit_mirror_queue_coordinator.erl
@@ -364,7 +364,7 @@ handle_cast({gm_deaths, DeadGMPids}, State = #state{q = Q}) when ?amqqueue_pid_r
%% Different slave is now master, stop current coordinator normally.
%% Initiating queue is now slave and the least we could do is report
%% deaths which we 'think' we saw.
- %% NOTE: Reported deaths here, could be inconsistant.
+ %% NOTE: Reported deaths here, could be inconsistent.
rabbit_mirror_queue_misc:report_deaths(MPid, false, QueueName,
DeadPids),
{stop, shutdown, State};
diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl
index 04ed4e2887..7383152898 100644
--- a/src/rabbit_mirror_queue_misc.erl
+++ b/src/rabbit_mirror_queue_misc.erl
@@ -615,7 +615,7 @@ validate_sync_batch_size(none) ->
validate_sync_batch_size(N) when is_integer(N) andalso N > 0 ->
ok;
validate_sync_batch_size(N) ->
- {error, "ha-sync-batch-size takes an integer greather than 0, "
+ {error, "ha-sync-batch-size takes an integer greater than 0, "
"~p given", [N]}.
validate_pos(PromoteOnShutdown) ->
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl
index 337064ad39..a4dfba47e7 100644
--- a/src/rabbit_msg_store.erl
+++ b/src/rabbit_msg_store.erl
@@ -236,7 +236,7 @@
%% updated.
%%
%% On non-clean startup, we scan the files we discover, dealing with
-%% the possibilites of a crash having occurred during a compaction
+%% the possibilities of a crash having occurred during a compaction
%% (this consists of tidyup - the compaction is deliberately designed
%% such that data is duplicated on disk rather than risking it being
%% lost), and rebuild the file summary and index ETS table.
@@ -596,7 +596,7 @@ client_read2(false, undefined, _MsgLocation, Defer, _CState) ->
Defer();
client_read2(true, _Right, _MsgLocation, Defer, _CState) ->
%% Of course, in the mean time, the GC could have run and our msg
- %% is actually in a different file, unlocked. However, defering is
+ %% is actually in a different file, unlocked. However, deferring is
%% the safest and simplest thing to do.
Defer();
client_read2(false, _Right,
diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl
index ed2e2ce389..1935196170 100644
--- a/src/rabbit_networking.erl
+++ b/src/rabbit_networking.erl
@@ -70,6 +70,11 @@
-type protocol() :: atom().
-type label() :: string().
+%% @todo Remove once Dialyzer only runs on Erlang/OTP 21.3 or above.
+-dialyzer({nowarn_function, boot/0}).
+-dialyzer({nowarn_function, boot_listeners/3}).
+-dialyzer({nowarn_function, record_distribution_listener/0}).
+
-spec boot() -> 'ok'.
boot() ->
@@ -285,9 +290,6 @@ tcp_listener_stopped(Protocol, Opts, IPAddress, Port) ->
port = Port,
opts = Opts}).
-%% @todo Remove once Dialyzer only runs on Erlang/OTP 21.3 or above.
--dialyzer({nowarn_function, record_distribution_listener/0}).
-
record_distribution_listener() ->
{Name, Host} = rabbit_nodes:parts(node()),
{port, Port, _Version} = erl_epmd:port_please(Name, Host),
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl
index cd46ade0e2..9fa1dfa462 100644
--- a/src/rabbit_node_monitor.erl
+++ b/src/rabbit_node_monitor.erl
@@ -219,7 +219,7 @@ subscribe(Pid) ->
%% We could confirm something by having an HA queue see the pausing
%% state (and fail over into it) before the node monitor stops us, or
%% by using unmirrored queues and just having them vanish (and
-%% confiming messages as thrown away).
+%% confirming messages as thrown away).
%%
%% So we have channels call in here before issuing confirms, to do a
%% lightweight check that we have not entered a pausing state.
diff --git a/src/rabbit_priority_queue.erl b/src/rabbit_priority_queue.erl
index 621f42dafb..12d3291b54 100644
--- a/src/rabbit_priority_queue.erl
+++ b/src/rabbit_priority_queue.erl
@@ -22,7 +22,7 @@
-behaviour(rabbit_backing_queue).
-%% enabled unconditionally. Disabling priority queueing after
+%% enabled unconditionally. Disabling priority queuing after
%% it has been enabled is dangerous.
-rabbit_boot_step({?MODULE,
[{description, "enable priority queue"},
@@ -55,7 +55,7 @@
-define(passthrough3(F),
{Res1, Res2, BQS1} = BQ:F, {Res1, Res2, State#passthrough{bqs = BQS1}}).
-%% This module adds suport for priority queues.
+%% This module adds support for priority queues.
%%
%% Priority queues have one backing queue per priority. Backing queue functions
%% then produce a list of results for each BQ and fold over them, sorting
diff --git a/src/rabbit_queue_consumers.erl b/src/rabbit_queue_consumers.erl
index 2ede7b7b8e..5bea00a710 100644
--- a/src/rabbit_queue_consumers.erl
+++ b/src/rabbit_queue_consumers.erl
@@ -86,8 +86,8 @@ inactive(#state{consumers = Consumers}) ->
priority_queue:is_empty(Consumers).
-spec all(state()) -> [{ch(), rabbit_types:ctag(), boolean(),
- non_neg_integer(), rabbit_framing:amqp_table(),
- rabbit_types:username()}].
+ non_neg_integer(), boolean(), atom(),
+ rabbit_framing:amqp_table(), rabbit_types:username()}].
all(State) ->
all(State, none, false).
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl
index e4047a9902..61373e49c1 100644
--- a/src/rabbit_queue_index.erl
+++ b/src/rabbit_queue_index.erl
@@ -355,7 +355,7 @@ pre_publish(MsgOrId, SeqId, MsgProps, IsPersistent, IsDelivered, JournalSizeHint
State1#qistate{pre_publish_cache = PPC1,
delivered_cache = DC1})).
-%% pre_publish_cache is the entry with most elements when comapred to
+%% pre_publish_cache is the entry with most elements when compared to
%% delivered_cache so we only check the former in the guard.
maybe_flush_pre_publish_cache(JournalSizeHint,
#qistate{pre_publish_cache = PPC} = State)
diff --git a/src/rabbit_quorum_queue.erl b/src/rabbit_quorum_queue.erl
index 613623b43f..083acbb2d2 100644
--- a/src/rabbit_quorum_queue.erl
+++ b/src/rabbit_quorum_queue.erl
@@ -85,8 +85,8 @@ init_state({Name, _}, QName = #resource{}) ->
fun() -> credit_flow:unblock(Name), ok end).
-spec handle_event({'ra_event', amqqueue:ra_server_id(), any()}, rabbit_fifo_client:state()) ->
- {'internal', Correlators :: [term()], rabbit_fifo_client:state()} |
- {rabbit_fifo:client_msg(), rabbit_fifo_client:state()}.
+ {internal, Correlators :: [term()], rabbit_fifo_client:actions(), rabbit_fifo_client:state()} |
+ {rabbit_fifo:client_msg(), rabbit_fifo_client:state()} | eol.
handle_event({ra_event, From, Evt}, QState) ->
rabbit_fifo_client:handle_ra_event(From, Evt, QState).
@@ -559,12 +559,7 @@ info(Q, Items) ->
stat(Q) when ?is_amqqueue(Q) ->
Leader = amqqueue:get_pid(Q),
try
- case rabbit_fifo_client:stat(Leader) of
- {ok, _, _} = Stat ->
- Stat;
- _ ->
- {ok, 0, 0}
- end
+ {ok, _, _} = rabbit_fifo_client:stat(Leader)
catch
_:_ ->
%% Leader is not available, cluster might be in minority
@@ -920,7 +915,7 @@ format(Q) when ?is_amqqueue(Q) ->
is_process_alive(Name, Node) ->
erlang:is_pid(rpc:call(Node, erlang, whereis, [Name], ?RPC_TIMEOUT)).
--spec quorum_messages(atom()) -> non_neg_integer().
+-spec quorum_messages(rabbit_amqqueue:name()) -> non_neg_integer().
quorum_messages(QName) ->
case ets:lookup(queue_coarse_metrics, QName) of
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 3a2d4650ca..c0cb9c57d5 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -240,7 +240,7 @@ server_properties(Protocol) ->
{ok, RawConfigServerProps} = application:get_env(rabbit,
server_properties),
- %% Normalize the simplifed (2-tuple) and unsimplified (3-tuple) forms
+ %% Normalize the simplified (2-tuple) and unsimplified (3-tuple) forms
%% from the config and merge them with the generated built-in properties
NormalizedConfigServerProps =
[{<<"capabilities">>, table, server_capabilities(Protocol)} |
@@ -852,7 +852,7 @@ handle_exception(State = #v1{connection = #connection{protocol = Protocol},
respond_and_close(State, Channel, Protocol, Reason,
{handshake_error, CS, Reason});
%% when negotiation fails, e.g. due to channel_max being higher than the
-%% maxiumum allowed limit
+%% maximum allowed limit
handle_exception(State = #v1{connection = #connection{protocol = Protocol,
log_name = ConnName,
user = User},
diff --git a/src/rabbit_trace.erl b/src/rabbit_trace.erl
index 2c85de2f3a..64f197e899 100644
--- a/src/rabbit_trace.erl
+++ b/src/rabbit_trace.erl
@@ -106,7 +106,7 @@ trace(#exchange{name = Name}, #basic_message{exchange_name = Name},
ok;
trace(X, Msg = #basic_message{content = #content{payload_fragments_rev = PFR}},
RKPrefix, RKSuffix, Extra) ->
- {ok, _} = rabbit_basic:publish(
+ ok = rabbit_basic:publish(
X, <<RKPrefix/binary, ".", RKSuffix/binary>>,
#'P_basic'{headers = msg_to_table(Msg) ++ Extra}, PFR),
ok.
diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl
index f452d5c92f..83ec692ff3 100644
--- a/src/rabbit_upgrade.erl
+++ b/src/rabbit_upgrade.erl
@@ -31,7 +31,7 @@
%% clusters.
%%
%% Firstly, we have two different types of upgrades to do: Mnesia and
-%% everythinq else. Mnesia upgrades must only be done by one node in
+%% everything else. Mnesia upgrades must only be done by one node in
%% the cluster (we treat a non-clustered node as a single-node
%% cluster). This is the primary upgrader. The other upgrades need to
%% be done by all nodes.
@@ -314,7 +314,7 @@ node_type_legacy() ->
%% hang), we can't look at the config file (may not include us
%% even if we're a disc node). We also can't use
%% rabbit_mnesia:node_type/0 because that will give false
- %% postivies on Rabbit up to 2.5.1.
+ %% positives on Rabbit up to 2.5.1.
case filelib:is_regular(filename:join(dir(), "rabbit_durable_exchange.DCD")) of
true -> disc;
false -> ram
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 8b773f2cc2..e2b4f64a8f 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -1735,7 +1735,7 @@ purge_and_index_reset(State) ->
%%
%% purge_betas_and_deltas/2 loads messages from the queue index,
%% filling up q3 and in some cases moving messages form q2 to q3 while
-%% reseting q2 to an empty queue (see maybe_deltas_to_betas/2). The
+%% resetting q2 to an empty queue (see maybe_deltas_to_betas/2). The
%% messages loaded into q3 are removed by calling
%% remove_queue_entries/3 until there are no more messages to be read
%% from the queue index. Messages are read in batches from the queue
@@ -1939,7 +1939,7 @@ maybe_write_msg_to_disk(Force, MsgStatus = #msg_status {
maybe_write_msg_to_disk(_Force, MsgStatus, State) ->
{MsgStatus, State}.
-%% Due to certain optimizations made inside
+%% Due to certain optimisations made inside
%% rabbit_queue_index:pre_publish/7 we need to have two separate
%% functions for index persistence. This one is only used when paging
%% during memory pressure. We didn't want to modify