Skip to content

Commit

Permalink
Update a few more riak_cs_pbc calls after timeout API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kellymclaughlin committed Dec 8, 2014
1 parent 100a5e8 commit 40389f2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion priv/tools/repair_gc_bucket.erl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ process_gc_keys(Pbc, Options, Continuation, [GCKey | Keys]) ->
ok |
{error, term()}.
repair_manifests_for_gc_key(Pbc, Options, GCKey) ->
case riak_cs_pbc:get_object(Pbc, ?GC_BUCKET, GCKey) of
Timeout = riak_cs_config:get_gckey_timeout(),
case riak_cs_pbc:get_object(Pbc, ?GC_BUCKET, GCKey, Timeout) of
{ok, GCObj} ->
FileSet = riak_cs_gc:decode_and_merge_siblings(
GCObj, twop_set:new()),
Expand Down
13 changes: 9 additions & 4 deletions riak_test/tests/gc_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,20 @@ confirm() ->
%% Set up to grep logs to verify messages
rt:setup_log_capture(hd(CSNodes)),

rtcs:gc(1, "set-interval infinity"),
rtcs:gc(1, "set-leeway 1"),
rtcs:gc(1, "cancel"),

lager:info("Test GC run under an invalid state manifest..."),
{GCKey, {BKey, UUID}} = setup_obj(RiakNodes, UserConfig),
%% Ensure the leeway has expired
timer:sleep(2000),
ok = verify_gc_run(hd(CSNodes), GCKey),
ok = verify_riak_object_remaining_for_bad_key(RiakNodes, GCKey, {BKey, UUID}),

lager:info("Test repair script (repair_gc_bucket.erl) with more invlaid states..."),
ok = put_more_bad_keys(RiakNodes, UserConfig),
%% Ensure the leeway has expired
timer:sleep(2000),
RiakIDs = rtcs:riak_id_per_cluster(NumNodes),
[repair_gc_bucket(ID) || ID <- RiakIDs],
Expand Down Expand Up @@ -163,9 +170,7 @@ repair_gc_bucket(RiakNodeID) ->
ok.

verify_gc_run(Node, GCKey) ->
rtcs:gc(1, "set-leeway 1"),
timer:sleep(2000),
rtcs:gc(1, "batch"),
rtcs:gc(1, "batch 1"),
lager:info("Check log, warning for invalid state and info for GC finish"),
true = rt:expect_in_log(Node,
"Invalid state manifest in GC bucket at <<\""
Expand All @@ -179,7 +184,7 @@ verify_gc_run(Node, GCKey) ->
ok.

verify_gc_run2(Node) ->
rtcs:gc(1, "batch"),
rtcs:gc(1, "batch 1"),
lager:info("Check collected count =:= 101, 1 from setup_obj, "
"100 from put_more_bad_keys."),
true = rt:expect_in_log(Node,
Expand Down
2 changes: 1 addition & 1 deletion src/riak_cs_gc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ mark_manifests(RiakObject, Bucket, Key, UUIDsToMark, ManiFunction, RcPid) ->
%% with vector clock. This allows us to do a PUT
%% again without having to re-retrieve the object
{ok, ManifestPbc} = riak_cs_riak_client:manifest_pbc(RcPid),
riak_cs_pbc:put(ManifestPbc, UpdObj, [return_body]).
riak_cs_pbc:put(ManifestPbc, UpdObj, [return_body], riak_cs_config:get_gckey_timeout()).

%% @doc Copy data for a list of manifests to the
%% `riak-cs-gc' bucket to schedule them for deletion.
Expand Down
2 changes: 1 addition & 1 deletion src/riak_cs_gc_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ finish_file_delete(0, _, RiakObj, RcPid) ->
%% Delete the key from the GC bucket
{ok, ManifestPbc} = riak_cs_riak_client:manifest_pbc(RcPid),
Timeout = riak_cs_config:delete_gckey_timeout(),
_ = riakc_pb_socket:delete_obj(ManifestPbc, RiakObj, Timeout),
_ = riakc_pb_socket:delete_obj(ManifestPbc, RiakObj, [], Timeout),
ok;
finish_file_delete(_, FileSet, _RiakObj, _RcPid) ->
_ = lager:debug("Remaining file keys: ~p", [twop_set:to_list(FileSet)]),
Expand Down
2 changes: 1 addition & 1 deletion src/riak_cs_manifest_fsm.erl
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ get_and_delete(RcPid, UUID, Bucket, Key) ->
case UpdatedManifests of
[] ->
DeleteTimeout = riak_cs_config:delete_manifest_timeout(),
riakc_pb_socket:delete_obj(manifest_pbc(RcPid), RiakObject, DeleteTimeout);
riakc_pb_socket:delete_obj(manifest_pbc(RcPid), RiakObject, [], DeleteTimeout);
_ ->
ObjectToWrite0 =
riak_cs_utils:update_obj_value(
Expand Down

0 comments on commit 40389f2

Please sign in to comment.