Browse Source

fix(ds): Abort application startup when rocksdb is not avialable

ieQu1 2 years atrás
parent
commit
3165b4f645

+ 0 - 6
apps/emqx/src/emqx_persistent_session_ds.erl

@@ -440,12 +440,6 @@ del_subscription(TopicFilter, DSSessionId) ->
 %%--------------------------------------------------------------------
 
 create_tables() ->
-    ok = emqx_ds:open_db(?PERSISTENT_MESSAGE_DB, #{
-        backend => builtin,
-        storage => {emqx_ds_storage_bitfield_lts, #{}},
-        n_shards => 16,
-        replication_factor => 3
-    }),
     ok = mria:create_table(
         ?SESSION_TAB,
         [

+ 8 - 1
apps/emqx_durable_storage/src/emqx_ds_sup.erl

@@ -29,8 +29,15 @@ start_link() ->
 %% behaviour callbacks
 %%================================================================================
 
+-dialyzer({nowarn_function, init/1}).
 init([]) ->
-    Children = [meta(), storage_layer_sup()],
+    %% TODO: technically, we don't need rocksDB for the alternative
+    %% backends. But right now we have any:
+    Children =
+        case mria:rocksdb_backend_available() of
+            true -> [meta(), storage_layer_sup()];
+            false -> []
+        end,
     SupFlags = #{
         strategy => one_for_all,
         intensity => 0,