riak-core-lite / riak_core_lite

Distributed systems infrastructure used by Riak.
Apache License 2.0
80 stars 13 forks source link

Can't find `riak_core_coverage_fsm` #109

Open onetamer opened 3 years ago

onetamer commented 3 years ago

I'd like to implement some coverage calls but it looks like riak_core_coverage_fsm.erl can't be found. I checked the Riak Core main repo and it seems to be available here: https://github.com/basho/riak_core/blob/develop-3.0/src/riak_core_coverage_fsm.erl

Is this file not supposed to be included in Riak Core Lite?

ukazap commented 2 years ago

Hi, having the same issue following the tutorial. The sample tanodb project also seems to use riak_core as one of its dependencies.

albsch commented 2 years ago

The riak_core_coverage_fsm is not directly supported in riak_core_lite, it's supposed to be in riak_core_lite_utils, here. Any updates on that @marianoguerra ? I vaguely recall we postponed adding it because it encourages inefficient access patterns, but I forgot about our plans on that.

heri16 commented 2 years ago

What are the things missing that is required to get riak_pipe working with riak_core_lite?

albsch commented 2 years ago

I haven't tried out running riak_pipe, but at a glance riak_core_coverage_fsm and some small modifications are needed.

To get it to compile with riak_core_lite:

  1. Change to riak_core_lite dependency
  2. Copy riak_core_coverage_fsm.erl from somewhere to src.
  3. Add missing callbacks to riak_pipe_vnode and replace ?FOLDREQ with the record definition
diff --git a/rebar.config b/rebar.config
index 1c9c6d3..fb08940 100644
--- a/rebar.config
+++ b/rebar.config
@@ -11,7 +11,7 @@
 {xref_checks,[undefined_function_calls,undefined_functions,locals_not_used]}.

 {deps, [
-        {riak_core, ".*", {git, "https://github.com/basho/riak_core.git", {branch, "develop"}}}
+        {riak_core, "0.10.3", {pkg, riak_core_lite}}
        ]}.

 {plugins, [{eqc_rebar, {git, "https://github.com/Quviq/eqc-rebar", {branch, "master"}}}]}.
diff --git a/src/riak_pipe_vnode.erl b/src/riak_pipe_vnode.erl
index b1da35a..ffb3a05 100644
--- a/src/riak_pipe_vnode.erl
+++ b/src/riak_pipe_vnode.erl
@@ -39,6 +39,8 @@
          handle_exit/3,
          handle_info/2,
          handle_coverage/4]).
+-export([handle_overload_command/3, 
+         handle_overload_info/2]).
 -export([queue_work/2,
          queue_work/3,
          queue_work/4,
@@ -521,7 +523,7 @@ handle_command(Message, _Sender, State) ->
          {reply, term(), state()}
        | {noreply, state()}
        | {forward, state()}.
-handle_handoff_command(?FOLD_REQ{}=Cmd, Sender, State) ->
+handle_handoff_command(#riak_core_fold_req_v2{}=Cmd, Sender, State) ->
     handoff_cmd_internal(Cmd, Sender, State);
 handle_handoff_command(#riak_core_fold_req_v1{}=Cmd, Sender, State) ->
     handoff_cmd_internal(riak_core_util:make_newest_fold_req(Cmd),
@@ -1251,7 +1253,7 @@ proplist_perf(#worker{perf=Perf, state=State}) ->
 %%      archive as they finish their current inputs.
 -spec handoff_cmd_internal(term(), sender(), state()) ->
          {noreply, state()}.
-handoff_cmd_internal(?FOLD_REQ{foldfun=Fold, acc0=Acc}, Sender,
+handoff_cmd_internal(#riak_core_fold_req_v2{foldfun=Fold, acc0=Acc}, Sender,
               #state{workers=Workers}=State) ->
     {Ready, NotReady} = lists:partition(
                           fun(W) -> W#worker.state == waiting end,
@@ -1310,3 +1312,7 @@ archive_internal(#cmd_archive{fitting=F, archive=A},
     end,
     {noreply, State#state{workers_archiving=NewArchiving,
                           handoff=Handoff#handoff{acc=NewAcc}}}.
+
+
+handle_overload_command(_Request, _Sender, _Idx) -> ok.
+handle_overload_info(_Request, _Idx) -> ok.