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