Skip to content

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

Merged
merged 13 commits into from
Jul 10, 2017
Merged

Conversation

lukebakken
Copy link
Collaborator

@lukebakken lukebakken commented Jun 29, 2017

Fixes rabbitmq/rabbitmq-management#427

By using list_local_names, metrics entries that are stale are removed.

@lukebakken lukebakken changed the title WIP: Only preserve stats for local queues Only preserve stats for local queues Jun 30, 2017
@lukebakken lukebakken requested a review from dcorbacho June 30, 2017 13:54
@dcorbacho
Copy link
Contributor

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.

handle_info({run_gc_soon, Interval}, State) ->
{noreply, start_timer(Interval, State)};
handle_info(run_gc_soon, State) ->
{noreply, start_timer(5000, State)};
Copy link
Contributor

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.


run_gc_soon() ->
rabbit_core_metrics_gc:run_gc_soon(),
rabbit_mgmt_gc:run_gc_soon().
Copy link
Contributor

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, []),
Copy link
Contributor

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
Copy link
Contributor

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]),
Copy link
Contributor

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

@kjnilsson kjnilsson force-pushed the rabbitmq-management-427 branch 2 times, most recently from c77ec2a to 872cdd2 Compare July 4, 2017 11:23
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]
@kjnilsson kjnilsson force-pushed the rabbitmq-management-427 branch from 872cdd2 to 0e9b333 Compare July 4, 2017 13:45
@michaelklishin michaelklishin merged commit e5fea8d into stable Jul 10, 2017
@lukebakken lukebakken deleted the rabbitmq-management-427 branch July 10, 2017 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants