diff --git a/src/leveled_penciller.erl b/src/leveled_penciller.erl index 0f214d1..e02109a 100644 --- a/src/leveled_penciller.erl +++ b/src/leveled_penciller.erl @@ -200,9 +200,14 @@ -include_lib("eunit/include/eunit.hrl"). --define(LEVEL_SCALEFACTOR, [{0, 0}, {1, 8}, {2, 64}, {3, 512}, - {4, 4096}, {5, 32768}, {6, 262144}, - {7, infinity}]). +-define(LEVEL_SCALEFACTOR, + [{0, 0}, {1, 4}, {2, 16}, {3, 64}, {4, 512}, + {5, 4096}, {6, 32768}, {7, infinity}]). + % As an alternative to going up by a factor of 8 at each level, + % increase by a factor of 4 at young levels - to make early + % compaction jobs shorter. A trillion keys is still supported + % before hitting the infinite level. At > 10 trillion keys + % behaviour may become increasingly difficult to predict. -define(MAX_LEVELS, 8). -define(MAX_WORK_WAIT, 300). -define(MANIFEST_FP, "ledger_manifest"). diff --git a/src/leveled_sst.erl b/src/leveled_sst.erl index b13d07f..e232372 100644 --- a/src/leveled_sst.erl +++ b/src/leveled_sst.erl @@ -1517,9 +1517,12 @@ binaryslot_trimmedlist(FullBin, StartKey, EndKey, PressMethod) -> crc_check_slot(FullBin) -> <> = FullBin, + CRC32H:32/integer, + Rest/binary>> = FullBin, + PosBL0 = min(PosBL, byte_size(FullBin) - 4), + % If the position has been bit-flipped to beyond the maximum paossible + % length, use the maximum possible length + <> = Rest, case {hmac(Header), hmac(PosBL)} of {CRC32H, CRC32PBL} -> {Header, Blocks};