summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2010-09-27 11:17:21 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2010-09-27 11:17:21 +0100
commit9f2f845e4a0d283b487997ffeffadd5d893284ee (patch)
tree44fc2e0adf92360e989de730b23f520dc9001adf
parentfb5dbdc90f43567032ce251053eff7908666e779 (diff)
downloadrabbitmq-server-9f2f845e4a0d283b487997ffeffadd5d893284ee.tar.gz
only create read_ahead buffers for reading segment files
The buffers are a few hundred k in size, which is a significant cost. And there is no point having them when writing to segment/journal files, and they are of limited benefit when reading the journal file (which, in any case, only happens on startup).
-rw-r--r--src/rabbit_queue_index.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl
index d6b8bb28..98e73af9 100644
--- a/src/rabbit_queue_index.erl
+++ b/src/rabbit_queue_index.erl
@@ -159,7 +159,7 @@
-define(PUB, {_, _}). %% {Guid, IsPersistent}
--define(READ_MODE, [binary, raw, read, {read_ahead, ?SEGMENT_TOTAL_SIZE}]).
+-define(READ_MODE, [binary, raw, read]).
%%----------------------------------------------------------------------------
@@ -785,7 +785,8 @@ segment_entries_foldr(Fun, Init,
load_segment(KeepAcked, #segment { path = Path }) ->
case filelib:is_file(Path) of
false -> {array_new(), 0};
- true -> {ok, Hdl} = file_handle_cache:open(Path, ?READ_MODE, []),
+ true -> Mode = [{read_ahead, ?SEGMENT_TOTAL_SIZE} | ?READ_MODE],
+ {ok, Hdl} = file_handle_cache:open(Path, Mode, []),
{ok, 0} = file_handle_cache:position(Hdl, bof),
Res = load_segment_entries(KeepAcked, Hdl, array_new(), 0),
ok = file_handle_cache:close(Hdl),