Issue with tag order

https://github.com/martinsumner/leveled/issues/309

Resolve issue, and remove test log entries used when discovering issue.
This commit is contained in:
Martin Sumner 2020-03-16 16:35:06 +00:00
parent 6350302ea8
commit dbceda876c
3 changed files with 3 additions and 25 deletions

View file

@ -1511,7 +1511,7 @@ accumulate_positions({K, V}, {PosBinAcc, NoHashCount, HashAcc, LMDAcc}) ->
NHC:7/integer, NHC:7/integer,
PosBinAcc/binary>>, PosBinAcc/binary>>,
0, 0,
HashAcc, [H1|HashAcc],
LMDAcc0} LMDAcc0}
end; end;
false -> false ->
@ -2304,7 +2304,7 @@ split_lists(KVList1, SlotLists, N, PressMethod, IdxModDate) ->
-spec merge_lists(list(), list(), tuple(), sst_options(), boolean()) -> -spec merge_lists(list(), list(), tuple(), sst_options(), boolean()) ->
{list(), list(), list(tuple()), tuple()|null}. {list(), list(), list(tuple()), tuple()|null}.
%% @doc %% @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 %% provided may include pointers to fetch more Keys/Values from the source
%% file %% file
merge_lists(KVList1, KVList2, LevelInfo, SSTOpts, IndexModDate) -> merge_lists(KVList1, KVList2, LevelInfo, SSTOpts, IndexModDate) ->

View file

@ -171,7 +171,7 @@ bespoketag_recalc(_Config) ->
fun(Book, MustFind) -> fun(Book, MustFind) ->
fun(I) -> fun(I) ->
testutil:stdload_object(Book, 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}), I, erlang:phash2({value, I}),
infinity, bespoke_tag, false, MustFind) infinity, bespoke_tag, false, MustFind)
end end
@ -205,24 +205,13 @@ bespoketag_recalc(_Config) ->
[CountA]), [CountA]),
true = 2 * KeyCount == 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 = leveled_bookie:book_close(Book1),
{ok, Book2} = leveled_bookie:book_start(BookOpts), {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)), 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), {async, FolderB} = CountFold(Book2, 3 * KeyCount),
CountB = FolderB(), CountB = FolderB(),
io:format("Counted triple index entries ~w - everything re-loaded~n",
[CountB]),
true = 3 * KeyCount == CountB, true = 3 * KeyCount == CountB,
testutil:compact_and_wait(Book2), testutil:compact_and_wait(Book2),

View file

@ -262,11 +262,6 @@ stdload_object(Book, B, K, I, V, TTL, Tag, RemovePrev2i, MustFind) ->
[{index, [I|PrevIs]}, {value, V}]} [{index, [I|PrevIs]}, {value, V}]}
end; end;
{not_found, false} -> {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} {[{add, <<"temp_int">>, I}], Obj}
end, end,
R = R =
@ -277,12 +272,6 @@ stdload_object(Book, B, K, I, V, TTL, Tag, RemovePrev2i, MustFind) ->
leveled_bookie:book_tempput(Book, B, K, Obj0, leveled_bookie:book_tempput(Book, B, K, Obj0,
IdxSpecs, Tag, TTL) IdxSpecs, Tag, TTL)
end, end,
case K of
<<57, 57, 57>> ->
io:format("K ~w I ~w R ~w~n", [K, I, R]);
_ ->
ok
end,
case R of case R of
ok -> ok ->
ok; ok;