Skip to content

Commit

Permalink
try random again
Browse files Browse the repository at this point in the history
  • Loading branch information
kjnilsson committed Dec 17, 2024
1 parent 53fad26 commit 0cbd28b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ra_log_segment.erl
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ open(Filename, Options) ->

process_file(true, Mode, Filename, Fd, Options) ->
AccessPattern = maps:get(access_pattern, Options, random),
if AccessPattern == random andalso
Mode == read ->
%% this is a guess using the defaults
Offs = maps:get(max_count, Options, ?SEGMENT_MAX_ENTRIES) * ?INDEX_RECORD_SIZE_V2,
_ = file:advise(Fd, Offs, 0, random),
ok;
true ->
ok
end,
case read_header(Fd) of
{ok, Version, MaxCount} ->
MaxPending = maps:get(max_pending, Options, ?SEGMENT_MAX_PENDING),
Expand Down

0 comments on commit 0cbd28b

Please sign in to comment.