summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Harrop <rob@rabbitmq.com>2010-11-02 12:20:25 +0000
committerRob Harrop <rob@rabbitmq.com>2010-11-02 12:20:25 +0000
commitc4ad482a91874672dc4eebeacbc73225a9c7d21b (patch)
tree89d03f803746830ecf3c7f9571b8eb6c064b28f7
parentd37f8725c085841c63f6ce58890e0baefea54a25 (diff)
parentb5e0ddac89ae8b42673c4c6d4daf6a833296f2b8 (diff)
downloadrabbitmq-server-c4ad482a91874672dc4eebeacbc73225a9c7d21b.tar.gz
Merged bug23346 into default
-rw-r--r--Makefile4
-rwxr-xr-xscripts/rabbitmq-server7
-rw-r--r--scripts/rabbitmq-server.bat6
-rw-r--r--scripts/rabbitmq-service.bat5
-rw-r--r--src/rabbit_plugin_activator.erl12
-rw-r--r--src/rabbit_variable_queue.erl29
6 files changed, 30 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index ee0c0838..32de335f 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ TMPDIR ?= /tmp
RABBITMQ_NODENAME ?= rabbit
RABBITMQ_SERVER_START_ARGS ?=
RABBITMQ_MNESIA_DIR ?= $(TMPDIR)/rabbitmq-$(RABBITMQ_NODENAME)-mnesia
+RABBITMQ_PLUGINS_EXPAND_DIR ?= $(TMPDIR)/rabbitmq-$(RABBITMQ_NODENAME)-plugins-scratch
RABBITMQ_LOG_BASE ?= $(TMPDIR)
DEPS_FILE=deps.mk
@@ -150,7 +151,8 @@ BASIC_SCRIPT_ENVIRONMENT_SETTINGS=\
RABBITMQ_NODE_IP_ADDRESS="$(RABBITMQ_NODE_IP_ADDRESS)" \
RABBITMQ_NODE_PORT="$(RABBITMQ_NODE_PORT)" \
RABBITMQ_LOG_BASE="$(RABBITMQ_LOG_BASE)" \
- RABBITMQ_MNESIA_DIR="$(RABBITMQ_MNESIA_DIR)"
+ RABBITMQ_MNESIA_DIR="$(RABBITMQ_MNESIA_DIR)" \
+ RABBITMQ_PLUGINS_EXPAND_DIR="$(RABBITMQ_PLUGINS_EXPAND_DIR)"
run: all
$(BASIC_SCRIPT_ENVIRONMENT_SETTINGS) \
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server
index ef0a3521..0eb7092d 100755
--- a/scripts/rabbitmq-server
+++ b/scripts/rabbitmq-server
@@ -66,6 +66,9 @@ fi
[ "x" = "x$RABBITMQ_MNESIA_DIR" ] && RABBITMQ_MNESIA_DIR=${MNESIA_DIR}
[ "x" = "x$RABBITMQ_MNESIA_DIR" ] && RABBITMQ_MNESIA_DIR=${RABBITMQ_MNESIA_BASE}/${RABBITMQ_NODENAME}
+[ "x" = "x$RABBITMQ_PLUGINS_EXPAND_DIR" ] && RABBITMQ_PLUGINS_EXPAND_DIR=${PLUGINS_EXPAND_DIR}
+[ "x" = "x$RABBITMQ_PLUGINS_EXPAND_DIR" ] && RABBITMQ_PLUGINS_EXPAND_DIR=${RABBITMQ_MNESIA_BASE}/${RABBITMQ_NODENAME}-plugins-expand
+
[ "x" = "x$RABBITMQ_PLUGINS_DIR" ] && RABBITMQ_PLUGINS_DIR="${RABBITMQ_HOME}/plugins"
## Log rotation
@@ -87,14 +90,14 @@ if [ "x" = "x$RABBITMQ_NODE_ONLY" ]; then
if erl \
-pa "$RABBITMQ_EBIN_ROOT" \
-rabbit plugins_dir "\"$RABBITMQ_PLUGINS_DIR\"" \
- -rabbit plugins_expand_dir "\"${RABBITMQ_MNESIA_DIR}/plugins-scratch\"" \
+ -rabbit plugins_expand_dir "\"$RABBITMQ_PLUGINS_EXPAND_DIR\"" \
-rabbit rabbit_ebin "\"$RABBITMQ_EBIN_ROOT\"" \
-noinput \
-hidden \
-s rabbit_plugin_activator \
-extra "$@"
then
- RABBITMQ_BOOT_FILE="${RABBITMQ_MNESIA_DIR}/plugins-scratch/rabbit"
+ RABBITMQ_BOOT_FILE="${RABBITMQ_PLUGINS_EXPAND_DIR}/rabbit"
RABBITMQ_EBIN_PATH=""
else
exit 1
diff --git a/scripts/rabbitmq-server.bat b/scripts/rabbitmq-server.bat
index 193f1c8a..bd4120fa 100644
--- a/scripts/rabbitmq-server.bat
+++ b/scripts/rabbitmq-server.bat
@@ -107,6 +107,10 @@ if "!RABBITMQ_MNESIA_DIR!"=="" (
set RABBITMQ_MNESIA_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-mnesia
)
+if "!RABBITMQ_PLUGINS_EXPAND_DIR!"=="" (
+ set RABBITMQ_PLUGINS_EXPAND_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-plugins-expand
+)
+
set RABBITMQ_PLUGINS_DIR=!TDP0!..\plugins
set RABBITMQ_EBIN_ROOT=!TDP0!..\ebin
@@ -115,7 +119,7 @@ set RABBITMQ_EBIN_ROOT=!TDP0!..\ebin
-noinput -hidden ^
-s rabbit_plugin_activator ^
-rabbit plugins_dir \""!RABBITMQ_PLUGINS_DIR:\=/!"\" ^
--rabbit plugins_expand_dir \""!RABBITMQ_MNESIA_DIR:\=/!/plugins-scratch"\" ^
+-rabbit plugins_expand_dir \""!RABBITMQ_PLUGINS_EXPAND_DIR:\=/!"\" ^
-rabbit rabbit_ebin \""!RABBITMQ_EBIN_ROOT:\=/!"\" ^
-extra !STAR!
diff --git a/scripts/rabbitmq-service.bat b/scripts/rabbitmq-service.bat
index 51ef6ecc..ff25b146 100644
--- a/scripts/rabbitmq-service.bat
+++ b/scripts/rabbitmq-service.bat
@@ -140,6 +140,9 @@ if "!RABBITMQ_MNESIA_DIR!"=="" (
set RABBITMQ_MNESIA_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-mnesia
)
+if "!RABBITMQ_PLUGINS_EXPAND_DIR!"=="" (
+ set RABBITMQ_PLUGINS_EXPAND_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-plugins-expand
+)
if "!P1!" == "install" goto INSTALL_SERVICE
for %%i in (start stop disable enable list remove) do if "%%i" == "!P1!" goto MODIFY_SERVICE
@@ -185,7 +188,7 @@ set RABBITMQ_EBIN_ROOT=!TDP0!..\ebin
-noinput -hidden ^
-s rabbit_plugin_activator ^
-rabbit plugins_dir \""!RABBITMQ_PLUGINS_DIR:\=/!"\" ^
--rabbit plugins_expand_dir \""!RABBITMQ_MNESIA_DIR:\=/!/plugins-scratch"\" ^
+-rabbit plugins_expand_dir \""!RABBITMQ_PLUGINS_EXPAND_DIR:\=/!"\" ^
-rabbit rabbit_ebin \""!RABBITMQ_EBIN_ROOT:\=/!"\" ^
-extra !STAR!
diff --git a/src/rabbit_plugin_activator.erl b/src/rabbit_plugin_activator.erl
index 88300ab4..ef81ddf2 100644
--- a/src/rabbit_plugin_activator.erl
+++ b/src/rabbit_plugin_activator.erl
@@ -33,8 +33,6 @@
-export([start/0, stop/0]).
--define(DefaultPluginDir, "plugins").
--define(DefaultUnpackedPluginDir, "priv/plugins").
-define(BaseApps, [rabbit]).
%%----------------------------------------------------------------------------
@@ -56,8 +54,8 @@ start() ->
application:load(rabbit),
%% Determine our various directories
- PluginDir = get_env(plugins_dir, ?DefaultPluginDir),
- UnpackedPluginDir = get_env(plugins_expand_dir, ?DefaultUnpackedPluginDir),
+ {ok, PluginDir} = application:get_env(rabbit, plugins_dir),
+ {ok, UnpackedPluginDir} = application:get_env(rabbit, plugins_expand_dir),
RootName = UnpackedPluginDir ++ "/rabbit",
@@ -142,12 +140,6 @@ start() ->
stop() ->
ok.
-get_env(Key, Default) ->
- case application:get_env(rabbit, Key) of
- {ok, V} -> V;
- _ -> Default
- end.
-
determine_version(App) ->
application:load(App),
{ok, Vsn} = application:get_key(App, vsn),
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 9a33b57d..f88e49c2 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -229,7 +229,6 @@
len,
persistent_count,
- duration_target,
target_ram_msg_count,
ram_msg_count,
ram_msg_count_prev,
@@ -317,7 +316,6 @@
persistent_count :: non_neg_integer(),
transient_threshold :: non_neg_integer(),
- duration_target :: number() | 'infinity',
target_ram_msg_count :: non_neg_integer() | 'infinity',
ram_msg_count :: non_neg_integer(),
ram_msg_count_prev :: non_neg_integer(),
@@ -689,8 +687,7 @@ set_ram_duration_target(DurationTarget,
infinity -> infinity;
_ -> trunc(DurationTarget * Rate) %% msgs = sec * msgs/sec
end,
- State1 = State #vqstate { target_ram_msg_count = TargetRamMsgCount1,
- duration_target = DurationTarget },
+ State1 = State #vqstate { target_ram_msg_count = TargetRamMsgCount1 },
a(case TargetRamMsgCount1 == infinity orelse
(TargetRamMsgCount =/= infinity andalso
TargetRamMsgCount1 >= TargetRamMsgCount) of
@@ -705,7 +702,6 @@ ram_duration(State = #vqstate {
in_counter = InCount,
out_counter = OutCount,
ram_msg_count = RamMsgCount,
- duration_target = DurationTarget,
ram_msg_count_prev = RamMsgCountPrev }) ->
Now = now(),
{AvgEgressRate, Egress1} = update_rate(Now, Timestamp, OutCount, Egress),
@@ -718,18 +714,16 @@ ram_duration(State = #vqstate {
(2 * (AvgEgressRate + AvgIngressRate))
end,
- {Duration, set_ram_duration_target(
- DurationTarget,
- State #vqstate {
- rates = Rates #rates {
- egress = Egress1,
- ingress = Ingress1,
- avg_egress = AvgEgressRate,
- avg_ingress = AvgIngressRate,
- timestamp = Now },
- in_counter = 0,
- out_counter = 0,
- ram_msg_count_prev = RamMsgCount })}.
+ {Duration, State #vqstate {
+ rates = Rates #rates {
+ egress = Egress1,
+ ingress = Ingress1,
+ avg_egress = AvgEgressRate,
+ avg_ingress = AvgIngressRate,
+ timestamp = Now },
+ in_counter = 0,
+ out_counter = 0,
+ ram_msg_count_prev = RamMsgCount }}.
needs_idle_timeout(State = #vqstate { on_sync = ?BLANK_SYNC }) ->
{Res, _State} = reduce_memory_use(fun (_Quota, State1) -> State1 end,
@@ -977,7 +971,6 @@ init(IsDurable, IndexState, DeltaCount, Terms,
len = DeltaCount1,
persistent_count = DeltaCount1,
- duration_target = infinity,
target_ram_msg_count = infinity,
ram_msg_count = 0,
ram_msg_count_prev = 0,