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.