From 8add6caf6cb2e9e212764a41936861136d688889 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Sun, 6 Mar 2022 23:25:15 +0100 Subject: [PATCH] Print kiss tables in mongoosectl mnesia info --- rebar.lock | 2 +- src/ejabberd_ctl.erl | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/rebar.lock b/rebar.lock index faa287c1e8..ccc65f6497 100644 --- a/rebar.lock +++ b/rebar.lock @@ -63,7 +63,7 @@ 0}, {<<"kiss">>, {git,"https://github.com/arcusfelis/kiss.git", - {ref,"13c701e0eeeb7ade2c1518f54bea416578591ae5"}}, + {ref,"8e803b23060ab691b1971c1e6a4985642eae74bd"}}, 0}, {<<"lager">>,{pkg,<<"lager">>,<<"3.9.2">>},0}, {<<"lasse">>,{pkg,<<"lasse">>,<<"1.2.0">>},0}, diff --git a/src/ejabberd_ctl.erl b/src/ejabberd_ctl.erl index 6946163cf5..79a0fc9603 100644 --- a/src/ejabberd_ctl.erl +++ b/src/ejabberd_ctl.erl @@ -170,6 +170,7 @@ process(["mnesia"]) -> ?STATUS_SUCCESS; process(["mnesia", "info"]) -> mnesia:info(), + kiss_info(), ?STATUS_SUCCESS; process(["mnesia", Arg]) when is_list(Arg) -> case catch mnesia:system_info(list_to_atom(Arg)) of @@ -928,3 +929,15 @@ get_dist_proto() -> _ -> "inet_tcp" end. +kiss_info() -> + Tables = kiss_discovery:info(mongoose_kiss_discovery), + kiss_info(Tables). + +kiss_info([]) -> + ok; +kiss_info(Tables) -> + ?PRINT("Kiss tables:~n", []), + [kiss_table_info(Table) || Table <- Tables]. + +kiss_table_info(#{memory := Memory, size := Size, nodes := Nodes, table := Tab}) -> + ?PRINT("table=~0p size=~p memory=~0p words nodes=~0p~n", [Tab, Size, Memory, Nodes]).