Skip to content

Commit f7ea0b3

Browse files
committed
Add increment for new-style counters.
1 parent eb93d63 commit f7ea0b3

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/basho_bench_driver_riakc_pb.erl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,25 @@ run(mr_keylist_js, KeyGen, _ValueGen, State) ->
437437
Keylist = make_keylist(State#state.bucket, KeyGen,
438438
State#state.keylist_length),
439439
mapred(State, Keylist, ?JS_MR);
440+
441+
run({counter, increment}, KeyGen, ValueGen, State) ->
442+
Amt = ValueGen(),
443+
Key = KeyGen(),
444+
Result = riakc_pb_socket:modify_type(State#state.pid,
445+
fun(C) ->
446+
riakc_counter:increment(Amt, C)
447+
end,
448+
State#state.bucket, Key, [create]),
449+
case Result of
450+
ok ->
451+
{ok, State};
452+
{ok, _} ->
453+
{ok, State};
454+
{error, Reason} ->
455+
lager:info("Score change failed, error: ~p", [Reason]),
456+
{error, Reason, State}
457+
end;
458+
440459
run(counter_incr, KeyGen, ValueGen, State) ->
441460
Amt = ValueGen(),
442461
Key = KeyGen(),

0 commit comments

Comments
 (0)