Alternate scale factor
Also had failed unit test - there was an issue with bit-flipping the position not being safely caught
This commit is contained in:
parent
7e29480bf2
commit
7e4c3db915
2 changed files with 14 additions and 6 deletions
|
@ -200,9 +200,14 @@
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
-define(LEVEL_SCALEFACTOR, [{0, 0}, {1, 8}, {2, 64}, {3, 512},
|
-define(LEVEL_SCALEFACTOR,
|
||||||
{4, 4096}, {5, 32768}, {6, 262144},
|
[{0, 0}, {1, 4}, {2, 16}, {3, 64}, {4, 512},
|
||||||
{7, infinity}]).
|
{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_LEVELS, 8).
|
||||||
-define(MAX_WORK_WAIT, 300).
|
-define(MAX_WORK_WAIT, 300).
|
||||||
-define(MANIFEST_FP, "ledger_manifest").
|
-define(MANIFEST_FP, "ledger_manifest").
|
||||||
|
|
|
@ -1517,9 +1517,12 @@ binaryslot_trimmedlist(FullBin, StartKey, EndKey, PressMethod) ->
|
||||||
crc_check_slot(FullBin) ->
|
crc_check_slot(FullBin) ->
|
||||||
<<CRC32PBL:32/integer,
|
<<CRC32PBL:32/integer,
|
||||||
PosBL:32/integer,
|
PosBL:32/integer,
|
||||||
CRC32H:32/integer,
|
CRC32H:32/integer,
|
||||||
Header:PosBL/binary,
|
Rest/binary>> = FullBin,
|
||||||
Blocks/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
|
||||||
|
<<Header:PosBL0/binary, Blocks/binary>> = Rest,
|
||||||
case {hmac(Header), hmac(PosBL)} of
|
case {hmac(Header), hmac(PosBL)} of
|
||||||
{CRC32H, CRC32PBL} ->
|
{CRC32H, CRC32PBL} ->
|
||||||
{Header, Blocks};
|
{Header, Blocks};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue