summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-06-17 17:28:34 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-06-17 17:28:34 +0100
commit1bdc38f8076bdbda5bee5b96433c666c8554d869 (patch)
treec3a58fb860e767024e1d70e04898095559d3d382
parentcb148d3f4da962a2e9a205b70c34d313d5f62482 (diff)
downloadrabbitmq-server-git-1bdc38f8076bdbda5bee5b96433c666c8554d869.tar.gz
Make the queue_index max_journal_entry_count configurable
-rw-r--r--ebin/rabbit_app.in1
-rw-r--r--src/rabbit_queue_index.erl28
2 files changed, 16 insertions, 13 deletions
diff --git a/ebin/rabbit_app.in b/ebin/rabbit_app.in
index ef80efc051..0ada27d4ea 100644
--- a/ebin/rabbit_app.in
+++ b/ebin/rabbit_app.in
@@ -23,6 +23,7 @@
{persister_max_wrap_entries, 500},
{persister_hibernate_after, 10000},
{msg_store_file_size_limit, 16777216},
+ {queue_index_max_journal_entry_count, 262144},
{default_user, <<"guest">>},
{default_pass, <<"guest">>},
{default_vhost, <<"/">>},
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl
index 417401be7a..62cbfbf308 100644
--- a/src/rabbit_queue_index.erl
+++ b/src/rabbit_queue_index.erl
@@ -69,10 +69,10 @@
%% Because of the fact that publishes, delivers and acks can occur all
%% over, we wish to avoid lots of seeking. Therefore we have a fixed
%% sized journal to which all actions are appended. When the number of
-%% entries in this journal reaches ?MAX_JOURNAL_ENTRY_COUNT, the
-%% journal entries are scattered out to their relevant files, and the
-%% journal is truncated to zero size. Note that entries in the journal
-%% must carry the full sequence id, thus the format of entries in the
+%% entries in this journal reaches max_journal_entries, the journal
+%% entries are scattered out to their relevant files, and the journal
+%% is truncated to zero size. Note that entries in the journal must
+%% carry the full sequence id, thus the format of entries in the
%% journal is different to that in the segments.
%%
%% The journal is also kept fully in memory, pre-segmented: the state
@@ -112,7 +112,6 @@
%% ---- Journal details ----
--define(MAX_JOURNAL_ENTRY_COUNT, 262144).
-define(JOURNAL_FILENAME, "journal.jif").
-define(PUB_PERSIST_JPREFIX, 2#00).
@@ -159,7 +158,8 @@
%%----------------------------------------------------------------------------
--record(qistate, { dir, segments, journal_handle, dirty_count }).
+-record(qistate, { dir, segments, journal_handle, dirty_count,
+ max_journal_entries }).
-record(segment, { num, path, journal_entries, unacked }).
@@ -178,11 +178,12 @@
})).
-type(seq_id() :: integer()).
-type(seg_dict() :: {dict(), [segment()]}).
--type(qistate() :: #qistate { dir :: file_path(),
- segments :: 'undefined' | seg_dict(),
- journal_handle :: hdl(),
- dirty_count :: integer()
- }).
+-type(qistate() :: #qistate { dir :: file_path(),
+ segments :: 'undefined' | seg_dict(),
+ journal_handle :: hdl(),
+ dirty_count :: integer(),
+ max_journal_entries :: non_neg_integer()
+ }).
-type(startup_fun_state() ::
{(fun ((A) -> 'finished' | {guid(), non_neg_integer(), A})), A}).
@@ -548,8 +549,9 @@ add_to_journal(RelSeq, Action, JEntries) ->
end,
array:set(RelSeq, Val, JEntries).
-maybe_flush_journal(State = #qistate { dirty_count = DCount })
- when DCount > ?MAX_JOURNAL_ENTRY_COUNT ->
+maybe_flush_journal(State = #qistate { dirty_count = DCount,
+ max_journal_entries = MaxJournal })
+ when DCount > MaxJournal ->
flush_journal(State);
maybe_flush_journal(State) ->
State.