Просмотр исходного кода

fix(ds): pass topics to `emqx_topic:words/1` before feeding LTS tree

So that empty levels in topics will be properly mapped into `''` atoms.
Andrew Mayorov 2 лет назад
Родитель
Сommit
130a5a5442
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      apps/emqx_durable_storage/src/emqx_ds_storage_bitfield_lts.erl

+ 2 - 2
apps/emqx_durable_storage/src/emqx_ds_storage_bitfield_lts.erl

@@ -368,7 +368,7 @@ check_message(
     #{?tag := ?IT, ?start_time := StartTime, ?topic_filter := TopicFilter},
     #message{timestamp = Timestamp, topic = Topic}
 ) when Timestamp >= StartTime ->
-    emqx_topic:match(emqx_topic:words(Topic), TopicFilter);
+    emqx_topic:match(emqx_topic:tokens(Topic), TopicFilter);
 check_message(_Cutoff, _It, _Msg) ->
     false.
 
@@ -378,7 +378,7 @@ format_key(KeyMapper, Key) ->
 
 -spec make_key(s(), emqx_types:message()) -> {binary(), [binary()]}.
 make_key(#s{keymappers = KeyMappers, trie = Trie}, #message{timestamp = Timestamp, topic = TopicBin}) ->
-    Tokens = emqx_topic:tokens(TopicBin),
+    Tokens = emqx_topic:words(TopicBin),
     {TopicIndex, Varying} = emqx_ds_lts:topic_key(Trie, fun threshold_fun/1, Tokens),
     VaryingHashes = [hash_topic_level(I) || I <- Varying],
     KeyMapper = array:get(length(Varying), KeyMappers),