Skip to content

Commit fa9c88d

Browse files
committed
fixup! WIP Remove CQv1
1 parent dcba840 commit fa9c88d

File tree

4 files changed

+8
-30
lines changed

4 files changed

+8
-30
lines changed

deps/rabbit/src/rabbit_classic_queue.erl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ supports_stateful_delivery() -> true.
430430
deliver(Qs0, Msg0, Options) ->
431431
%% add guid to content here instead of in rabbit_basic:message/3,
432432
%% as classic queues are the only ones that need it
433-
%% @todo Only if multiple queues.
434433
Msg = mc:prepare(store, mc:set_annotation(id, rabbit_guid:gen(), Msg0)),
435434
Mandatory = maps:get(mandatory, Options, false),
436435
MsgSeqNo = maps:get(correlation, Options, undefined),

deps/rabbit/src/rabbit_classic_queue_store_v2.erl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,10 @@ info(#qs{ write_buffer = WriteBuffer }) ->
145145
rabbit_types:message_properties(), State)
146146
-> {msg_location(), State} when State::state().
147147

148-
%% TODO!!
149148
%% @todo I think we can disable the old message store at the same
150149
%% place where we create MsgId. If many queues receive the
151-
%% message, then we create an MsgId. If not, we don't. But
152-
%% we can only do this after removing support for v1.
150+
%% message, then we create an MsgId. If not, we don't until
151+
%% strictly necessary (large messages).
153152
write(SeqId, Msg, Props, State0 = #qs{ write_buffer = WriteBuffer0,
154153
write_buffer_size = WriteBufferSize }) ->
155154
?DEBUG("~0p ~0p ~0p ~0p", [SeqId, Msg, Props, State0]),

deps/rabbit/src/rabbit_guid.erl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
-spec start_link() -> rabbit_types:ok_pid_or_error().
3333

34+
%% @todo Serial can be in persistent_term instead of process.
3435
start_link() ->
3536
gen_server:start_link({local, ?SERVER}, ?MODULE,
3637
[update_disk_serial()], []).

deps/rabbit/src/rabbit_variable_queue.erl

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@
251251
end_seq_id %% end_seq_id is exclusive
252252
}).
253253

254-
-define(HEADER_GUESS_SIZE, 100). %% see determine_persist_to/2
255254
-define(PERSISTENT_MSG_STORE, msg_store_persistent).
256255
-define(TRANSIENT_MSG_STORE, msg_store_transient).
257256

@@ -953,7 +952,7 @@ msg_status(IsPersistent, IsDelivered, SeqId,
953952
is_delivered = IsDelivered,
954953
msg_location = memory,
955954
index_on_disk = false,
956-
persist_to = determine_persist_to(Msg, MsgProps, IndexMaxSize),
955+
persist_to = determine_persist_to(Msg, IndexMaxSize),
957956
msg_props = MsgProps}.
958957

959958
beta_msg_status({MsgId, SeqId, MsgLocation, MsgProps, IsPersistent})
@@ -1739,33 +1738,13 @@ maybe_write_to_disk(ForceMsg, ForceIndex, MsgStatus, State) ->
17391738
{MsgStatus1, State1} = maybe_write_msg_to_disk(ForceMsg, MsgStatus, State),
17401739
maybe_write_index_to_disk(ForceIndex, MsgStatus1, State1).
17411740

1742-
determine_persist_to(Msg,
1743-
#message_properties{size = BodySize},
1744-
IndexMaxSize) ->
1741+
determine_persist_to(Msg, IndexMaxSize) ->
17451742
%% The >= is so that you can set the env to 0 and never persist
17461743
%% to the index.
1747-
%%
1748-
%% We want this to be fast, so we avoid size(term_to_binary())
1749-
%% here, or using the term size estimation from truncate.erl, both
1750-
%% of which are too slow. So instead, if the message body size
1751-
%% goes over the limit then we avoid any other checks.
1752-
%%
1753-
%% If it doesn't we need to decide if the properties will push
1754-
%% it past the limit. If we have the encoded properties (usual
1755-
%% case) we can just check their size. If we don't (message came
1756-
%% via the direct client), we make a guess based on the number of
1757-
%% headers.
1758-
1759-
%% @todo We can probably simplify this.
1760-
{MetaSize, _BodySize} = mc:size(Msg),
1761-
case BodySize >= IndexMaxSize of
1744+
{MetaSize, BodySize} = mc:size(Msg),
1745+
case MetaSize + BodySize >= IndexMaxSize of
17621746
true -> msg_store;
1763-
false ->
1764-
Est = MetaSize + BodySize,
1765-
case Est >= IndexMaxSize of
1766-
true -> msg_store;
1767-
false -> queue_store
1768-
end
1747+
false -> queue_store
17691748
end.
17701749

17711750
persist_to(#msg_status{persist_to = To}) -> To.

0 commit comments

Comments
 (0)