Use backwards compatible term_to_binary (#408)

* Use backwards compatible term_to_binary

So that where we have hashed term_to_binary output in OTP25 or earlier, that has will be matched in OTP 26.

* Test reliability

If all keys are put in order, the max_slots may not be used, as the driver at L0 is penciller cache size, and merge to new files (managed by the parameter) only occurs when there are overlapping files the level below
This commit is contained in:
Martin Sumner 2023-10-05 10:33:20 +01:00 committed by GitHub
parent c4a32366df
commit b96518c32a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 16 deletions

View file

@ -74,9 +74,10 @@ simple_test_withlog(LogLevel, ForcedLogs) ->
ok = leveled_bookie:book_put(Bookie2, "Bucket1", "Key2", "Value2",
[{add, "Index1", "Term1"}]),
{ok, "Value2"} = leveled_bookie:book_get(Bookie2, "Bucket1", "Key2"),
{ok, {62888926, 60, undefined}} = leveled_bookie:book_head(Bookie2,
"Bucket1",
"Key2"),
{ok, {62888926, S, undefined}} =
leveled_bookie:book_head(Bookie2, "Bucket1", "Key2"),
true = (S == 58) or (S == 60),
% After OTP 26 the object is 58 bytes not 60
testutil:check_formissingobject(Bookie2, "Bucket1", "Key2"),
ok = leveled_bookie:book_put(Bookie2, "Bucket1", "Key2", <<"Value2">>,
[{remove, "Index1", "Term1"},
@ -199,16 +200,18 @@ bigsst_littlesst(_Config) ->
{compression_point, on_compact}],
{ok, Bookie1} = leveled_bookie:book_start(StartOpts1),
ObjL1 =
testutil:generate_objects(80000, 1, [],
lists:keysort(
1,
testutil:generate_objects(80000, 1, [],
leveled_rand:rand_bytes(100),
fun() -> [] end, <<"B">>),
fun() -> [] end, <<"B">>)
),
testutil:riakload(Bookie1, ObjL1),
testutil:check_forlist(Bookie1, ObjL1),
JFP = RootPath ++ "/ledger/ledger_files/",
{ok, FNS1} = file:list_dir(JFP),
ok = leveled_bookie:book_destroy(Bookie1),
StartOpts2 = lists:ukeysort(1, [{max_sstslots, 24}|StartOpts1]),
{ok, Bookie2} = leveled_bookie:book_start(StartOpts2),
testutil:riakload(Bookie2, ObjL1),