aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/src/systools_rc.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2011-10-13 11:53:51 +0200
committerSiri Hansen <[email protected]>2011-11-17 16:47:28 +0100
commitbe04ed7beceeb4bcf5db7807e86df87e28c9f4b9 (patch)
tree3c5feabbfb50156cfc6e8025d9c20dd786fb9cd0 /lib/sasl/src/systools_rc.erl
parent1dec251ad333045847b75b8ee75d4bff4237108e (diff)
downloadotp-be04ed7beceeb4bcf5db7807e86df87e28c9f4b9.tar.gz
otp-be04ed7beceeb4bcf5db7807e86df87e28c9f4b9.tar.bz2
otp-be04ed7beceeb4bcf5db7807e86df87e28c9f4b9.zip
Distinguish restart_new_emulator from restart_emulator in upgrade instructions
Earlier, there was only one valid instruction to restart the emulator in an appup/relup script, 'restart_new_emulator'. A new instuction, 'restart_emulator', is now added, and the meaning is as follows: 'restart_new_emulator' is mainly for the core applications (erts, kernel, stdlib and sasl), and it indicates that there is new core functionality in the release and the emulator needs to be restarted before executing the upgrade scripts. If this instruction exists, a temporary release will be created which consists of the new version erts, kernel, stdlib and sasl, and the old versions of all other applications. After restarting the emulator with this temporary release, the rest of the upgrade instructions are executed, including loading of new versions. 'restart_emulator' can be used by any application if a restart of the emulator is needed after the upgrade instructions have been executed. In this case, the emulator will be restarted with the new release (i.e. not a tempoarary one) after all other upgrade instructions for all applications have been excecuted.
Diffstat (limited to 'lib/sasl/src/systools_rc.erl')
-rw-r--r--lib/sasl/src/systools_rc.erl45
1 files changed, 30 insertions, 15 deletions
diff --git a/lib/sasl/src/systools_rc.erl b/lib/sasl/src/systools_rc.erl
index 6f01901fbc..c16f6aa845 100644
--- a/lib/sasl/src/systools_rc.erl
+++ b/lib/sasl/src/systools_rc.erl
@@ -54,6 +54,7 @@
%% {sync_nodes, Id, Nodes}
%% {apply, {M, F, A}}
%% restart_new_emulator
+%% restart_emulator
%%-----------------------------------------------------------------
%% High-level instructions that contain dependencies
@@ -145,7 +146,7 @@ translate_merged_script(Mode, Script, Appls, PreAppls) ->
Appls),
Before3 = merge_load_object_code(Before2),
- {Before4,After4} = sort_restart_new_emulator(Mode,Before3,After2),
+ {Before4,After4} = sort_emulator_restart(Mode,Before3,After2),
NewScript = Before4 ++ [point_of_no_return | After4],
check_syntax(NewScript),
@@ -702,23 +703,37 @@ mlo([{load_object_code, {Lib, LibVsn, Mods}} | T]) ->
mlo([]) -> [].
%%-----------------------------------------------------------------
-%% RESTART DIFF EMULATOR
+%% RESTART EMULATOR
%% -----------------------------------------------------------------
%% -----------------------------------------------------------------
-%% Check if a diff_vsn_restart_new_emulator instruction exists (i.e. if the
-%% emulator version is changed). If so, this must be done first for
-%% upgrade and last for downgrade.
+%% Check if there are any 'restart_new_emulator' instructions (i.e. if
+%% the emulator or core application version is changed). If so, this
+%% must be done first for upgrade and last for downgrade.
+%% Check if there are any 'restart_emulator' instructions, if so
+%% remove all and place one the end.
%% -----------------------------------------------------------------
-sort_restart_new_emulator(Mode,Before,After) ->
- case lists:delete(diff_vsn_restart_new_emulator,After) of
- After ->
- {Before,After};
- NewAfter when Mode==up ->
- {[restart_new_emulator|Before],NewAfter};
- NewAfter when Mode==dn ->
- {Before,NewAfter++[restart_new_emulator]}
- end.
+sort_emulator_restart(Mode,Before,After) ->
+ {Before1,After1} =
+ case filter_out(restart_new_emulator, After) of
+ After ->
+ {Before,After};
+ A1 when Mode==up ->
+ {[restart_new_emulator|Before],A1};
+ A1 when Mode==dn ->
+ {Before,A1++[restart_emulator]}
+ end,
+ After2 =
+ case filter_out(restart_emulator, After1) of
+ After1 ->
+ After1;
+ A2 ->
+ A2++[restart_emulator]
+ end,
+ {Before1,After2}.
+
+filter_out(What,List) ->
+ lists:filter(fun(X) when X=:=What -> false; (_) -> true end, List).
%%-----------------------------------------------------------------
%% SYNTAX CHECK
@@ -839,7 +854,7 @@ check_op({apply, {M, F, A}}) ->
check_func(F),
check_args(A);
check_op(restart_new_emulator) -> ok;
-check_op(diff_vsn_restart_new_emulator) -> ok;
+check_op(restart_emulator) -> ok;
check_op(X) -> throw({error, {bad_instruction, X}}).
check_mod(Mod) when is_atom(Mod) -> ok;