From dbceda876cea052ea4899114af1e0e1dbfe68870 Mon Sep 17 00:00:00 2001 From: Martin Sumner Date: Mon, 16 Mar 2020 16:35:06 +0000 Subject: [PATCH] Issue with tag order https://github.com/martinsumner/leveled/issues/309 Resolve issue, and remove test log entries used when discovering issue. --- src/leveled_sst.erl | 4 ++-- test/end_to_end/appdefined_SUITE.erl | 13 +------------ test/end_to_end/testutil.erl | 11 ----------- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/src/leveled_sst.erl b/src/leveled_sst.erl index 2eddd34..330d1d4 100644 --- a/src/leveled_sst.erl +++ b/src/leveled_sst.erl @@ -1511,7 +1511,7 @@ accumulate_positions({K, V}, {PosBinAcc, NoHashCount, HashAcc, LMDAcc}) -> NHC:7/integer, PosBinAcc/binary>>, 0, - HashAcc, + [H1|HashAcc], LMDAcc0} end; false -> @@ -2304,7 +2304,7 @@ split_lists(KVList1, SlotLists, N, PressMethod, IdxModDate) -> -spec merge_lists(list(), list(), tuple(), sst_options(), boolean()) -> {list(), list(), list(tuple()), tuple()|null}. %% @doc -%% Merge lists when merging across more thna one file. KVLists that are +%% Merge lists when merging across more than one file. KVLists that are %% provided may include pointers to fetch more Keys/Values from the source %% file merge_lists(KVList1, KVList2, LevelInfo, SSTOpts, IndexModDate) -> diff --git a/test/end_to_end/appdefined_SUITE.erl b/test/end_to_end/appdefined_SUITE.erl index 8f44560..9a8cf39 100644 --- a/test/end_to_end/appdefined_SUITE.erl +++ b/test/end_to_end/appdefined_SUITE.erl @@ -171,7 +171,7 @@ bespoketag_recalc(_Config) -> fun(Book, MustFind) -> fun(I) -> testutil:stdload_object(Book, - B0, list_to_binary(["A"|integer_to_list(I rem KeyCount)]), + B0, integer_to_binary(I rem KeyCount), I, erlang:phash2({value, I}), infinity, bespoke_tag, false, MustFind) end @@ -205,24 +205,13 @@ bespoketag_recalc(_Config) -> [CountA]), true = 2 * KeyCount == CountA, - io:format("Before close looking for Key 999 ~w~n", - [leveled_bookie:book_head(Book1, B0, <<"A999">>, bespoke_tag)]), - ok = leveled_bookie:book_close(Book1), {ok, Book2} = leveled_bookie:book_start(BookOpts), - io:format("After opening looking for Key 999 ~w~n", - [leveled_bookie:book_head(Book2, B0, <<"A999">>, bespoke_tag)]), - lists:foreach(LoadFun(Book2, true), lists:seq(KeyCount * 2 + 1, KeyCount * 3)), - io:format("After fresh load looking for Key 999 ~w~n", - [leveled_bookie:book_head(Book2, B0, <<"A999">>, bespoke_tag)]), - {async, FolderB} = CountFold(Book2, 3 * KeyCount), CountB = FolderB(), - io:format("Counted triple index entries ~w - everything re-loaded~n", - [CountB]), true = 3 * KeyCount == CountB, testutil:compact_and_wait(Book2), diff --git a/test/end_to_end/testutil.erl b/test/end_to_end/testutil.erl index b84d757..00ad9ad 100644 --- a/test/end_to_end/testutil.erl +++ b/test/end_to_end/testutil.erl @@ -262,11 +262,6 @@ stdload_object(Book, B, K, I, V, TTL, Tag, RemovePrev2i, MustFind) -> [{index, [I|PrevIs]}, {value, V}]} end; {not_found, false} -> - {[{add, <<"temp_int">>, I}], Obj}; - {not_found, true} -> - HR = leveled_bookie:book_head(Book, B, K, Tag), - io:format("Unexpected not_found for key=~w I=~w HR=~w~n ", - [K, I, HR]), {[{add, <<"temp_int">>, I}], Obj} end, R = @@ -277,12 +272,6 @@ stdload_object(Book, B, K, I, V, TTL, Tag, RemovePrev2i, MustFind) -> leveled_bookie:book_tempput(Book, B, K, Obj0, IdxSpecs, Tag, TTL) end, - case K of - <<57, 57, 57>> -> - io:format("K ~w I ~w R ~w~n", [K, I, R]); - _ -> - ok - end, case R of ok -> ok;