Skip to content

Commit cf968c9

Browse files
committed
Add operation to get the value of new-style counter.
1 parent 745a4da commit cf968c9

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/basho_bench_driver_riakc_pb.erl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,23 @@ run(mr_keylist_js, KeyGen, _ValueGen, State) ->
438438
State#state.keylist_length),
439439
mapred(State, Keylist, ?JS_MR);
440440

441+
run({counter, value}, KeyGen, _ValueGen, State) ->
442+
Key = KeyGen(),
443+
Options = [{r,2}, {notfound_ok, true}, {timeout, 5000}],
444+
Result = riakc_pb_socket:fetch_type(State#state.pid,
445+
State#state.bucket,
446+
Key,
447+
Options),
448+
case Result of
449+
{ok, _} ->
450+
{ok, State};
451+
{error, {notfound, _}} ->
452+
{ok, State};
453+
{error, Reason} ->
454+
lager:info("Team read failed, error: ~p", [Reason]),
455+
{error, Reason, State}
456+
end;
457+
441458
run({counter, increment}, KeyGen, ValueGen, State) ->
442459
Amt = ValueGen(),
443460
Key = KeyGen(),

0 commit comments

Comments
 (0)