diff options
Diffstat (limited to 'system/doc/design_principles/release_handling.xml')
-rw-r--r-- | system/doc/design_principles/release_handling.xml | 76 |
1 files changed, 57 insertions, 19 deletions
diff --git a/system/doc/design_principles/release_handling.xml b/system/doc/design_principles/release_handling.xml index 1d62c242c0..4378b6599c 100644 --- a/system/doc/design_principles/release_handling.xml +++ b/system/doc/design_principles/release_handling.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2003</year><year>2009</year> + <year>2003</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -178,13 +178,13 @@ <marker id="instr"></marker> <title>Release Handling Instructions</title> <p>OTP supports a set of <em>release handling instructions</em> - that is used when creating <c>.appup</c> files. The release + that are used when creating <c>.appup</c> files. The release handler understands a subset of these, the <em>low-level</em> instructions. To make it easier for the user, there are also a number of <em>high-level</em> instructions, which are translated to low-level instructions by <c>systools:make_relup</c>.</p> <p>Here, some of the most frequently used instructions are - described. The complete list of instructions is found in + described. The complete list of instructions can be found in <c>appup(4)</c>.</p> <p>First, some definitions:</p> <taglist> @@ -239,9 +239,10 @@ <p><c>update</c> with argument <c>supervisor</c> is used when changing the start specification of a supervisor. See <seealso marker="appup_cookbook#sup">Appup Cookbook</seealso>.</p> - <p>The release handler finds the processes <em>using</em> a module - to update by traversing the supervision tree of each running - application and checking all the child specifications:</p> + <p>When a module is to be updated, the release handler finds + which processes that are <em>using</em> the module by + traversing the supervision tree of each running application + and checking all the child specifications:</p> <code type="none"> {Id, StartFunc, Restart, Shutdown, Type, Modules}</code> <p>A process is using a module if the name is listed in @@ -265,8 +266,8 @@ <p>The instruction loads the module and is absolutely necessary when running Erlang in embedded mode. It is not strictly required when running Erlang in interactive (default) mode, - since the code server automatically searches for and loads - unloaded modules.</p> + since the code server then automatically searches for and + loads unloaded modules.</p> <p>The opposite of <c>add_module</c> is <c>delete_module</c> which unloads a module:</p> <code type="none"> @@ -294,7 +295,7 @@ the modules are unloaded using a number of <c>delete_module</c> instructions and then the application specification is unloaded from the application controller.</p> - <p>Instruction for removing an application:</p> + <p>Instruction for restarting an application:</p> <code type="none"> {restart_application, Application}</code> <p>Restarting an application means that the application is stopped @@ -313,18 +314,35 @@ </section> <section> + <marker id="restart_new_emulator_instr"></marker> <title>restart_new_emulator (low-level)</title> <p>This instruction is used when changing to a new emulator - version, or if a system reboot is needed for some other reason. - Requires that the system is started with heart beat + version, or when any of the core applications kernel, stdlib + or sasl is upgraded. If a system reboot is needed for some + other reason, the <c>restart_emulator</c> instruction should + be used instead.</p> + <p>Requires that the system is started with heart beat monitoring, see <c>erl(1)</c> and <c>heart(3)</c>.</p> - <p>When the release handler encounters the instruction, it shuts - down the current emulator by calling <c>init:reboot()</c>, see + <p>The <c>restart_new_emulator</c> instruction shall always be + the very first instruction in a relup. If the relup is + generated by <c>systools:make_relup/3,4</c> this is + automatically ensured.</p> + <p>When the release handler encounters the instruction, it first + generates a temporary boot file, which starts the new versions + of the emulator and the core applications. Then it shuts down + the current emulator by calling <c>init:reboot()</c>, see <c>init(3)</c>. All processes are terminated gracefully and - the system can then be rebooted by the heart program, using - the new release version. This new version must still be made - permanent when the new emulator is up and running. Otherwise, - the old version is used in case of a new system reboot.</p> + the system is rebooted by the heart program, using the + temporary boot file. After the reboot, the rest of the relup + instructions are executed. This is done as a part of the + temporary boot script.</p> + <p>An info report is written when the upgrade is completed. To + programatically find out if the upgrade is complete, + call <c>release_handler:which_releases(current)</c> and check + if it returns the expected (i.e. the new) release.</p> + <p>The new release version must be made permanent when the new + emulator is up and running. Otherwise, the old version will be + used in case of a new system reboot.</p> <p>On UNIX, the release handler tells the heart program which command to use to reboot the system. Note that the environment variable <c>HEART_COMMAND</c>, normally used by the heart @@ -333,6 +351,25 @@ by using the SASL configuration parameter <c>start_prg</c>, see <c>sasl(6)</c>.</p> </section> + + <section> + <marker id="restart_emulator_instr"></marker> + <title>restart_emulator (low-level)</title> + <p>This instruction is not related to upgrades of erts or any of + the core applications. It can be used by any application to + force a restart of the emulator after all upgrade instructions + are executed.</p> + <p>There can only be one <c>restart_emulator</c> instruction in + a relup script, and it shall always be placed at the end. If + the relup is generated by <c>systools:make_relup/3,4</c> this + is automatically ensured.</p> + <p>When the release handler encounters the instruction, it shuts + down the emulator by calling <c>init:reboot()</c>, see + <c>init(3)</c>. All processes are terminated gracefully and + the system can then be rebooted by the heart program using the + new release version. No more upgrade instruction will be + executed after the restart.</p> + </section> </section> <section> @@ -545,8 +582,8 @@ release_handler:remove_release(Vsn) => ok</code> [].</code> <p>2) Start the system as a simple target system. Note that in reality, it should be started as an embedded system. However, - using <c>erl</c> with the correct boot script and <c>.config</c> - file is enough for illustration purposes:</p> + using <c>erl</c> with the correct boot script and config file is + enough for illustration purposes:</p> <pre> % <input>cd $ROOT</input> % <input>bin/erl -boot $ROOT/releases/A/start -config $ROOT/releases/A/sys</input> @@ -581,6 +618,7 @@ lib/ch_app-2/ebin/ch3.beam releases/B/start.boot releases/B/relup releases/B/sys.config +releases/B/ch_rel-2.rel releases/ch_rel-2.rel</code> <p>4) Copy the release package <c>ch_rel-2.tar.gz</c> to the <c>$ROOT/releases</c> directory.</p> |