Throw away stats for dead masters.

This commit is contained in:
Simon MacMullen 2012-07-17 17:47:47 +01:00
parent 52c96b8396
commit 9afdc577ac
1 changed files with 8 additions and 0 deletions

View File

@ -376,6 +376,14 @@ handle_event(#event{type = consumer_deleted, props = Props}, State) ->
handle_consumer(fun(Table, Id, _P) -> ets:delete(Table, Id) end,
Props, State);
handle_event(#event{type = queue_mirror_deaths, props = Props},
State = #state{tables = Tables}) ->
Dead = pget(pids, Props),
Table = orddict:fetch(queue_stats, Tables),
%% Only the master can be in the DB, but it's easier just to
%% delete all of them
[ets:delete(Table, {Pid, stats}) || Pid <- Dead];
%% TODO: we don't clear up after dead nodes here - this is a very tiny
%% leak every time a node is permanently removed from the cluster. Do
%% we care?