Develop 3.1 otp27 (#443)
* Initial tetsing of OTP27 * Profiles for testing in OTP 27
This commit is contained in:
parent
86c49bec00
commit
7ac99f05c7
6 changed files with 119 additions and 33 deletions
|
@ -289,4 +289,45 @@ test_bloom(N, Runs) ->
|
|||
"fpr ~.3f with bytes-per-key ~.3f~n",
|
||||
[N, round(TSa), TSb / PosChecks, TSc / (Pos + Neg), FPR, BytesPerKey]).
|
||||
|
||||
|
||||
split_builder_speed_test_() ->
|
||||
{timeout, 60, fun split_builder_speed_tester/0}.
|
||||
|
||||
split_builder_speed_tester() ->
|
||||
N = 40000,
|
||||
Runs = 50,
|
||||
ListOfHashLists =
|
||||
lists:map(fun(_X) -> get_hashlist(N * 2) end, lists:seq(1, Runs)),
|
||||
|
||||
Timings =
|
||||
lists:map(
|
||||
fun(HashList) ->
|
||||
SlotCount =
|
||||
case length(HashList) of
|
||||
0 ->
|
||||
0;
|
||||
L ->
|
||||
min(128, max(2, (L - 1) div 512))
|
||||
end,
|
||||
InitTuple = list_to_tuple(lists:duplicate(SlotCount, [])),
|
||||
{MTC, SlotHashes} =
|
||||
timer:tc(
|
||||
fun map_hashes/3, [HashList, InitTuple, SlotCount]
|
||||
),
|
||||
{BTC, _Bloom} =
|
||||
timer:tc(
|
||||
fun build_bloom/2, [SlotHashes, SlotCount]
|
||||
),
|
||||
{MTC, BTC}
|
||||
end,
|
||||
ListOfHashLists
|
||||
),
|
||||
{MTs, BTs} = lists:unzip(Timings),
|
||||
io:format(
|
||||
user,
|
||||
"Total time in microseconds for map_hashlist ~w build_bloom ~w~n",
|
||||
[lists:sum(MTs), lists:sum(BTs)]
|
||||
).
|
||||
|
||||
|
||||
-endif.
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
handle_info/2,
|
||||
terminate/2,
|
||||
code_change/3,
|
||||
format_status/2]).
|
||||
format_status/1]).
|
||||
|
||||
-export([
|
||||
pcl_snapstart/1,
|
||||
|
@ -1230,15 +1230,22 @@ terminate(Reason, _State=#state{is_snapshot=Snap}) when Snap == true ->
|
|||
terminate(Reason, _State) ->
|
||||
leveled_log:log(p0011, [Reason]).
|
||||
|
||||
format_status(normal, [_PDict, State]) ->
|
||||
State;
|
||||
format_status(terminate, [_PDict, State]) ->
|
||||
State#state{
|
||||
manifest = redacted,
|
||||
levelzero_cache = redacted,
|
||||
levelzero_index = redacted,
|
||||
levelzero_astree = redacted}.
|
||||
|
||||
format_status(Status) ->
|
||||
case maps:get(reason, Status, normal) of
|
||||
terminate ->
|
||||
State = maps:get(state, Status),
|
||||
maps:update(
|
||||
state,
|
||||
State#state{
|
||||
manifest = redacted,
|
||||
levelzero_cache = redacted,
|
||||
levelzero_index = redacted,
|
||||
levelzero_astree = redacted},
|
||||
Status
|
||||
);
|
||||
_ ->
|
||||
Status
|
||||
end.
|
||||
|
||||
code_change(_OldVsn, State, _Extra) ->
|
||||
{ok, State}.
|
||||
|
@ -1993,9 +2000,10 @@ format_status_test() ->
|
|||
max_inmemory_tablesize=1000,
|
||||
sst_options=#sst_options{}}),
|
||||
{status, PCL, {module, gen_server}, SItemL} = sys:get_status(PCL),
|
||||
S = lists:keyfind(state, 1, lists:nth(5, SItemL)),
|
||||
{data,[{"State", S}]} = lists:nth(3, lists:nth(5, SItemL)),
|
||||
true = is_integer(array:size(element(2, S#state.manifest))),
|
||||
ST = format_status(terminate, [dict:new(), S]),
|
||||
Status = format_status(#{reason => terminate, state => S}),
|
||||
ST = maps:get(state, Status),
|
||||
?assertMatch(redacted, ST#state.manifest),
|
||||
?assertMatch(redacted, ST#state.levelzero_cache),
|
||||
?assertMatch(redacted, ST#state.levelzero_index),
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
callback_mode/0,
|
||||
terminate/3,
|
||||
code_change/4,
|
||||
format_status/2]).
|
||||
format_status/1]).
|
||||
|
||||
%% states
|
||||
-export([starting/3,
|
||||
|
@ -926,11 +926,21 @@ terminate(Reason, _StateName, State) ->
|
|||
code_change(_OldVsn, StateName, State, _Extra) ->
|
||||
{ok, StateName, State}.
|
||||
|
||||
format_status(normal, [_PDict, _, State]) ->
|
||||
State;
|
||||
format_status(terminate, [_PDict, _, State]) ->
|
||||
State#state{
|
||||
blockindex_cache = redacted, fetch_cache = redacted}.
|
||||
|
||||
format_status(Status) ->
|
||||
case maps:get(reason, Status, normal) of
|
||||
terminate ->
|
||||
State = maps:get(state, Status),
|
||||
maps:update(
|
||||
state,
|
||||
State#state{
|
||||
blockindex_cache = redacted,
|
||||
fetch_cache = redacted},
|
||||
Status
|
||||
);
|
||||
_ ->
|
||||
Status
|
||||
end.
|
||||
|
||||
|
||||
%%%============================================================================
|
||||
|
@ -3940,10 +3950,11 @@ fetch_status_test() ->
|
|||
{ok, Pid, {FirstKey, LastKey}, _Bloom} =
|
||||
testsst_new(RP, Filename, 1, KVList1, length(KVList1), native),
|
||||
{status, Pid, {module, gen_statem}, SItemL} = sys:get_status(Pid),
|
||||
S = lists:keyfind(state, 1, lists:nth(5, SItemL)),
|
||||
{data,[{"State", {reader, S}}]} = lists:nth(3, lists:nth(5, SItemL)),
|
||||
true = is_integer(array:size(S#state.fetch_cache)),
|
||||
true = is_integer(array:size(element(2, S#state.blockindex_cache))),
|
||||
ST = format_status(terminate, [dict:new(), starting, S]),
|
||||
Status = format_status(#{reason => terminate, state => S}),
|
||||
ST = maps:get(state, Status),
|
||||
?assertMatch(redacted, ST#state.blockindex_cache),
|
||||
?assertMatch(redacted, ST#state.fetch_cache),
|
||||
ok = sst_close(Pid),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue