Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop 2.9 #35

Merged
merged 4 commits into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions priv/riak_kv.schema
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,14 @@

%% @doc Frequency to prompt exchange per vnode
%% The number of milliseconds which the vnode must wait between self-pokes to
%% maybe prompt the next exchange. Default is 2 minutes.
%% maybe prompt the next exchange. Default is 2 minutes 30 seconds.
%% Note if this is to be reduced below this value the riak_core
%% vnode_inactivity_timeout should also be reduced or handoffs may be
%% blocked. To be safe the vnode_inactivity_timeout must be < 0.5 * the
%% tictacaae_exchangetick.
{mapping, "tictacaae_exchangetick", "riak_kv.tictacaae_exchangetick", [
{datatype, integer},
{default, 120000},
{default, 150000},
hidden
]}.

Expand All @@ -95,6 +99,16 @@
hidden
]}.

%% @doc Exchange only between primary vnodes
%% Setting this to false allows Tictac AAE exchanges between both primary and
%% fallback vnodes.
{mapping, "tictacaae_primaryonly", "riak_kv.tictacaae_primaryonly", [
{datatype, flag},
{default, on},
hidden
]}.


%% @doc Pool Strategy - should a single node_worker_pool or multiple pools be
%% used for queueing potentially longer-running "background" queries
{mapping, "worker_pool_strategy", "riak_kv.worker_pool_strategy", [
Expand Down
26 changes: 22 additions & 4 deletions src/riak_kv_vnode.erl
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,10 @@ maybe_create_hashtrees(true, State=#state{idx=Index, upgrade_hashtree=Upgrade,

-spec maybe_start_aaecontroller(active|passive, state()) -> state().
%% @doc
%% Start an AAE controller if riak_kv has been consfigured to use cached
%% tictac tree based AAE
%% Start an AAE controller if riak_kv has been configured to use cached
%% tictac tree based AAE. Note that a controller will always start, and
%% receive updates, even if the vnode is not a primary (and will not be
%% involved in exchanges).
maybe_start_aaecontroller(passive, State) ->
State#state{tictac_aae=false, aae_controller=undefined};
maybe_start_aaecontroller(active, State=#state{mod=Mod,
Expand Down Expand Up @@ -1115,7 +1117,22 @@ handle_command(tictacaae_exchangepoke, _Sender, State) ->
tictac_deltacount = 0,
tictac_startqueue = Now}};
[{Local, Remote, {DocIdx, N}}|Rest] ->
PL = riak_core_apl:get_apl(<<(DocIdx-1):160/integer>>, N, riak_kv),
PrimaryOnly =
app_helper:get_env(riak_kv, tictacaae_primaryonly, true),
% By default TictacAAE exchanges are run only between primary
% vnodes, and not between fallback vnodes. Changing this
% to false will allow fallback vnodes to be populated via AAE,
% increasing the workload during failure scenarios, but also
% reducing the potential for entropy in long-term failures.
PlLup = <<(DocIdx-1):160/integer>>,
PL =
case PrimaryOnly of
true ->
PL0 = riak_core_apl:get_primary_apl(PlLup, N, riak_kv),
[{PIdx, PN} || {{PIdx, PN}, primary} <- PL0];
false ->
riak_core_apl:get_apl(PlLup, N, riak_kv)
end,
case {lists:keyfind(Local, 1, PL), lists:keyfind(Remote, 1, PL)} of
{{Local, LN}, {Remote, RN}} ->
IndexN = {DocIdx, N},
Expand All @@ -1134,7 +1151,8 @@ handle_command(tictacaae_exchangepoke, _Sender, State) ->
_ ->
lager:warning("Proposed exchange between ~w and ~w " ++
"not currently supported within " ++
"preflist for IndexN=~w",
"preflist for IndexN=~w possibly due to " ++
"node failure",
[Local, Remote, {DocIdx, N}])
end,
{noreply, State#state{tictac_exchangequeue = Rest}}
Expand Down