-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Only preserve stats for local queues #1278
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
Conversation
Simplifies code formatting by using intermediate variables in test suite setup.
Previously, GC would not clear out metrics for non-local queues, so stale data remained in the metrics tables.
Why triggering a full GC when it is know which queue is being synchronised? If we want to show the queue changes instantly, it would be more effective to GC only the named queue. |
src/rabbit_core_metrics_gc.erl
Outdated
handle_info({run_gc_soon, Interval}, State) -> | ||
{noreply, start_timer(Interval, State)}; | ||
handle_info(run_gc_soon, State) -> | ||
{noreply, start_timer(5000, State)}; |
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.
Use an interval from config, so the default could be easily changed.
src/rabbit_mirror_queue_sync.erl
Outdated
|
||
run_gc_soon() -> | ||
rabbit_core_metrics_gc:run_gc_soon(), | ||
rabbit_mgmt_gc:run_gc_soon(). |
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.
rabbit
application can never call anything on rabbitmq_management
or rabbitmq_management_agent
as those plugins might or might not be active. The dependency is the other way around.
=ERROR REPORT==== 3-Jul-2017::14:07:12 ===
Error in process <0.631.0> on node 'rmq-ct-cluster_tests-1-21000@localhost' with exit value:
{undef,[{rabbit_mgmt_gc,run_gc_soon,[],[]},
{rabbit_mirror_queue_sync,syncer_loop,3,
[{file,"src/rabbit_mirror_queue_sync.erl"},
{line,266}]}]}
% when a node starts. | ||
rabbit_ct_broker_helpers:rpc(Config, Node0, rabbit_core_metrics_gc, start_link, []), | ||
rabbit_ct_broker_helpers:rpc(Config, Node1, rabbit_core_metrics_gc, start_link, []), | ||
rabbit_ct_broker_helpers:rpc(Config, Node0, rabbit_mgmt_gc, start_link, []), |
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.
This part of the test (call rabbit_mgmt_gc
) could never work on the rabbit
app, as the management application is not started.
=== Ended at 2017-07-03 14:07:12
=== Location: [{rabbit_ct_broker_helpers,rpc,967},
{rabbit_core_metrics_gc_SUITE,cluster_queue_metrics,383},
{test_server,ts_tc,1533},
{test_server,run_test_case_eval1,1053},
{test_server,run_test_case_eval,985}]
=== Reason: undefined function rabbit_mgmt_gc:run_gc_soon/1
in function rpc:'-handle_call_call/6-fun-0-'/5 (rpc.erl, line 187)
=ERROR REPORT==== 3-Jul-2017::14:07:12 ===
Error in process <0.631.0> on node 'rmq-ct-cluster_tests-1-21000@localhost' with exit value:
{undef,[{rabbit_mgmt_gc,run_gc_soon,[],[]},
{rabbit_mirror_queue_sync,syncer_loop,3,
[{file,"src/rabbit_mirror_queue_sync.erl"},
{line,266}]}]}
Node0 = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename), | ||
Node1 = rabbit_ct_broker_helpers:get_node_config(Config, 1, nodename), | ||
|
||
% Note: must start these processes as there is a delay in starting them up |
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.
Wait until everything is started
% Note: the default is to schedule a GC 5 seconds after a sync, but we want it a bit | ||
% sooner here. Note that running it too soon can cause badarg errors for missing | ||
% stats tables | ||
rabbit_ct_broker_helpers:rpc(Config, Node0, rabbit_core_metrics_gc, run_gc_soon, [1000]), |
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.
Why trigger it manually? Then the test will never verify that the synchronisation is doing the clean up. Moreover, setting a configurable default will allow to reduce the wait time
c77ec2a
to
872cdd2
Compare
This change handles all non-crash termination cases. The assumption here is that once an amqqueue_process terminates the master is no longer on the current node. [#147753285]
872cdd2
to
0e9b333
Compare
Fixes rabbitmq/rabbitmq-management#427
By using
list_local_names
, metrics entries that are stale are removed.