anchor.diff:              case emqtt_topic:type(emqtt_topic:new(Topic)) of
                   direct ->
                       T = ensure_table_exists(MountPoint, Topic),
  -                    handle_sub_event(EvtType, T, EventVal);
  +                    handle_sub_event({MountPoint, Topic}, EvtType, T, EventVal);
                   wildcard ->
                       ignore
               end;
  
positive.code:             {ok, Tid}
      end.
  
  
  handle_sub_event(subscribe, T, {ClientId, QoS, {error, not_found}}) ->
      %% no local process found for client id
      ets:insert(T, {{ClientId, QoS}, undefined});
  handle_sub_event(subscribe, T, {ClientId, QoS, QPids}) ->
      Objects = [{{ClientId, QoS}, Pid} || Pid <- QPids],
      ets:insert(T, Objects);
  handle_sub_event(subscribe, T, Node) ->
      case ets:insert_new(T, {{node, Node}, 1}) of
          true ->
              ok;
          false ->
              ets:update_counter(T, {node, Node}, 1)
      end;
  handle_sub_event(unsubscribe, T, {ClientId, QoS}) ->
      ets:delete(T, {ClientId, QoS}),
      case ets:info(T, size) of
          0 -> ets:delete(T);
          _ -> ok
      end;
  handle_sub_event(unsubscribe, T, Node) ->
      case ets:update_counter(T, {node, Node}, -1) of
          R when R =< 0 ->
              ets:delete(T, {node, Node}),
              case ets:info(T, size) of
                  0 -> ets:delete(T);
                  _ -> ok
              end;
          _ ->
  
negative.code: fold(MP, Topic, FoldFun, Acc) when is_list(Topic) ->
      case find_cache_table({MP, Topic}) of
          {ok, T} ->
              try
                  {_, _, ResAcc} = ets:foldl(
                                     fun fold_/2, {Topic, FoldFun, Acc}, T
                                    ),
                  ResAcc
              catch
                  error:badarg ->
                      %% this can happen, if ets:foldl is called while
                      %% the table has been deleted underneath.
                      Acc
              end;
          {error, not_found} ->
              Acc
      end.
  
  fold_({{ClientId, QoS}, [Pid]}, {Topic, FoldFun, Acc}) ->
      %% optimizaion for majority of cases,
      %% where only one session pid per client exists
      NewAcc = FoldFun({Topic, node(), ClientId, QoS, Pid}, Acc),
      {Topic, FoldFun, NewAcc};
  fold_({{ClientId, QoS}, Pids}, {Topic, FoldFun, Acc}) ->
      NewAcc =
      lists:foldl(
        fun(Pid, AccAcc) ->
                FoldFun({Topic, node(), ClientId, QoS, Pid}, AccAcc)
        end, Acc, Pids),
      {Topic, FoldFun, NewAcc};
  fold_({{node, Node}, _}, {Topic, FoldFun, Acc}) ->
      NewAcc = FoldFun({Topic, Node}, Acc),
  