From c65821b677b4ebbc05192da9b8a48d32e53b3cfe Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 19 Feb 2014 17:24:27 +0100 Subject: Add documentation about upgrade The example of how to create a first target system, which is located in the System Principles document, is now extended to also include an example of code upgrade. A new chapter is added to System Principles explaining different issues when upgrade includes new versions applications within Erlang/OTP. --- system/doc/system_principles/upgrade.xml | 118 +++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 system/doc/system_principles/upgrade.xml (limited to 'system/doc/system_principles/upgrade.xml') diff --git a/system/doc/system_principles/upgrade.xml b/system/doc/system_principles/upgrade.xml new file mode 100644 index 0000000000..68e48da0b8 --- /dev/null +++ b/system/doc/system_principles/upgrade.xml @@ -0,0 +1,118 @@ + + + + +
+ + 2014 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Upgrade when Erlang/OTP has Changed + + + + + + 2014-02-19 + + upgrade.xml +
+ +
+ Introduction +

+ As of Erlang/OTP 17, most applications deliver a valid + application upgrade (appup) file. In earlier releases, a + majority of the applications in Erlang/OTP did not support + upgrade at all. Many of the applications use the + restart_application instruction. These are applications + for which it is not crucial to support real soft upgrade, for + instance tools and library applications. The + restart_application instruction + ensures that all modules in the application are reloaded and + thereby running the new code. +

+
+ +
+ Upgrade of core applications +

+ The core applications ERTS, Kernel, STDLIB + and SASL never allow real soft upgrade, but require the + Erlang emulator to be restarted. This is indicated to the + release_handler by the upgrade instruction + restart_new_emulator. This instruction will always be the + very first instruction executed, and it will restart the + emulator with the new versions of the above mentioned core + applications and the old versions of all other + applications. When the node is back up all other upgrade instructions are + executed, making sure each application is finally running its + new version. +

+ +

+ It might seem strange to do a two-step upgrade instead of + just restarting the emulator with the new version of all + applications. The reason for this design decision is to allow + code_change functions to have side effects, for example changing + data on disk. It also makes sure that the upgrade mechanism for + non-core applications does not differ depending on whether or not + core applications are changed at the same time. +

+ +

+ If, however, the more brutal variant is preferred, it is + possible to handwrite the release upgrade file using only the + single upgrade instruction restart_emulator. This + instruction, in contrast to restart_new_emulator, will + cause the emulator to restart with the new versions of + all applications. +

+ +

+ Note that if other instructions are included before + restart_emulator in the handwritten relup file, + they will be executed in the old emulator. This is a big risk + since there is no guarantee that new beam code can be loaded + into the old emulator. Adding instructions after + restart_emulator has no effect as the + release_handler will not do any attempt at executing + them. +

+ +

+ See relup(4) for + information about the release upgrade file, and appup(4) for further information + about upgrade instructions. +

+
+ +
+ Applications that still do not allow code upgrade +

+ A few applications, for instance HiPE do not support + upgrade at all. This is indicated by an application upgrade file + containing only {Vsn,[],[]}. Any attempt at creating a release + upgrade file with such input will fail. + The only way to force an upgrade involving applications like this is to + handwrite the relup file, preferably as described above + with only the restart_emulator instruction. +

+ +
+
-- cgit v1.2.3