Javier <inv...@invalid.invalid> writes:
> As Paul Rubin said, Erlang still maintains the possibility to update
> the code without rebooting, but I don't know its internals
> and how exactly it manages to update the code without rebooting.
There is no significant magic IIRC. It's like a Lisp system with late
binding, so various system functions are attached to symbols with known
names. Then it is just a matter of replacing the old bindings with new
ones. There are a few other steps, and you have to do them in exactly
the right order to not mess everything up horribly, but it is a well
documented and supported feature of Erlang.
Non-Erlang nonstop systems (e.g. phone switches) typically don't work
like that. Instead, since on any nonstop system (including Erlang
systems) there is always at least one backup processor so the system can
keep running in case of a hardware failure, you just stop the backup
processor, upgrade its software the traditional way, restart it, stop
the primary processor so that the now-upgraded backup processor takes
over, upgrade the primary, and then swap back over.
I once asked Erlang's inventor Joe Armstrong (RIP) whether it would have
been simpler to upgrade Erlang systems the same way. He basically said
that method would have worked fine. The in-place upgrade scheme must
have some benefits in some situations, but in reality it is not that
important. It is rather complicated to use, and you have to test your
upgrade very very thoroughly before you actually deploy it, since it is
easy for stuff to go wrong.
Erlang hot-patching works a lot better during development and debugging,
where you can interactively change stuff as you hack and test. I could
imagine making an emergency patch that way to a production
high-availability system that had hit some kind of unforeseen snag. But
normally, you would not manually patch a running system in the field.
You'd prepare a new release for it, test it offline, and deploy it in an
organized way.