diff --git a/src/leveled_iclerk.erl b/src/leveled_iclerk.erl index f19746a..5c6b126 100644 --- a/src/leveled_iclerk.erl +++ b/src/leveled_iclerk.erl @@ -648,8 +648,8 @@ schedule_test_bycount(N) -> ?assertMatch(true, SecondsToCompaction0 < 5700), SecondsToCompaction1 = schedule_compaction([14], N, CurrentTS), % tomorrow! io:format("Seconds to compaction ~w~n", [SecondsToCompaction1]), - ?assertMatch(true, SecondsToCompaction1 > 81000), - ?assertMatch(true, SecondsToCompaction1 < 84300). + ?assertMatch(true, SecondsToCompaction1 >= 81180), + ?assertMatch(true, SecondsToCompaction1 =< 84780). simple_score_test() -> diff --git a/src/leveled_sst.erl b/src/leveled_sst.erl index 89bf729..3ec82a1 100644 --- a/src/leveled_sst.erl +++ b/src/leveled_sst.erl @@ -1186,8 +1186,8 @@ block_offsetandlength(BlockLengths, BlockID) -> {BlocksPos, B1L + B2L + B3L + B4L, B5L} end. -extra_hash({_SegHash, ExtraHash}) when is_integer(ExtraHash) -> - ExtraHash band 32767; +extra_hash({SegHash, _ExtraHash}) when is_integer(SegHash) -> + SegHash band 32767; extra_hash(NotHash) -> NotHash. diff --git a/src/leveled_tinybloom.erl b/src/leveled_tinybloom.erl index fc70469..3c21f3f 100644 --- a/src/leveled_tinybloom.erl +++ b/src/leveled_tinybloom.erl @@ -48,7 +48,7 @@ create_bloom(HashList) -> %% Check for the presence of a given hash within a bloom check_hash(_Hash, <<>>) -> false; -check_hash({Hash, _ExtraHash}, BloomBin) -> +check_hash({_SegHash, Hash}, BloomBin) -> SlotSplit = (byte_size(BloomBin) div ?BITS_PER_KEY) - 1, {Slot, H0, H1} = split_hash(Hash, SlotSplit), Mask = get_mask(H0, H1), @@ -66,10 +66,10 @@ check_hash({Hash, _ExtraHash}, BloomBin) -> %%% Internal Functions %%%============================================================================ -split_hash(SegHash, SlotSplit) -> - Slot = SegHash band SlotSplit, - H0 = (SegHash bsr 4) band (?BAND_MASK), - H1 = (SegHash bsr 10) band (?BAND_MASK), +split_hash(Hash, SlotSplit) -> + Slot = Hash band SlotSplit, + H0 = (Hash bsr 4) band (?BAND_MASK), + H1 = (Hash bsr 10) band (?BAND_MASK), {Slot, H0, H1}. get_mask(H0, H1) -> @@ -87,7 +87,7 @@ get_mask(H0, H1) -> add_hashlist([], _S, S0, S1) -> IntSize = ?INTEGER_SIZE, <>; -add_hashlist([{TopHash, _ExtraHash}|T], SlotSplit, S0, S1) -> +add_hashlist([{_SegHash, TopHash}|T], SlotSplit, S0, S1) -> {Slot, H0, H1} = split_hash(TopHash, SlotSplit), Mask = get_mask(H0, H1), case Slot of @@ -101,7 +101,7 @@ add_hashlist([], _S, S0, S1, S2, S3) -> IntSize = ?INTEGER_SIZE, <>; -add_hashlist([{TopHash, _ExtraHash}|T], SlotSplit, S0, S1, S2, S3) -> +add_hashlist([{_SegHash, TopHash}|T], SlotSplit, S0, S1, S2, S3) -> {Slot, H0, H1} = split_hash(TopHash, SlotSplit), Mask = get_mask(H0, H1), case Slot of @@ -126,7 +126,7 @@ add_hashlist([], _S, S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA:IntSize/integer, SB:IntSize/integer, SC:IntSize/integer, SD:IntSize/integer, SE:IntSize/integer, SF:IntSize/integer>>; -add_hashlist([{TopHash, _ExtraHash}|T], +add_hashlist([{_SegHash, TopHash}|T], SlotSplit, S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF) ->