Add hash to missing key test

This commit is contained in:
martinsumner 2016-12-24 18:03:34 +00:00
parent 8526106312
commit 480820e466

View file

@ -587,21 +587,21 @@ simple_persisted_test() ->
"Checking for ~w keys (twice) in file with cache hit took ~w " "Checking for ~w keys (twice) in file with cache hit took ~w "
++ "microseconds~n", ++ "microseconds~n",
[length(KVList1), timer:now_diff(os:timestamp(), SW1)]), [length(KVList1), timer:now_diff(os:timestamp(), SW1)]),
KVList2 = generate_randomkeys(1, ?SLOT_SIZE * 8 + 100, 1, 4), KVList2 = generate_randomkeys(1, ?SLOT_SIZE * 20 + 100, 1, 4),
MapFun = MapFun =
fun({K, V}, Acc) -> fun({K, V}, Acc) ->
In = lists:keymember(K, 1, KVList1), In = lists:keymember(K, 1, KVList1),
case {K > FirstKey, LastKey > K, In} of case {K > FirstKey, LastKey > K, In} of
{true, true, false} -> {true, true, false} ->
[{K, V}|Acc]; [{K, leveled_codec:magic_hash(K), V}|Acc];
_ -> _ ->
Acc Acc
end end
end, end,
KVList3 = lists:foldl(MapFun, [], KVList2), KVList3 = lists:foldl(MapFun, [], KVList2),
SW2 = os:timestamp(), SW2 = os:timestamp(),
lists:foreach(fun({K, V}) -> lists:foreach(fun({K, H, _V}) ->
?assertMatch(not_present, sst_get(Pid, K)) ?assertMatch(not_present, sst_get(Pid, K, H))
end, end,
KVList3), KVList3),
io:format(user, io:format(user,