feat(ds): restore original add_generation/update_db_config callback semantics

This commit is contained in:
Ilya Averyanov 2023-12-29 13:05:45 +03:00
parent a3fc4fa5c3
commit 9e0f3ce53b
3 changed files with 9 additions and 9 deletions

View File

@ -22,7 +22,7 @@
-module(emqx_ds).
%% Management API:
-export([open_db/2, add_generation/2, add_generation/1, drop_db/1]).
-export([open_db/2, update_db_config/2, add_generation/1, drop_db/1]).
%% Message storage API:
-export([store_batch/2, store_batch/3]).
@ -126,7 +126,7 @@
-callback add_generation(db()) -> ok | {error, _}.
-callback add_generation(db(), create_db_opts()) -> ok | {error, _}.
-callback update_db_config(db(), create_db_opts()) -> ok | {error, _}.
-callback drop_db(db()) -> ok | {error, _}.
@ -162,9 +162,9 @@ open_db(DB, Opts = #{backend := Backend}) when Backend =:= builtin orelse Backen
add_generation(DB) ->
?module(DB):add_generation(DB).
-spec add_generation(db(), create_db_opts()) -> ok.
add_generation(DB, Opts) ->
?module(DB):add_generation(DB, Opts).
-spec update_db_config(db(), create_db_opts()) -> ok.
update_db_config(DB, Opts) ->
?module(DB):update_db_config(DB, Opts).
%% @doc TODO: currently if one or a few shards are down, they won't be

View File

@ -24,7 +24,7 @@
list_shards/1,
open_db/2,
add_generation/1,
add_generation/2,
update_db_config/2,
drop_db/1,
store_batch/3,
get_streams/3,
@ -130,8 +130,8 @@ add_generation(DB) ->
_ = emqx_ds_proto_v2:add_generation(Nodes, DB),
ok.
-spec add_generation(emqx_ds:db(), builtin_db_opts()) -> ok | {error, _}.
add_generation(DB, CreateOpts) ->
-spec update_db_config(emqx_ds:db(), builtin_db_opts()) -> ok | {error, _}.
update_db_config(DB, CreateOpts) ->
emqx_ds_replication_layer_meta:update_db_config(DB, CreateOpts).
-spec drop_db(emqx_ds:db()) -> ok | {error, _}.

View File

@ -180,7 +180,7 @@ t_05_update_config(_Config) ->
{false, TimeAcc, [Msgs | MsgAcc]};
(Datas, {Any, TimeAcc, MsgAcc}) ->
timer:sleep(500),
?assertMatch(ok, emqx_ds:add_generation(DB, opts())),
?assertMatch(ok, emqx_ds:update_db_config(DB, opts())),
timer:sleep(500),
StartTime = emqx_message:timestamp_now(),
Msgs = ToMsgs(Datas),