From 6736a2decf655d26c73aae80149d7964fc1b7a01 Mon Sep 17 00:00:00 2001 From: Karl Nilsson Date: Tue, 19 Nov 2024 15:54:51 +0000 Subject: [PATCH] uh? --- src/ra_log_reader.erl | 6 +++--- test/ra_log_2_SUITE.erl | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ra_log_reader.erl b/src/ra_log_reader.erl index 6d19182e..7ae47d9f 100644 --- a/src/ra_log_reader.erl +++ b/src/ra_log_reader.erl @@ -212,9 +212,9 @@ segment_read_plan(_RegRefs, [], Acc) -> segment_read_plan([{To, From, Fn} | SegRefs], Indexes, Acc) -> %% TODO: address unnecessary allocation here Range = {To, From}, - case lists:splitwith(fun (I) -> - ra_range:in(I, Range) - end, Indexes) of + case sparse_read_split(fun (I) -> + ra_range:in(I, Range) + end, Indexes, []) of {[], _} -> segment_read_plan(SegRefs, Indexes, Acc); {Idxs, Rem} -> diff --git a/test/ra_log_2_SUITE.erl b/test/ra_log_2_SUITE.erl index 5f5183a8..a1fcb1e4 100644 --- a/test/ra_log_2_SUITE.erl +++ b/test/ra_log_2_SUITE.erl @@ -463,9 +463,10 @@ read_plan(Config) -> % NumDiv2 = Num div 2, %% create a list of indexes with some consecutive and some gaps Indexes = lists:usort(lists:seq(1, Num, 2) ++ lists:seq(1, Num, 5)), - %% make sure that the ETS deletes have been finished before we re-init + %% make sure that the ETS deletes hae been finished before we re-init gen_server:call(ra_log_ets, ok), ReadState = ra_log:partial_read(Indexes, Log4), + ct:pal("readStater ~p", [ReadState]), % Flru0 = ra_flru:new(1, fun ({_, S}) -> ra_log_segment:close(S) end), {EntriesOut, _} = ra_log:execute_read(ReadState, undefined),