summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Mazzoli <francesco@rabbitmq.com>2012-02-01 17:45:09 +0000
committerFrancesco Mazzoli <francesco@rabbitmq.com>2012-02-01 17:45:09 +0000
commit1311fd5b5a5e6490579919cb865e09e1f58766cc (patch)
treea0e3f2c07d7a882d4ce816bba7b249c7d8ed78f0
parente0fcc125297062763771da0e5b6208307d7fa62f (diff)
downloadrabbitmq-server-bug24234.tar.gz
Committed some changes by mistake...bug24234
-rw-r--r--src/file_handle_cache.erl8
-rw-r--r--src/rabbit_queue_index.erl4
-rw-r--r--src/rabbit_variable_queue.erl33
3 files changed, 13 insertions, 32 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl
index bbf50d32..c11fb54b 100644
--- a/src/file_handle_cache.erl
+++ b/src/file_handle_cache.erl
@@ -149,7 +149,6 @@
-export([obtain/0, release/0, transfer/1, set_limit/1, get_limit/0, info_keys/0,
info/0, info/1]).
-export([ulimit/0]).
--export([needs_sync/1]).
-export([start_link/0, init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3, prioritise_cast/2]).
@@ -374,13 +373,6 @@ sync(Ref) ->
end
end).
-needs_sync(Ref) ->
- with_flushed_handles(
- [Ref],
- fun ([#handle { is_dirty = false, write_buffer = [] }]) -> false;
- (_) -> true
- end).
-
position(Ref, NewOffset) ->
with_flushed_handles(
[Ref],
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl
index 434f28d4..f03c1d1c 100644
--- a/src/rabbit_queue_index.erl
+++ b/src/rabbit_queue_index.erl
@@ -22,7 +22,6 @@
next_segment_boundary/1, bounds/1, recover/1]).
-export([add_queue_ttl/0]).
--export([needs_sync/1]).
-define(CLEAN_FILENAME, "clean.dot").
@@ -299,9 +298,6 @@ sync(SeqIds, State) ->
%% seqids not being in the journal.
sync_if([] =/= SeqIds, State).
-needs_sync(#qistate { journal_handle = JournalHdl }) ->
- file_handle_cache:needs_sync(JournalHdl).
-
flush(State = #qistate { dirty_count = 0 }) -> State;
flush(State) -> flush_journal(State).
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 8407bebf..9b45b558 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -731,28 +731,21 @@ ram_duration(State = #vqstate {
ram_msg_count_prev = RamMsgCount,
ram_ack_count_prev = RamAckCount }}.
-needs_timeout(State = #vqstate { index_state = IndexState }) ->
- case rabbit_queue_index:needs_sync(IndexState) of
- true ->
- timed;
- false ->
- case needs_index_sync(State) of
- false -> case reduce_memory_use(
- fun (_Quota, State1) -> {0, State1} end,
- fun (_Quota, State1) -> State1 end,
- fun (_Quota, State1) -> {0, State1} end,
- State) of
- {true, _State} -> idle;
- {false, _State} -> false
- end;
- true -> timed
- end
+needs_timeout(State) ->
+ case needs_index_sync(State) of
+ false -> case reduce_memory_use(
+ fun (_Quota, State1) -> {0, State1} end,
+ fun (_Quota, State1) -> State1 end,
+ fun (_Quota, State1) -> {0, State1} end,
+ State) of
+ {true, _State} -> idle;
+ {false, _State} -> false
+ end;
+ true -> timed
end.
-timeout(State = #vqstate { index_state = IndexState }) ->
- State1 = State #vqstate {
- index_state = rabbit_queue_index:sync(IndexState) },
- a(reduce_memory_use(State1)).
+timeout(State) ->
+ a(reduce_memory_use(confirm_commit_index(State))).
handle_pre_hibernate(State = #vqstate { index_state = IndexState }) ->
State #vqstate { index_state = rabbit_queue_index:flush(IndexState) }.