-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Make empty CQ init faster in case of clean shutdown #13856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
variable_queue_dropfetchwhile, | ||
variable_queue_dropwhile_restart, | ||
variable_queue_dropwhile_sync_restart, | ||
variable_queue_restart_large_seq_id, | ||
variable_queue_ack_limiting, | ||
variable_queue_purge, | ||
variable_queue_requeue, | ||
|
@@ -1421,6 +1422,45 @@ variable_queue_dropwhile_sync_restart2(VQ0, QName) -> | |
|
||
VQ5. | ||
|
||
variable_queue_restart_large_seq_id(Config) -> | ||
passed = rabbit_ct_broker_helpers:rpc(Config, 0, | ||
?MODULE, variable_queue_restart_large_seq_id1, [Config]). | ||
|
||
variable_queue_restart_large_seq_id1(Config) -> | ||
with_fresh_variable_queue( | ||
fun variable_queue_restart_large_seq_id2/2, | ||
?config(variable_queue_type, Config)). | ||
|
||
variable_queue_restart_large_seq_id2(VQ0, QName) -> | ||
Count = 1, | ||
|
||
%% publish and consume a message | ||
VQ1 = publish_fetch_and_ack(Count, 0, VQ0), | ||
%% should be empty now | ||
true = rabbit_variable_queue:is_empty(VQ1), | ||
|
||
_VQ2 = rabbit_variable_queue:terminate(shutdown, VQ1), | ||
Terms = variable_queue_read_terms(QName), | ||
Count = proplists:get_value(next_seq_id, Terms), | ||
|
||
%% set a very high next_seq_id as if 100M messages have been | ||
%% published and consumed | ||
Terms2 = lists:keyreplace(next_seq_id, 1, Terms, {next_seq_id, 100_000_000}), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably test that the bounds returned by the index are correct. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will work on a follow-up PR to update There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We only care about v2 so Low = High = Next? |
||
|
||
{TInit, VQ3} = | ||
timer:tc( | ||
fun() -> variable_queue_init(test_amqqueue(QName, true), Terms2) end, | ||
millisecond), | ||
%% even with a very high next_seq_id start of an empty queue | ||
%% should be quick (few milliseconds, but let's give it 100ms, to | ||
%% avoid flaking on slow servers) | ||
{true, _} = {TInit < 100, TInit}, | ||
|
||
%% should be empty now | ||
true = rabbit_variable_queue:is_empty(VQ3), | ||
|
||
VQ3. | ||
|
||
variable_queue_ack_limiting(Config) -> | ||
passed = rabbit_ct_broker_helpers:rpc(Config, 0, | ||
?MODULE, variable_queue_ack_limiting1, [Config]). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only
backing_queue_SUITE:bq_queue_index
test case usesbounds/1
. If I understand correctly this test case tests the index module itself. I keptbounds/1
as the v1 index also has a function with the same signature (although that is not tested any more bybacking_queue_SUITE
and it will go away eventually) Maybebq_queue_index
should be modified to testbounds/2
instead, sometimes theNextSeqIdHint
beingundefined
and sometimes an integer?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gomoripeti that sounds reasonable to me. Let's do that in a follow-up PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.