Skip to content

Commit

Permalink
Optimise test
Browse files Browse the repository at this point in the history
Test made faster through backporting testutil:get_compressiblevalue/0 from develop-3.4.

Also use lower max_sstslots to invoke condition with fewer kesy, and reduce test time.
  • Loading branch information
martinsumner committed Nov 30, 2024
1 parent 159425c commit f7cb25f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions test/end_to_end/riak_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ all() -> [


test_large_lsm_merge(_Config) ->
lsm_merge_tester(24).
lsm_merge_tester(12).

lsm_merge_tester(LoopsPerBucket) ->
RootPath = testutil:reset_filestructure("lsmMerge"),
Expand All @@ -44,7 +44,7 @@ lsm_merge_tester(LoopsPerBucket) ->
[
{root_path, RootPath},
{max_pencillercachesize, 16000},
{max_sstslots, 96},
{max_sstslots, 48},
% Make SST files smaller, to accelerate merges
{max_mergebelow, 24},
{sync_strategy, testutil:sync_strategy()},
Expand Down
26 changes: 17 additions & 9 deletions test/end_to_end/testutil.erl
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,15 @@ get_compressiblevalue() ->
Selector = [{1, S1}, {2, S2}, {3, S3}, {4, S4},
{5, S5}, {6, S6}, {7, S7}, {8, S8}],
L = lists:seq(1, 1024),
lists:foldl(fun(_X, Acc) ->
{_, Str} = lists:keyfind(leveled_rand:uniform(8), 1, Selector),
Acc ++ Str end,
"",
L).
iolist_to_binary(
lists:foldl(
fun(_X, Acc) ->
{_, Str} = lists:keyfind(rand:uniform(8), 1, Selector),
[Str|Acc] end,
[""],
L
)
).

generate_smallobjects(Count, KeyNumber) ->
generate_objects(Count, KeyNumber, [], leveled_rand:rand_bytes(512)).
Expand Down Expand Up @@ -637,8 +641,10 @@ get_value(ObjectBin) ->
<<SibLength:32/integer, Rest2/binary>> = SibsBin,
<<ContentBin:SibLength/binary, _MetaBin/binary>> = Rest2,
case ContentBin of
<<0, ContentBin0/binary>> ->
binary_to_term(ContentBin0)
<<0:8/integer, ContentBin0/binary>> ->
binary_to_term(ContentBin0);
<<1:8/integer, ContentAsIs/binary>> ->
ContentAsIs
end;
N ->
io:format("SibCount of ~w with ObjectBin ~w~n", [N, ObjectBin]),
Expand Down Expand Up @@ -696,8 +702,10 @@ get_randomindexes_generator(Count) ->
lists:map(
fun(X) ->
{add,
list_to_binary("idx" ++ integer_to_list(X) ++ "_bin"),
list_to_binary(get_randomdate() ++ get_randomname())}
iolist_to_binary(
"idx" ++ integer_to_list(X) ++ "_bin"),
iolist_to_binary(
get_randomdate() ++ get_randomname())}
end,
lists:seq(1, Count))
end,
Expand Down

0 comments on commit f7cb25f

Please sign in to comment.