mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-06 00:25:22 +00:00
Address review comments
Remove those timers and other remnants of flailing when first trying to write tests.
This commit is contained in:
parent
d86d122308
commit
3657c57bac
@ -71,11 +71,8 @@ confirm() ->
|
||||
|
||||
|
||||
%% delete the local data for Key
|
||||
%% ERM why not just stop the node, then delete the data dir?
|
||||
delete_datadir(hd(PL)),
|
||||
|
||||
timer:sleep(10000),
|
||||
|
||||
{ok, Bod2} = write_key(Client, <<"jon">>, [return_body]),
|
||||
|
||||
VCE1 = riakc_obj:vclock(Bod2),
|
||||
@ -130,7 +127,8 @@ delete_datadir({{Idx, Node}, Type}) ->
|
||||
rt:stop_and_wait(Node),
|
||||
|
||||
del_dir(Path),
|
||||
rt:start_and_wait(Node).
|
||||
rt:start_and_wait(Node),
|
||||
rt:wait_for_service(Node, riak_kv).
|
||||
|
||||
backend_name_from_mod(riak_kv_bitcask_backend) ->
|
||||
bitcask;
|
||||
|
@ -83,7 +83,7 @@ confirm() ->
|
||||
|
||||
rt:wait_until(fun() ->
|
||||
NewPL = kv679_tombstone:get_preflist(CoordNode),
|
||||
two_fallbacks_one_primary(NewPL) == {1, 2}
|
||||
primary_and_fallback_counts(NewPL) == {1, 2}
|
||||
end),
|
||||
|
||||
FBPL = kv679_tombstone:get_preflist(CoordNode),
|
||||
@ -180,7 +180,7 @@ confirm() ->
|
||||
|
||||
pass.
|
||||
|
||||
two_fallbacks_one_primary(PL) ->
|
||||
primary_and_fallback_counts(PL) ->
|
||||
lists:foldl(fun({{_, _}, primary}, {P, F}) ->
|
||||
{P+1, F};
|
||||
({{_, _}, fallback}, {P, F}) ->
|
||||
|
@ -208,13 +208,10 @@ wait_for_new_pl(PL, Node) ->
|
||||
rt:wait_until(fun() ->
|
||||
NewPL = get_preflist(Node),
|
||||
lager:info("new ~p~n old ~p~nNode ~p~n", [NewPL, PL, Node]),
|
||||
NewPL /= PL%% andalso contains_fallback(NewPL)
|
||||
NewPL /= PL
|
||||
end),
|
||||
get_preflist(Node).
|
||||
|
||||
contains_fallback(PL) ->
|
||||
lists:keymember(fallback, 2, PL).
|
||||
|
||||
start_fallback_and_wait_for_handoff(DeadFallback) ->
|
||||
%% Below is random voodoo shit as I have no idea how to _KNOW_ that handoff has happened
|
||||
%% whatver, it takes 2 minutes, force_handoff? 2 minutes son!
|
||||
|
@ -43,7 +43,7 @@
|
||||
-define(KEY, <<"test">>).
|
||||
|
||||
confirm() ->
|
||||
Config = [{riak_kv, [{delete_mode, 10000}]}, %% 20 seconds to reap.
|
||||
Config = [{riak_kv, [{delete_mode, 10000}]}, %% 10 seconds to reap.
|
||||
{riak_core, [{ring_creation_size, 8},
|
||||
{vnode_management_timer, 1000},
|
||||
{handoff_concurrency, 100},
|
||||
@ -59,7 +59,8 @@ confirm() ->
|
||||
|
||||
?assert(perfect_preflist(PL)),
|
||||
|
||||
%% Patsy is the node that will take a fall
|
||||
%% Patsy is the primary node that will take a fall, where the
|
||||
%% lingering doomstone will stay
|
||||
{CoordClient, Patsy} = get_coord_client_and_patsy(Clients, PL),
|
||||
|
||||
lager:info("CoordClient ~p~nPatsy ~p~n", [CoordClient, Patsy]),
|
||||
@ -76,17 +77,12 @@ confirm() ->
|
||||
lager:info("deleted key"),
|
||||
|
||||
%% kill the patsy, must happen before the reap
|
||||
%%
|
||||
%% @TODO make deterministic (would be nice without all these
|
||||
%% timers)
|
||||
timer:sleep(500),
|
||||
|
||||
rt:brutal_kill(Patsy),
|
||||
|
||||
lager:info("killed the patsy"),
|
||||
|
||||
%% A time to reap
|
||||
%% %% wait for the up nodes to reap
|
||||
%% A time to reap wait for the up nodes to reap, can't use
|
||||
%% kv679_tombstone:read_it_and_reap
|
||||
timer:sleep(15000),
|
||||
|
||||
lager:info("tombstone (should be) reaped"),
|
||||
@ -94,10 +90,7 @@ confirm() ->
|
||||
%% %% write the key again, this will start a new clock, a clock
|
||||
%% that is in the past of that un-reaped primary tombstone. We use the
|
||||
%% same node to get the same clock.
|
||||
kv679_tombstone:write_key(CoordClient, [<<"jon">>],
|
||||
[{pw, 2},
|
||||
{sloppy_quorum, false},
|
||||
{n_val, 2}]),
|
||||
kv679_tombstone:write_key(CoordClient, [<<"jon">>]),
|
||||
|
||||
dump_clock(CoordClient),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user