Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ds): avoid crashes when starting on Windows #11352

Merged
merged 3 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion apps/emqx_durable_storage/src/emqx_ds_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

-module(emqx_ds_app).

-dialyzer({nowarn_function, storage/0}).

-export([start/2]).

-include("emqx_ds_int.hrl").
Expand All @@ -13,13 +15,22 @@ start(_Type, _Args) ->
emqx_ds_sup:start_link().

init_mnesia() ->
%% FIXME: This is a temporary workaround to avoid crashes when starting on Windows
ok = mria:create_table(
?SESSION_TAB,
[
{rlog_shard, ?DS_SHARD},
{type, set},
{storage, rocksdb_copies},
{storage, storage()},
{record_name, session},
{attributes, record_info(fields, session)}
]
).

storage() ->
case mria:rocksdb_backend_available() of
true ->
rocksdb_copies;
_ ->
disc_copies
end.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{application, emqx_durable_storage, [
{description, "Message persistence and subscription replays for EMQX"},
% strict semver, bump manually!
{vsn, "0.1.1"},
{vsn, "0.1.2"},
{modules, []},
{registered, []},
{applications, [kernel, stdlib, rocksdb, gproc, mria]},
Expand Down
1 change: 1 addition & 0 deletions changes/ce/fix-11352.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed this [#11345](https://github.com/emqx/emqx/issues/11345) crash issue when starting on Windows or any other platform without RocksDB support.