diff options
| -rw-r--r-- | src/rabbit_amqqueue.erl | 19 | ||||
| -rw-r--r-- | src/rabbit_vm.erl | 41 |
2 files changed, 35 insertions, 25 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index 76f3fa6bf3..ff57593374 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -597,7 +597,8 @@ list_local_names() -> State =/= crashed, node() =:= node(QPid) ]. -list(VHostPath) -> list(VHostPath, rabbit_queue). +list(VHostPath) -> + list(VHostPath, rabbit_queue). %% Not dirty_match_object since that would not be transactional when used in a %% tx context @@ -611,12 +612,16 @@ list(VHostPath, TableName) -> end). list_down(VHostPath) -> - Present = list(VHostPath), - Durable = list(VHostPath, rabbit_durable_queue), - PresentS = sets:from_list([N || #amqqueue{name = N} <- Present]), - sets:to_list(sets:filter(fun (#amqqueue{name = N}) -> - not sets:is_element(N, PresentS) - end, sets:from_list(Durable))). + case rabbit_vhost:exists(VHostPath) of + false -> []; + true -> + Present = list(VHostPath), + Durable = list(VHostPath, rabbit_durable_queue), + PresentS = sets:from_list([N || #amqqueue{name = N} <- Present]), + sets:to_list(sets:filter(fun (#amqqueue{name = N}) -> + not sets:is_element(N, PresentS) + end, sets:from_list(Durable))) + end. count(VHost) -> try diff --git a/src/rabbit_vm.erl b/src/rabbit_vm.erl index 3ae482a934..88062dc32a 100644 --- a/src/rabbit_vm.erl +++ b/src/rabbit_vm.erl @@ -40,27 +40,32 @@ memory() -> [aggregate(Names, Sums, memory, fun (X) -> X end) || Names <- distinguished_interesting_sups()], - MnesiaETS = mnesia_memory(), - MsgIndexETS = ets_memory(msg_stores()), - MetricsETS = ets_memory([rabbit_metrics]), - MetricsProc = - try - [{_, M}] = process_info(whereis(rabbit_metrics), [memory]), - M - catch - error:badarg -> - 0 - end, - MgmtDbETS = ets_memory([rabbit_mgmt_storage]), - OsTotal = vm_memory_monitor:get_process_memory(), - - [{processes, Processes}, + MnesiaETS = mnesia_memory(), + MsgIndexETS = ets_memory(msg_stores()), + MetricsETS = ets_memory([rabbit_metrics]), + MetricsProc = try + [{_, M}] = process_info(whereis(rabbit_metrics), [memory]), + M + catch + error:badarg -> + 0 + end, + MgmtDbETS = ets_memory([rabbit_mgmt_storage]), + VMTotal = vm_memory_monitor:get_process_memory(), + + [{total, ErlangTotal}, + {processes, Processes}, {ets, ETS}, {atom, Atom}, {binary, Bin}, {code, Code}, {system, System}] = - erlang:memory([processes, ets, atom, binary, code, system]), + erlang:memory([total, processes, ets, atom, binary, code, system]), + + Unaccounted = case VMTotal - ErlangTotal of + GTZ when GTZ > 0 -> GTZ; + _LTZ -> 0 + end, OtherProc = Processes - ConnsReader - ConnsWriter - ConnsChannel - ConnsOther @@ -96,9 +101,9 @@ memory() -> %% System {code, Code}, {atom, Atom}, - {other_system, System - ETS - Bin - Code - Atom}, + {other_system, System - ETS - Bin - Code - Atom + Unaccounted}, - {total, OsTotal} + {total, VMTotal} ]. %% [1] - erlang:memory(processes) can be less than the sum of its %% parts. Rather than display something nonsensical, just silence any |
