Skip to content

Commit

Permalink
Merge pull request #8528 from thalesmg/persistent-session-optional-ro…
Browse files Browse the repository at this point in the history
…cksdb

feat(persistent_sessions): don't use rocksdb when unavailable
  • Loading branch information
thalesmg committed Jul 22, 2022
2 parents a14a96b + 343a78b commit 7ad0dc7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 7ad0dc7

Please sign in to comment.