Skip to content

Commit e66809b

Browse files
Merge branch 'stable'
Conflicts: src/rabbit_amqqueue.erl src/rabbit_vm.erl
2 parents a36c7f3 + 46eb2e5 commit e66809b

File tree

2 files changed

+35
-25
lines changed

2 files changed

+35
-25
lines changed

src/rabbit_amqqueue.erl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ list_local_names() ->
597597
State =/= crashed,
598598
node() =:= node(QPid) ].
599599

600-
list(VHostPath) -> list(VHostPath, rabbit_queue).
600+
list(VHostPath) ->
601+
list(VHostPath, rabbit_queue).
601602

602603
%% Not dirty_match_object since that would not be transactional when used in a
603604
%% tx context
@@ -611,12 +612,16 @@ list(VHostPath, TableName) ->
611612
end).
612613

613614
list_down(VHostPath) ->
614-
Present = list(VHostPath),
615-
Durable = list(VHostPath, rabbit_durable_queue),
616-
PresentS = sets:from_list([N || #amqqueue{name = N} <- Present]),
617-
sets:to_list(sets:filter(fun (#amqqueue{name = N}) ->
618-
not sets:is_element(N, PresentS)
619-
end, sets:from_list(Durable))).
615+
case rabbit_vhost:exists(VHostPath) of
616+
false -> [];
617+
true ->
618+
Present = list(VHostPath),
619+
Durable = list(VHostPath, rabbit_durable_queue),
620+
PresentS = sets:from_list([N || #amqqueue{name = N} <- Present]),
621+
sets:to_list(sets:filter(fun (#amqqueue{name = N}) ->
622+
not sets:is_element(N, PresentS)
623+
end, sets:from_list(Durable)))
624+
end.
620625

621626
count(VHost) ->
622627
try

src/rabbit_vm.erl

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,32 @@ memory() ->
4040
[aggregate(Names, Sums, memory, fun (X) -> X end)
4141
|| Names <- distinguished_interesting_sups()],
4242

43-
MnesiaETS = mnesia_memory(),
44-
MsgIndexETS = ets_memory(msg_stores()),
45-
MetricsETS = ets_memory([rabbit_metrics]),
46-
MetricsProc =
47-
try
48-
[{_, M}] = process_info(whereis(rabbit_metrics), [memory]),
49-
M
50-
catch
51-
error:badarg ->
52-
0
53-
end,
54-
MgmtDbETS = ets_memory([rabbit_mgmt_storage]),
55-
OsTotal = vm_memory_monitor:get_process_memory(),
56-
57-
[{processes, Processes},
43+
MnesiaETS = mnesia_memory(),
44+
MsgIndexETS = ets_memory(msg_stores()),
45+
MetricsETS = ets_memory([rabbit_metrics]),
46+
MetricsProc = try
47+
[{_, M}] = process_info(whereis(rabbit_metrics), [memory]),
48+
M
49+
catch
50+
error:badarg ->
51+
0
52+
end,
53+
MgmtDbETS = ets_memory([rabbit_mgmt_storage]),
54+
VMTotal = vm_memory_monitor:get_process_memory(),
55+
56+
[{total, ErlangTotal},
57+
{processes, Processes},
5858
{ets, ETS},
5959
{atom, Atom},
6060
{binary, Bin},
6161
{code, Code},
6262
{system, System}] =
63-
erlang:memory([processes, ets, atom, binary, code, system]),
63+
erlang:memory([total, processes, ets, atom, binary, code, system]),
64+
65+
Unaccounted = case VMTotal - ErlangTotal of
66+
GTZ when GTZ > 0 -> GTZ;
67+
_LTZ -> 0
68+
end,
6469

6570
OtherProc = Processes
6671
- ConnsReader - ConnsWriter - ConnsChannel - ConnsOther
@@ -96,9 +101,9 @@ memory() ->
96101
%% System
97102
{code, Code},
98103
{atom, Atom},
99-
{other_system, System - ETS - Bin - Code - Atom},
104+
{other_system, System - ETS - Bin - Code - Atom + Unaccounted},
100105

101-
{total, OsTotal}
106+
{total, VMTotal}
102107
].
103108
%% [1] - erlang:memory(processes) can be less than the sum of its
104109
%% parts. Rather than display something nonsensical, just silence any

0 commit comments

Comments
 (0)