Skip to content

Commit d7034f1

Browse files
committed
Add configurable vnode count on ngr (#1860)
1 parent f171979 commit d7034f1

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

priv/riak_kv.schema

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,15 @@
12871287
{commented, enabled}
12881288
]}.
12891289

1290+
%% @doc For queue-based replication what should be the r value on fetches,
1291+
%% and the w value on pushes. Default is to use `one` but `quorum` or `all`
1292+
%% can be used should there be issues with vnode stress that will otherwise
1293+
%% generate anti-entropy workloads (e.g. with mailbox overloads)
1294+
{mapping, "replrtq_vnodecheck", "riak_kv.replrtq_vnodecheck", [
1295+
{datatype, {enum, [one, quorum, all]}},
1296+
{default, one}
1297+
]}.
1298+
12901299
%% @doc Limit the number of objects to be cached on the replication queue,
12911300
%% with objects queued when the priority queue is beyond this limit stored as
12921301
%% clocks only to be fetched on replication

src/riak_client.erl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ replrtq_reset_all_workercounts(WorkerC, PerPeerL) ->
202202
fetch(QueueName, {?MODULE, [Node, _ClientId]}) ->
203203
Me = self(),
204204
ReqId = mk_reqid(),
205-
Options = [deletedvclock, {pr, 1}, {r, 1}, {notfound_ok, false}],
205+
R = application:get_env(riak_kv, replrtq_vnodecheck, 1),
206+
Options = [deletedvclock, {pr, 1}, {r, R}, {notfound_ok, false}],
206207
case node() of
207208
Node ->
208209
riak_kv_get_fsm:start({raw, ReqId, Me},
@@ -239,8 +240,9 @@ push(RObjMaybeBin, IsDeleted, _Opts, {?MODULE, [Node, _ClientId]}) ->
239240
Key = riak_object:key(RObj),
240241
Me = self(),
241242
ReqId = mk_reqid(),
243+
W = application:get_env(riak_kv, replrtq_vnodecheck, 1),
242244
Options = [asis, disable_hooks, {update_last_modified, false},
243-
{w, 1}, {pw, 1}, {dw, 0}, {node_confirms, 1}],
245+
{w, W}, {pw, 1}, {dw, 0}, {node_confirms, 1}],
244246
% asis - stops the PUT from being re-coordinated
245247
% disable_hooks - this makes this compatible with previous repl,
246248
% although this may no longer be necessary (no repl hook to disable)

0 commit comments

Comments
 (0)