Skip to content

Commit

Permalink
Use fadvise dont_need when segments are written.
Browse files Browse the repository at this point in the history
  • Loading branch information
kjnilsson committed Dec 18, 2024
1 parent 7406ed2 commit 3ff0889
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ra_log_segment.erl
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ close(#state{cfg = #cfg{fd = Fd, mode = append}} = State) ->
% close needs to be defensive and idempotent so we ignore the return
% values here
_ = sync(State),
case is_full(State) of
true ->
_ = file:advise(Fd, 0, 0, dont_need);
false ->
ok
end,
_ = file:close(Fd),
ok;
close(#state{cfg = #cfg{fd = Fd}}) ->
Expand Down

0 comments on commit 3ff0889

Please sign in to comment.