Skip to content

Commit

Permalink
Update following merge
Browse files Browse the repository at this point in the history
  • Loading branch information
martinsumner committed Sep 23, 2024
1 parent e334319 commit 9fc0272
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 63 deletions.
8 changes: 1 addition & 7 deletions tests/verify_conditionalput_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,7 @@ test_api_consistency(Client, ClientMod, Bucket, Version) ->
ClientMod:get(Client, Bucket, ?UPDATE_KEY),
true = riakc_obj:get_value(ObjC) == <<"valueB">>,

ok =
case Version of
current ->
extra_http_notmodified_test(ClientMod, Client, Bucket, ObjC);
_ ->
ok
end,
ok = extra_http_notmodified_test(ClientMod, Client, Bucket, ObjC),

ET = os:system_time(millisecond),
?LOG_INFO(
Expand Down
17 changes: 9 additions & 8 deletions tests/verify_conditionalput_perf.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
%% -------------------------------------------------------------------
-module(verify_conditionalput_perf).
-export([confirm/0, spawn_profile_fun/1]).
-include_lib("eunit/include/eunit.hrl").

-include_lib("kernel/include/logger.hrl").

-define(DEFAULT_RING_SIZE, 16).
-define(TEST_LOOPS, 32).
Expand Down Expand Up @@ -78,12 +79,12 @@ test_conditional(Type, Nodes, Bucket, Loops, ClientMod) ->

Clients = get_clients(ClientsPerNode, Nodes, ClientMod),

lager:info("----------------"),
lager:info(
?LOG_INFO("----------------"),
?LOG_INFO(
"Testing with ~w condition on PUTs - parallel clients ~s client ~w",
[Type, Bucket, ClientMod]
),
lager:info("----------------"),
?LOG_INFO("----------------"),

Keys = lists:map(fun(I) -> to_key(I) end, lists:seq(1, Loops)),

Expand All @@ -106,11 +107,11 @@ test_conditional(Type, Nodes, Bucket, Loops, ClientMod) ->
Expected =
((ClientsPerNode * NCount) * (ClientsPerNode * NCount + 1)) div 2,
{FinalValues, Timings} = lists:unzip(Results),
lager:info(
?LOG_INFO(
"Average time per result ~w ms",
[lists:sum(Timings) div length(Timings)]
),
lager:info(
?LOG_INFO(
"Maximum time per result ~w ms",
[lists:max(Timings)]
),
Expand Down Expand Up @@ -144,8 +145,8 @@ test_concurrent_conditional_changes(Bucket, Key, Clients, ClientMod) ->
{ok, FinalObj} = ClientMod:get(C1, Bucket, Key, [{r, 3}, {pr, 2}]),
<<FinalV:32/integer>> = riakc_obj:get_value(FinalObj),

lager:info("Test took ~w ms", [EndTime - StartTime]),
lager:info("Test had final value of ~w", [FinalV]),
?LOG_INFO("Test took ~w ms", [EndTime - StartTime]),
?LOG_INFO("Test had final value of ~w", [FinalV]),

{FinalV, EndTime - StartTime}.

Expand Down
78 changes: 40 additions & 38 deletions tests/verify_conditionalput_strong.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
%% -------------------------------------------------------------------
-module(verify_conditionalput_strong).
-export([confirm/0]).
-include_lib("eunit/include/eunit.hrl").

-include_lib("kernel/include/logger.hrl").
-include_lib("stdlib/include/assert.hrl").

-define(DEFAULT_RING_SIZE, 32).
-define(TEST_LOOPS, 32).
Expand Down Expand Up @@ -59,10 +61,10 @@ confirm() ->
),
build_wait_loop(Nodes1),

lager:info("----------------"),
lager:info("Testing with conditional check at API only"),
lager:info("... no consensus will be achieved with concurrent PUTs"),
lager:info("----------------"),
?LOG_INFO("----------------"),
?LOG_INFO("Testing with conditional check at API only"),
?LOG_INFO("... no consensus will be achieved with concurrent PUTs"),
?LOG_INFO("----------------"),

false =
hd(
Expand All @@ -86,10 +88,10 @@ confirm() ->
),

reset_conditional_cpm(Nodes1, prefer_token),
lager:info("----------------"),
lager:info("Testing with stronger conditional put - but head_only"),
lager:info("Testing without failure, as no consensus used"),
lager:info("----------------"),
?LOG_INFO("----------------"),
?LOG_INFO("Testing with stronger conditional put - but head_only"),
?LOG_INFO("Testing without failure, as no consensus used"),
?LOG_INFO("----------------"),

R1 =
test_conditional(
Expand Down Expand Up @@ -128,10 +130,10 @@ confirm() ->
[N3|RestNodes3] = Nodes3,
Me = self(),

lager:info("----------------"),
lager:info("Testing with stronger conditional put and consensus"),
lager:info("Testing concurrent to failure and cluster change"),
lager:info("----------------"),
?LOG_INFO("----------------"),
?LOG_INFO("Testing with stronger conditional put and consensus"),
?LOG_INFO("Testing concurrent to failure and cluster change"),
?LOG_INFO("----------------"),

R3 =
test_conditional(
Expand Down Expand Up @@ -267,9 +269,9 @@ confirm() ->
?assert(hd(R12)),

reset_conditional_trm([N3] ++ RestNodes3, basic_consensus),
lager:info("----------------"),
lager:info("Testing with reduced stronger_conditional_nval"),
lager:info("----------------"),
?LOG_INFO("----------------"),
?LOG_INFO("Testing with reduced stronger_conditional_nval"),
?LOG_INFO("----------------"),

spawn_kill(N3, Me),
R13 =
Expand Down Expand Up @@ -299,12 +301,12 @@ confirm() ->
rt:wait_until_pingable(N3),
?assert(hd(R14)),

lager:info("----------------"),
lager:info("Results summary"),
lager:info("----------------"),
?LOG_INFO("----------------"),
?LOG_INFO("Results summary"),
?LOG_INFO("----------------"),
lists:foreach(
fun(R) ->
lager:info(
?LOG_INFO(
"Result ~w for test ~p ~p average time ~w max time ~w",
R
)
Expand Down Expand Up @@ -343,12 +345,12 @@ test_nonematch(Nodes, Bucket, ClientMod) ->

Clients = get_clients(ClientsPerNode, Nodes, ClientMod),

lager:info("----------------"),
lager:info(
?LOG_INFO("----------------"),
?LOG_INFO(
"Testing none_match condition on PUTs - parallel clients ~s client ~w",
[Bucket, ClientMod]
),
lager:info("----------------"),
?LOG_INFO("----------------"),

StartTime = os:system_time(millisecond),

Expand Down Expand Up @@ -379,7 +381,7 @@ test_nonematch(Nodes, Bucket, ClientMod) ->

close_clients(Clients, ClientMod),

lager:info("Test took ~w ms", [EndTime - StartTime]),
?LOG_INFO("Test took ~w ms", [EndTime - StartTime]),

true.

Expand All @@ -398,12 +400,12 @@ test_conditional(Type, Nodes, Bucket, Loops, ClientMod, KillScenario, Multi) ->

Clients = get_clients(ClientsPerNode, Nodes, ClientMod),

lager:info("----------------"),
lager:info(
?LOG_INFO("----------------"),
?LOG_INFO(
"Testing with ~w condition on PUTs - parallel clients ~s client ~w",
[Type, Bucket, ClientMod]
),
lager:info("----------------"),
?LOG_INFO("----------------"),

Keys =
case Multi of
Expand Down Expand Up @@ -445,11 +447,11 @@ test_conditional(Type, Nodes, Bucket, Loops, ClientMod, KillScenario, Multi) ->
{FinalValues, Timings} = lists:unzip(Results),
MeanTimings = lists:sum(Timings) div length(Timings),
MaxTimings = lists:max(Timings),
lager:info(
?LOG_INFO(
"Average time per result ~w ms",
[MeanTimings]
),
lager:info(
?LOG_INFO(
"Maximum time per result ~w ms",
[MaxTimings]
),
Expand Down Expand Up @@ -526,8 +528,8 @@ test_concurrent_conditional_changes(
)
),

lager:info("Test took ~w ms", [EndTime - StartTime]),
lager:info("Test had final value of ~w", [FinalValue]),
?LOG_INFO("Test took ~w ms", [EndTime - StartTime]),
?LOG_INFO("Test had final value of ~w", [FinalValue]),

{FinalValue, EndTime - StartTime}.

Expand All @@ -546,15 +548,15 @@ try_conditional_put(ClientMod, C, I, B, K, KillScenario) ->
{ok, FetchedObj} ->
{ok, FetchedObj};
R ->
lager:info("Request error ~p from client ~p", [R, C]),
?LOG_INFO("Request error ~p from client ~p", [R, C]),
R
end,
<<V:32/integer>> =
try
riakc_obj:get_value(Obj)
catch
exit:siblings ->
lager:info("Siblings on ~p ~p ~p", [C, B, K]),
?LOG_INFO("Siblings on ~p ~p ~p", [C, B, K]),
<<>>
end,

Expand Down Expand Up @@ -621,7 +623,7 @@ spawn_leave(Node, Rest, P) ->
rt:plan_and_commit(Node),
rt:wait_until_ring_converged([Node|Rest]),
lists:foreach(fun(N) -> rt:wait_until_ready(N) end, Rest),
lager:info("Sleeping claimant_tick before checking transfer progress"),
?LOG_INFO("Sleeping claimant_tick before checking transfer progress"),
timer:sleep(?CLAIMANT_TICK),
ok = rt:wait_until_transfers_complete(Rest),
lists:foreach(
Expand All @@ -643,7 +645,7 @@ spawn_join(Node, Rest, P) ->
rt:plan_and_commit(Node),
rt:wait_until_ring_converged([Node|Rest]),
lists:foreach(fun(N) -> rt:wait_until_ready(N) end, Rest),
lager:info("Sleeping claimant_tick before checking transfer progress"),
?LOG_INFO("Sleeping claimant_tick before checking transfer progress"),
timer:sleep(?CLAIMANT_TICK),
ok = rt:wait_until_transfers_complete(Rest),
lists:foreach(
Expand All @@ -661,7 +663,7 @@ spawn_kill(Node, P) ->


change_complete(P) ->
lager:info("Spawned node change complete"),
?LOG_INFO("Spawned node change complete"),
P ! node_change_complete.

random_sleep() ->
Expand Down Expand Up @@ -705,10 +707,10 @@ build_wait_loop(Nodes) ->
wait_until_node_handoffs_complete([]) ->
ok;
wait_until_node_handoffs_complete([Node0|Rest]) ->
lager:info("Wait until Node's transfers complete ~p", [Node0]),
?LOG_INFO("Wait until Node's transfers complete ~p", [Node0]),
F = fun(Node) ->
Handoffs = rpc:call(Node, riak_core_handoff_manager, status, [{direction, outbound}]),
lager:info("Handoffs: ~p", [Handoffs]),
?LOG_INFO("Handoffs: ~p", [Handoffs]),
Handoffs =:= []
end,
?assertEqual(ok, rt:wait_until(Node0, F)),
Expand Down
14 changes: 4 additions & 10 deletions tests/verify_riak_stats.erl
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ all_stats(_Node) ->
++ pool_stats()
++ tictacaae_stats()
++ organisation_stats()
++ ttaaefs_stats().
++ ttaaefs_stats()
++ token_stats().

common_stats() ->
[
Expand Down Expand Up @@ -864,8 +865,6 @@ common_stats() ->
<<"sys_thread_pool_size">>,
<<"sys_threads_enabled">>,
<<"sys_wordsize">>,
<<"tictacaae_queue_microsec__max">>,
<<"tictacaae_queue_microsec_mean">>,
<<"tools_version">>,
<<"vnode_counter_update">>,
<<"vnode_counter_update_time_100">>,
Expand Down Expand Up @@ -944,11 +943,7 @@ common_stats() ->
<<"write_once_puts_total">>,
<<"xmerl_version">>,
<<"zstd_version">>
]
++ pool_stats()
++ tictacaae_stats()
++ ttaaefs_stats()
++ token_stats().
].


pool_stats() ->
Expand Down Expand Up @@ -1105,8 +1100,7 @@ workday_stats() ->

nhse_stats() ->
[
<<"leveldb_read_block_error">>,
<<"tools_version">>
<<"leveldb_read_block_error">>
].

bet365_stats() -> [].
Expand Down

0 comments on commit 9fc0272

Please sign in to comment.