summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Videla <videlalvaro@gmail.com>2015-10-14 07:45:50 +0200
committerAlvaro Videla <videlalvaro@gmail.com>2015-10-14 07:45:50 +0200
commit6c3de1303e4a1175fa3e222ff7a47a83cb258bbc (patch)
tree55dad87b2ed5c91cf28980070b97251b397d1b1c
parentee19ec06d56bc73a8ba542f9202ba7a7f5bccc56 (diff)
parent63eccd863a493795a92941af3be41af364e1d637 (diff)
downloadrabbitmq-server-git-6c3de1303e4a1175fa3e222ff7a47a83cb258bbc.tar.gz
Merge branch 'master' into rabbitmq-server-351
-rw-r--r--docs/rabbitmq.config.example5
-rw-r--r--ebin/rabbit_app.in1
-rwxr-xr-xscripts/rabbitmqctl.bat8
-rw-r--r--src/rabbit_memory_monitor.erl4
-rw-r--r--test/src/rabbit_tests.erl22
5 files changed, 28 insertions, 12 deletions
diff --git a/docs/rabbitmq.config.example b/docs/rabbitmq.config.example
index 3047f8f70e..dd1a4e6c87 100644
--- a/docs/rabbitmq.config.example
+++ b/docs/rabbitmq.config.example
@@ -200,6 +200,11 @@
%%
%% {vm_memory_high_watermark_paging_ratio, 0.5},
+ %% Interval (in milliseconds) at which we perform the check of the memory
+ %% levels against the watermarks.
+ %%
+ %% {memory_monitor_interval, 2500},
+
%% Set disk free limit (in bytes). Once free disk space reaches this
%% lower bound, a disk alarm will be set - see the documentation
%% listed above for more details.
diff --git a/ebin/rabbit_app.in b/ebin/rabbit_app.in
index 3510474527..92c9c2983d 100644
--- a/ebin/rabbit_app.in
+++ b/ebin/rabbit_app.in
@@ -19,6 +19,7 @@
{ssl_options, []},
{vm_memory_high_watermark, 0.4},
{vm_memory_high_watermark_paging_ratio, 0.5},
+ {memory_monitor_interval, 2500},
{disk_free_limit, 50000000}, %% 50MB
{msg_store_index_module, rabbit_msg_store_ets_index},
{backing_queue_module, rabbit_variable_queue},
diff --git a/scripts/rabbitmqctl.bat b/scripts/rabbitmqctl.bat
index 45e2929579..9ad855bf87 100755
--- a/scripts/rabbitmqctl.bat
+++ b/scripts/rabbitmqctl.bat
@@ -24,6 +24,10 @@ set TDP0=%~dp0
set STAR=%*
setlocal enabledelayedexpansion
+REM Get default settings with user overrides for (RABBITMQ_)<var_name>
+REM Non-empty defaults should be set in rabbitmq-env
+call "%TDP0%\rabbitmq-env.bat"
+
if not exist "!ERLANG_HOME!\bin\erl.exe" (
echo.
echo ******************************
@@ -36,10 +40,6 @@ if not exist "!ERLANG_HOME!\bin\erl.exe" (
exit /B 1
)
-REM Get default settings with user overrides for (RABBITMQ_)<var_name>
-REM Non-empty defaults should be set in rabbitmq-env
-call "%TDP0%\rabbitmq-env.bat"
-
"!ERLANG_HOME!\bin\erl.exe" ^
-pa "!TDP0!..\ebin" ^
-noinput ^
diff --git a/src/rabbit_memory_monitor.erl b/src/rabbit_memory_monitor.erl
index 7aa29fc423..24b3ae9af4 100644
--- a/src/rabbit_memory_monitor.erl
+++ b/src/rabbit_memory_monitor.erl
@@ -41,7 +41,6 @@
}).
-define(SERVER, ?MODULE).
--define(DEFAULT_UPDATE_INTERVAL, 2500).
-define(TABLE_NAME, ?MODULE).
%% If all queues are pushed to disk (duration 0), then the sum of
@@ -110,7 +109,8 @@ memory_use(ratio) ->
%%----------------------------------------------------------------------------
init([]) ->
- {ok, TRef} = timer:send_interval(?DEFAULT_UPDATE_INTERVAL, update),
+ {ok, Interval} = application:get_env(rabbit, memory_monitor_interval),
+ {ok, TRef} = timer:send_interval(Interval, update),
Ets = ets:new(?TABLE_NAME, [set, private, {keypos, #process.pid}]),
Alarms = rabbit_alarm:register(self(), {?MODULE, conserve_resources, []}),
diff --git a/test/src/rabbit_tests.erl b/test/src/rabbit_tests.erl
index 7fbfea2a4b..2235717ebf 100644
--- a/test/src/rabbit_tests.erl
+++ b/test/src/rabbit_tests.erl
@@ -1983,7 +1983,7 @@ test_file_handle_cache() ->
test_backing_queue() ->
case application:get_env(rabbit, backing_queue_module) of
- {ok, rabbit_variable_queue} ->
+ {ok, rabbit_priority_queue} ->
{ok, FileSizeLimit} =
application:get_env(rabbit, msg_store_file_size_limit),
application:set_env(rabbit, msg_store_file_size_limit, 512),
@@ -2566,7 +2566,9 @@ variable_queue_batch_publish(IsPersistent, Count, PropFun, VQ) ->
variable_queue_batch_publish(IsPersistent, Start, Count, PropFun, PayloadFun, VQ) ->
variable_queue_batch_publish0(IsPersistent, Start, Count, PropFun,
- PayloadFun, fun make_publish/4, VQ).
+ PayloadFun, fun make_publish/4,
+ fun rabbit_variable_queue:batch_publish/4,
+ VQ).
variable_queue_batch_publish_delivered(IsPersistent, Count, VQ) ->
variable_queue_batch_publish_delivered(IsPersistent, Count, fun (_N, P) -> P end, VQ).
@@ -2577,16 +2579,24 @@ variable_queue_batch_publish_delivered(IsPersistent, Count, PropFun, VQ) ->
variable_queue_batch_publish_delivered(IsPersistent, Start, Count, PropFun, PayloadFun, VQ) ->
variable_queue_batch_publish0(IsPersistent, Start, Count, PropFun,
- PayloadFun, fun make_publish_delivered/4, VQ).
+ PayloadFun, fun make_publish_delivered/4,
+ fun rabbit_variable_queue:batch_publish_delivered/4,
+ VQ).
variable_queue_batch_publish0(IsPersistent, Start, Count, PropFun, PayloadFun,
- MakePubFun, VQ) ->
+ MakePubFun, PubFun, VQ) ->
Publishes =
[MakePubFun(IsPersistent, PayloadFun, PropFun, N)
|| N <- lists:seq(Start, Start + Count - 1)],
- VQ1 = rabbit_variable_queue:batch_publish(Publishes, self(), noflow, VQ),
+ Res = PubFun(Publishes, self(), noflow, VQ),
+ VQ1 = pub_res(Res),
variable_queue_wait_for_shuffling_end(VQ1).
+pub_res({_, VQS}) ->
+ VQS;
+pub_res(VQS) ->
+ VQS.
+
make_publish(IsPersistent, PayloadFun, PropFun, N) ->
{rabbit_basic:message(
rabbit_misc:r(<<>>, exchange, <<>>),
@@ -2717,7 +2727,7 @@ test_variable_queue_batch_publish(VQ) ->
test_variable_queue_batch_publish_delivered(VQ) ->
Count = 10,
VQ1 = variable_queue_batch_publish_delivered(true, Count, VQ),
- Count = rabbit_variable_queue:len(VQ1),
+ Count = rabbit_variable_queue:depth(VQ1),
VQ1.
test_variable_queue_fold(VQ0) ->