Skip to content

Commit

Permalink
remove fadvise for now
Browse files Browse the repository at this point in the history
  • Loading branch information
kjnilsson committed Dec 17, 2024
1 parent 179ff36 commit d6ce05a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/ra_log_segment.erl
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ open(Filename, Options) ->

process_file(true, Mode, Filename, Fd, Options) ->
AccessPattern = maps:get(access_pattern, Options, random),
if AccessPattern == random andalso
Mode == read ->
%% advise for random access for any data beyond our best guess
%% index size, readers could pass `max_count` in the config to
%% ensure this is correct
ConfMaxCount = maps:get(max_count, Options, ?SEGMENT_MAX_ENTRIES),
Offset = ?HEADER_SIZE + (ConfMaxCount * ?INDEX_RECORD_SIZE_V2),
ok = file:advise(Fd, Offset, 0, random);
true ->
ok
end,
% if AccessPattern == random andalso
% Mode == read ->
% %% advise for random access for any data beyond our best guess
% %% index size, readers could pass `max_count` in the config to
% %% ensure this is correct
% ConfMaxCount = maps:get(max_count, Options, ?SEGMENT_MAX_ENTRIES),
% Offset = ?HEADER_SIZE + (ConfMaxCount * ?INDEX_RECORD_SIZE_V2),
% ok = file:advise(Fd, Offset, 0, random);
% true ->
% ok
% end,
case read_header(Fd) of
{ok, Version, MaxCount} ->
MaxPending = maps:get(max_pending, Options, ?SEGMENT_MAX_PENDING),
Expand Down Expand Up @@ -286,7 +286,7 @@ fold(#state{cfg = #cfg{mode = read} = Cfg,

-spec is_modified(state()) -> boolean().
is_modified(#state{cfg = #cfg{fd = Fd},
data_offset = DataOffset} = State) ->
data_offset = DataOffset} = State) ->
case is_full(State) of
true ->
%% a full segment cannot be appended to.
Expand Down

0 comments on commit d6ce05a

Please sign in to comment.