Revert "Accumulate keys in check_blocks"

This reverts commit 5414e18047.
This commit is contained in:
Martin Sumner 2018-05-16 15:11:18 +01:00
parent 9cc27469c1
commit cbf6e26fc8

View file

@ -369,6 +369,7 @@ sst_getkvrange(Pid, StartKey, EndKey, ScanWidth) ->
%% leveled_tictac %% leveled_tictac
sst_getfilteredrange(Pid, StartKey, EndKey, ScanWidth, SegList) -> sst_getfilteredrange(Pid, StartKey, EndKey, ScanWidth, SegList) ->
SegList0 = tune_seglist(SegList), SegList0 = tune_seglist(SegList),
io:format("Using tuned seglist ~w~n", [SegList0]),
case gen_fsm:sync_send_event(Pid, case gen_fsm:sync_send_event(Pid,
{get_kvrange, {get_kvrange,
StartKey, EndKey, StartKey, EndKey,
@ -1257,12 +1258,9 @@ generate_binary_slot(Lookup, KVL, PressMethod, BuildTimings0) ->
% Acc should start as not_present if LedgerKey is a key, and a list if % Acc should start as not_present if LedgerKey is a key, and a list if
% LedgerKey is false % LedgerKey is false
check_blocks([], _Handle, _StartPos, _BlockLengths, _PosBinLength,
_LedgerKeyToCheck, _PressMethod, Acc) when is_list(Acc) ->
lists:reverse(Acc);
check_blocks([], _Handle, _StartPos, _BlockLengths, _PosBinLength, check_blocks([], _Handle, _StartPos, _BlockLengths, _PosBinLength,
_LedgerKeyToCheck, _PressMethod, Acc) -> _LedgerKeyToCheck, _PressMethod, Acc) ->
Acc; % Should be not_present only? Acc;
check_blocks([Pos|Rest], Handle, StartPos, BlockLengths, PosBinLength, check_blocks([Pos|Rest], Handle, StartPos, BlockLengths, PosBinLength,
LedgerKeyToCheck, PressMethod, Acc) -> LedgerKeyToCheck, PressMethod, Acc) ->
{BlockNumber, BlockPos} = revert_position(Pos), {BlockNumber, BlockPos} = revert_position(Pos),
@ -1280,10 +1278,8 @@ check_blocks([Pos|Rest], Handle, StartPos, BlockLengths, PosBinLength,
_ -> _ ->
case LedgerKeyToCheck of case LedgerKeyToCheck of
false -> false ->
check_blocks(Rest, Handle, StartPos, io:format("{K, V} found in block of ~w~n", [{K, V}]),
BlockLengths, PosBinLength, Acc ++ [{K, V}];
LedgerKeyToCheck, PressMethod,
[{K, V}|Acc]);
_ -> _ ->
check_blocks(Rest, Handle, StartPos, check_blocks(Rest, Handle, StartPos,
BlockLengths, PosBinLength, BlockLengths, PosBinLength,
@ -1386,8 +1382,11 @@ read_slots(Handle, SlotList, {SegList, BlockIndexCache}, PressMethod) ->
% other keys % other keys
case find_pos(BlockIdx, SegList, [], 0) of case find_pos(BlockIdx, SegList, [], 0) of
[] -> [] ->
io:format("Empty postion list for slot~n"),
Acc; Acc;
PositionList -> PositionList ->
io:format("~w positions found for slot~n",
[length(PositionList)]),
Acc ++ Acc ++
check_blocks(PositionList, check_blocks(PositionList,
Handle, SP, Handle, SP,
@ -1687,6 +1686,7 @@ find_pos(<<1:1/integer, PotentialHit:15/integer, T/binary>>,
HashList, PosList, Count) when is_list(HashList) -> HashList, PosList, Count) when is_list(HashList) ->
case lists:member(PotentialHit, HashList) of case lists:member(PotentialHit, HashList) of
true -> true ->
io:format("Found pos based on ~w~n", [PotentialHit]),
find_pos(T, HashList, PosList ++ [Count], Count + 1); find_pos(T, HashList, PosList ++ [Count], Count + 1);
false -> false ->
find_pos(T, HashList, PosList, Count + 1) find_pos(T, HashList, PosList, Count + 1)