Enable the per-vhost store again

The rule for per-vhost/per-queue will be the same as
non-embedded/embedded for the time being. In the future
after mirrored queues are removed we can restrict further
the per-vhost store.
This commit is contained in:
Loïc Hoguin 2021-09-16 15:34:04 +02:00
parent 2473ff7328
commit 6e3855fbc8
No known key found for this signature in database
GPG Key ID: C69E26E3A9DF618F
2 changed files with 35 additions and 35 deletions

View File

@ -889,7 +889,7 @@ handle_ch_down(DownPid, State = #q{consumers = Consumers,
%% A rabbit_channel process died. Here credit_flow will take care
%% of cleaning up the rabbit_amqqueue_process process dictionary
%% with regards to the credit we were tracking for the channel
%% process. See handle_cast({deliver, Deliver}, State) in this
%% process. See handle_cast({deliver, Deliver, ...}, State) in this
%% module. In that cast function we process deliveries from the
%% channel, which means we credit_flow:ack/1 said
%% messages. credit_flow:ack'ing messages means we are increasing

View File

@ -2163,40 +2163,40 @@ maybe_prepare_write_to_disk(ForceMsg, ForceIndex, MsgStatus, State) ->
%% to persist to the message store, because reference
%% counting is useful for large fan-outs. If not, then
%% we just use the per queue store.
determine_persist_to(_, _, _) -> queue_store. % msg_store.
%determine_persist_to(#basic_message{
% content = #content{properties = Props,
% properties_bin = PropsBin}},
% #message_properties{size = BodySize},
% IndexMaxSize) ->
% %% The >= is so that you can set the env to 0 and never persist
% %% to the index.
% %%
% %% We want this to be fast, so we avoid size(term_to_binary())
% %% here, or using the term size estimation from truncate.erl, both
% %% of which are too slow. So instead, if the message body size
% %% goes over the limit then we avoid any other checks.
% %%
% %% If it doesn't we need to decide if the properties will push
% %% it past the limit. If we have the encoded properties (usual
% %% case) we can just check their size. If we don't (message came
% %% via the direct client), we make a guess based on the number of
% %% headers.
% case BodySize >= IndexMaxSize of
% true -> msg_store;
% false -> Est = case is_binary(PropsBin) of
% true -> BodySize + size(PropsBin);
% false -> #'P_basic'{headers = Hs} = Props,
% case Hs of
% undefined -> 0;
% _ -> length(Hs)
% end * ?HEADER_GUESS_SIZE + BodySize
% end,
% case Est >= IndexMaxSize of
% true -> msg_store;
% false -> queue_index
% end
% end.
%determine_persist_to(_, _, _) -> queue_store. % msg_store.
determine_persist_to(#basic_message{
content = #content{properties = Props,
properties_bin = PropsBin}},
#message_properties{size = BodySize},
IndexMaxSize) ->
%% The >= is so that you can set the env to 0 and never persist
%% to the index.
%%
%% We want this to be fast, so we avoid size(term_to_binary())
%% here, or using the term size estimation from truncate.erl, both
%% of which are too slow. So instead, if the message body size
%% goes over the limit then we avoid any other checks.
%%
%% If it doesn't we need to decide if the properties will push
%% it past the limit. If we have the encoded properties (usual
%% case) we can just check their size. If we don't (message came
%% via the direct client), we make a guess based on the number of
%% headers.
case BodySize >= IndexMaxSize of
true -> msg_store;
false -> Est = case is_binary(PropsBin) of
true -> BodySize + size(PropsBin);
false -> #'P_basic'{headers = Hs} = Props,
case Hs of
undefined -> 0;
_ -> length(Hs)
end * ?HEADER_GUESS_SIZE + BodySize
end,
case Est >= IndexMaxSize of
true -> msg_store;
false -> queue_store
end
end.
persist_to(#msg_status{persist_to = To}) -> To.