@@ -293,6 +293,58 @@ run(alwaysget_updatewith2i, _KeyGen, ValueGen, State) ->
293293 {error , Reason , State }
294294 end ;
295295
296+ run (alwaysget_updatewithout2i , _KeyGen , ValueGen , State ) ->
297+ Pid = State # state .pb_pid ,
298+ Bucket = State # state .recordBucket ,
299+ AGKC = State # state .alwaysget_key_count ,
300+ Value = ValueGen (),
301+ KeyInt = eightytwenty_keycount (AGKC ),
302+ ToExtend =
303+ random :uniform (State # state .alwaysget_perworker_maxkeycount ) > AGKC ,
304+
305+ {Robj0 , NewAGKC } =
306+ case ToExtend of
307+ true ->
308+ % Expand the key count
309+ ExpansionKey =
310+ generate_uniquekey (AGKC + 1 , State # state .keyid ,
311+ State # state .alwaysget_keyorder ),
312+ case {AGKC rem 1000 , State # state .nominated_id } of
313+ {0 , true } ->
314+ lager :info (" Always grow key count passing ~w "
315+ ++ " for nominated worker" ,
316+ [AGKC ]);
317+ _ ->
318+ ok
319+ end ,
320+ {riakc_obj :new (Bucket , ExpansionKey ),
321+ AGKC + 1 };
322+ false ->
323+ % update an existing key
324+ ExistingKey =
325+ generate_uniquekey (KeyInt , State # state .keyid ,
326+ State # state .alwaysget_keyorder ),
327+ {ok , Robj } =
328+ riakc_pb_socket :get (Pid ,
329+ Bucket , ExistingKey ,
330+ State # state .pb_timeout ),
331+ {Robj , AGKC }
332+ end ,
333+
334+ % MD0 = riakc_obj:get_update_metadata(Robj0),
335+ % MD1 = riakc_obj:clear_secondary_indexes(MD0),
336+ % MD2 = riakc_obj:set_secondary_index(MD1, generate_binary_indexes()),
337+ Robj2 = riakc_obj :update_value (Robj0 , Value ),
338+ % Robj2 = riakc_obj:update_metadata(Robj1, MD2),
339+
340+ % % Write the object...
341+ case riakc_pb_socket :put (Pid , Robj2 , State # state .pb_timeout ) of
342+ ok ->
343+ {ok , State # state {alwaysget_key_count = NewAGKC }};
344+ {error , Reason } ->
345+ {error , Reason , State }
346+ end ;
347+
296348
297349% % Update an object with secondary indexes.
298350run (update_with2i , KeyGen , ValueGen , State ) ->
0 commit comments