Skip to content

Commit 0cbd28b

Browse files
committed
try random again
1 parent 53fad26 commit 0cbd28b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/ra_log_segment.erl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ open(Filename, Options) ->
116116

117117
process_file(true, Mode, Filename, Fd, Options) ->
118118
AccessPattern = maps:get(access_pattern, Options, random),
119+
if AccessPattern == random andalso
120+
Mode == read ->
121+
%% this is a guess using the defaults
122+
Offs = maps:get(max_count, Options, ?SEGMENT_MAX_ENTRIES) * ?INDEX_RECORD_SIZE_V2,
123+
_ = file:advise(Fd, Offs, 0, random),
124+
ok;
125+
true ->
126+
ok
127+
end,
119128
case read_header(Fd) of
120129
{ok, Version, MaxCount} ->
121130
MaxPending = maps:get(max_pending, Options, ?SEGMENT_MAX_PENDING),

0 commit comments

Comments
 (0)