feat(persistent_sessions): don't use rocksdb when unavailable
This commit is contained in:
parent
a14a96b0a3
commit
343a78b08a
|
@ -16,6 +16,7 @@
|
|||
* Fix bad swagger format. [#8517](https://github.com/emqx/emqx/pull/8517)
|
||||
* Fix `chars_limit` is not working when `formatter` is `json`. [#8518](http://github.com/emqx/emqx/pull/8518)
|
||||
* Ensuring that exhook dispatches the client events are sequential. [#8530](https://github.com/emqx/emqx/pull/8530)
|
||||
* Avoid using RocksDB backend for persistent sessions when such backend is unavailable. [#8528](https://github.com/emqx/emqx/pull/8528)
|
||||
|
||||
## Enhancements
|
||||
|
||||
|
|
|
@ -131,16 +131,23 @@ storage_properties(_, Backend) when ?IS_ETS(Backend) ->
|
|||
storage_properties(_, _) ->
|
||||
[].
|
||||
|
||||
%% Dialyzer sees the compiled literal in
|
||||
%% `mria:rocksdb_backend_available/0' and complains about the
|
||||
%% complementar match arm...
|
||||
-dialyzer({no_match, table_type/1}).
|
||||
-spec table_type(atom()) -> mria_table_type().
|
||||
table_type(Table) ->
|
||||
DiscPersistence = emqx_config:get([?cfg_root, on_disc]),
|
||||
RamCache = get_overlayed(Table, ram_cache),
|
||||
case {DiscPersistence, RamCache} of
|
||||
{true, true} ->
|
||||
RocksDBAvailable = mria:rocksdb_backend_available(),
|
||||
case {DiscPersistence, RamCache, RocksDBAvailable} of
|
||||
{true, true, _} ->
|
||||
disc_copies;
|
||||
{true, false} ->
|
||||
{true, false, true} ->
|
||||
rocksdb_copies;
|
||||
{false, _} ->
|
||||
{true, false, false} ->
|
||||
disc_copies;
|
||||
{false, _, _} ->
|
||||
ram_copies
|
||||
end.
|
||||
|
||||
|
|
Loading…
Reference in New Issue