Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add riak_vnode_req_v2 whichi t2b's the request before sending.

Attempting to reduce the garbage pressure/time for t2b/b2t
over distributed erlang.  Should significanlty reduce the amount of
garbage generated in the proxy processes and hopefully anything
along the distributed erlang path.
  • Loading branch information...
commit d3d515dc8e2ee1c281ffc136bae22f677e19017b 1 parent cb3f676
@jonmeredith jonmeredith authored
View
6 include/riak_core_vnode.hrl
@@ -8,12 +8,18 @@
ignore.
-type partition() :: non_neg_integer().
-type vnode_req() :: term().
+-type bin_vnode_req() :: binary().
-record(riak_vnode_req_v1, {
index :: partition(),
sender=ignore :: sender(),
request :: vnode_req()}).
+-record(riak_vnode_req_v2, {
+ index :: partition(),
+ sender=ignore :: sender(),
+ request :: bin_vnode_req()}).
+
-record(riak_coverage_req_v1, {
index :: partition(),
keyspaces :: [{partition(), [partition()]}],
View
9 src/riak_core_vnode.erl
@@ -299,10 +299,15 @@ active(?COVERAGE_REQ{keyspaces=KeySpaces,
sender=Sender}, State) ->
%% Coverage request handled in handoff and non-handoff. Will be forwarded if set.
vnode_coverage(Sender, Request, KeySpaces, State);
-active(?VNODE_REQ{sender=Sender, request=Request},
+active(#riak_vnode_req_v2{sender=Sender, request=Request},
+ State=#state{handoff_node=HN}) when HN =:= none ->
+ vnode_command(Sender, binary_to_term(Request), State);
+active(#riak_vnode_req_v2{sender=Sender, request=Request},State) ->
+ vnode_handoff_command(Sender, binary_to_term(Request), State);
+active(#riak_vnode_req_v1{sender=Sender, request=Request},
State=#state{handoff_node=HN}) when HN =:= none ->
vnode_command(Sender, Request, State);
-active(?VNODE_REQ{sender=Sender, request=Request},State) ->
+active(#riak_vnode_req_v1{sender=Sender, request=Request},State) ->
vnode_handoff_command(Sender, Request, State);
active(handoff_complete, State) ->
State2 = start_manager_event_timer(handoff_complete, State),
View
21 src/riak_core_vnode_master.erl
@@ -138,6 +138,14 @@ make_request(Request, Sender, Index) ->
request=Request}.
%% Make a request record - exported for use by legacy modules
+-spec make_request_v2(vnode_req(), sender(), partition()) -> #riak_vnode_req_v2{}.
+make_request_v2(Request, Sender, Index) ->
+ #riak_vnode_req_v2{
+ index=Index,
+ sender=Sender,
+ request=term_to_binary(Request)}.
+
+%% Make a request record - exported for use by legacy modules
-spec make_coverage_request(vnode_req(), [{partition(), [partition()]}], sender(), partition()) -> #riak_coverage_req_v1{}.
make_coverage_request(Request, KeySpaces, Sender, Index) ->
#riak_coverage_req_v1{index=Index,
@@ -169,7 +177,12 @@ proxy_cast({VMaster, Node}, Req) ->
do_proxy_cast({VMaster, Node}, Req)
end.
-do_proxy_cast({VMaster, Node}, Req=?VNODE_REQ{index=Idx}) ->
+do_proxy_cast({VMaster, Node}, Req=#riak_vnode_req_v2{index=Idx}) ->
+ Mod = vmaster_to_vmod(VMaster),
+ Proxy = riak_core_vnode_proxy:reg_name(Mod, Idx, Node),
+ gen_fsm:send_event(Proxy, Req),
+ ok;
+do_proxy_cast({VMaster, Node}, Req=#riak_vnode_req_v1{index=Idx}) ->
Mod = vmaster_to_vmod(VMaster),
Proxy = riak_core_vnode_proxy:reg_name(Mod, Idx, Node),
gen_fsm:send_event(Proxy, Req),
@@ -191,7 +204,11 @@ handle_cast({wait_for_service, Service}, State) ->
riak_core:wait_for_service(Service)
end,
{noreply, State};
-handle_cast(Req=?VNODE_REQ{index=Idx}, State=#state{vnode_mod=Mod}) ->
+handle_cast(Req=#riak_vnode_req_v2{index=Idx}, State=#state{vnode_mod=Mod}) ->
+ Proxy = riak_core_vnode_proxy:reg_name(Mod, Idx),
+ gen_fsm:send_event(Proxy, Req),
+ {noreply, State};
+handle_cast(Req=#riak_vnode_req_v1{index=Idx}, State=#state{vnode_mod=Mod}) ->
Proxy = riak_core_vnode_proxy:reg_name(Mod, Idx),
gen_fsm:send_event(Proxy, Req),
{noreply, State};
Please sign in to comment.
Something went wrong with that request. Please try again.