fix(ds): Destroy LTS tries when the generation is dropped
This commit is contained in:
parent
9999ccd36c
commit
bcfa7b2209
|
@ -19,6 +19,7 @@
|
||||||
%% API:
|
%% API:
|
||||||
-export([
|
-export([
|
||||||
trie_create/1, trie_create/0,
|
trie_create/1, trie_create/0,
|
||||||
|
destroy/1,
|
||||||
trie_restore/2,
|
trie_restore/2,
|
||||||
trie_copy_learned_paths/2,
|
trie_copy_learned_paths/2,
|
||||||
topic_key/3,
|
topic_key/3,
|
||||||
|
@ -116,6 +117,12 @@ trie_create(UserOpts) ->
|
||||||
trie_create() ->
|
trie_create() ->
|
||||||
trie_create(#{}).
|
trie_create(#{}).
|
||||||
|
|
||||||
|
-spec destroy(trie()) -> ok.
|
||||||
|
destroy(#trie{trie = Trie, stats = Stats}) ->
|
||||||
|
catch ets:delete(Trie),
|
||||||
|
catch ets:delete(Stats),
|
||||||
|
ok.
|
||||||
|
|
||||||
%% @doc Restore trie from a dump
|
%% @doc Restore trie from a dump
|
||||||
-spec trie_restore(options(), [{_Key, _Val}]) -> trie().
|
-spec trie_restore(options(), [{_Key, _Val}]) -> trie().
|
||||||
trie_restore(Options, Dump) ->
|
trie_restore(Options, Dump) ->
|
||||||
|
|
|
@ -240,7 +240,8 @@ post_creation_actions(
|
||||||
s()
|
s()
|
||||||
) ->
|
) ->
|
||||||
ok.
|
ok.
|
||||||
drop(_Shard, DBHandle, GenId, CFRefs, #s{}) ->
|
drop(_Shard, DBHandle, GenId, CFRefs, #s{trie = Trie}) ->
|
||||||
|
emqx_ds_lts:destroy(Trie),
|
||||||
{_, DataCF} = lists:keyfind(data_cf(GenId), 1, CFRefs),
|
{_, DataCF} = lists:keyfind(data_cf(GenId), 1, CFRefs),
|
||||||
{_, TrieCF} = lists:keyfind(trie_cf(GenId), 1, CFRefs),
|
{_, TrieCF} = lists:keyfind(trie_cf(GenId), 1, CFRefs),
|
||||||
ok = rocksdb:drop_column_family(DBHandle, DataCF),
|
ok = rocksdb:drop_column_family(DBHandle, DataCF),
|
||||||
|
|
Loading…
Reference in New Issue