When `system_monitor`'s application is loaded, it sets a default
hostname:
```erlang
1> application:get_env(system_monitor, db_hostname).
undefined
2> application:load(system_monitor).
ok
3> application:get_env(system_monitor, db_hostname).
{ok,"localhost"}
```
And that makes tests crash when somehow it gets loaded.
By having a semantic `enable` field, we could avoid starting this
application by checking if the hostname is filled or not.
```
=ERROR REPORT==== 1-Dec-2022::13:57:20.855070 ===
** Generic server <0.7646.3> terminating
** Last message in was {command,epgsql_cmd_connect,
#{codecs => [],database => "postgres",
host => [],
password =>
#Fun<epgsql_cmd_connect.0.29916615>,
port => 5432,timeout => 5000,
username => "system_monitor"}}
** When Server state == {state,undefined,undefined,<<>>,undefined,on_message,
undefined,
{[],[]},
undefined,undefined,undefined,undefined,[],
information_redacted,[],undefined,undefined,
undefined,undefined,undefined,#{}}
** Reason for termination ==
** {badarg,
[{gen_tcp,connect_0,4,[{file,"gen_tcp.erl"},{line,207}]},
{epgsql_cmd_connect,open_socket,2,
[{file,
"/emqx/_build/default/lib/epgsql/src/commands/epgsql_cmd_connect.erl"},
{line,94}]},
{epgsql_cmd_connect,execute,2,
[{file,
"/emqx/_build/default/lib/epgsql/src/commands/epgsql_cmd_connect.erl"},
{line,54}]},
{epgsql_sock,command_exec,4,
[{file,"/emqx/_build/default/lib/epgsql/src/epgsql_sock.erl"},
{line,338}]},
{gen_server,try_handle_call,4,[{file,"gen_server.erl"},{line,721}]},
{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,750}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}
** Client system_monitor_pg stacktrace
** [{gen,do_call,4,[{file,"gen.erl"},{line,214}]},
{gen_server,call,3,[{file,"gen_server.erl"},{line,243}]},
{epgsql,call_connect,2,
[{file,"/emqx/_build/default/lib/epgsql/src/epgsql.erl"},
{line,203}]},
{system_monitor_pg,connect,0,
[{file,"/emqx/_build/default/lib/system_monitor/src/system_monitor_pg.erl"},
{line,151}]},
{system_monitor_pg,initialize,0,
[{file,"/emqx/_build/default/lib/system_monitor/src/system_monitor_pg.erl"},
{line,142}]},
{system_monitor_pg,handle_info,2,
[{file,"/emqx/_build/default/lib/system_monitor/src/system_monitor_pg.erl"},
{line,92}]},
{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,695}]},
{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,771}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]
=CRASH REPORT==== 1-Dec-2022::13:57:20.855697 ===
crasher:
initial call: epgsql_sock:init/1
pid: <0.7646.3>
registered_name: []
exception exit: badarg
in function gen_tcp:connect_0/4 (gen_tcp.erl, line 207)
in call from epgsql_cmd_connect:open_socket/2 (/emqx/_build/default/lib/epgsql/src/commands/epgsql_cmd_connect.erl, line 94)
in call from epgsql_cmd_connect:execute/2 (/emqx/_build/default/lib/epgsql/src/commands/epgsql_cmd_connect.erl, line 54)
in call from epgsql_sock:command_exec/4 (/emqx/_build/default/lib/epgsql/src/epgsql_sock.erl, line 338)
in call from gen_server:try_handle_call/4 (gen_server.erl, line 721)
in call from gen_server:handle_msg/6 (gen_server.erl, line 750)
ancestors: [system_monitor_pg,system_monitor2_sup,system_monitor_sup,
<0.4297.3>]
message_queue_len: 0
messages: []
links: [<0.4303.3>]
dictionary: []
trap_exit: false
status: running
heap_size: 1598
stack_size: 29
reductions: 734
neighbours:
```
This commit removes support for setting shared subscriptions with the
non-standard $queue feature. Shared subscriptions is now part of the MQTT
spec (using $shared) and we will only support that from now on.
In the previous, when you query the tail pages, all the front of rows
will be queried out and formatted. It greatly hurts the speed of query.
Currently, we only format the final result rows. i.e, the query for the
last page of data will be 10x faster.
since this suite has changed its start method to the `emqx_common_test_helpers:start_apps/1`, the `emqx_banned` server will never stop (its restart type is permanent), thus there is no need to manually start or stops it.
We need to check the true topic of the delayed message correctly
the cheapest way to do this is to extract the true topic from the original topic when doing ACL check