[erlang-questions] Mnesia startup synchronization

Håkan Mattsson hm@REDACTED
Thu Jan 27 13:12:18 CET 2011


On Thu, Jan 27, 2011 at 11:06 AM, Andre Nathan <andre@REDACTED> wrote:
> Hello
>
> In the "Erlang and OTP in Action" book, there's a section explaining
> Mnesia dynamic replication, where a node copies the tables from other
> cluster nodes (when there are any) or starts up on its own otherwise.
>
> In this section a race condition in this scheme is mentioned: two nodes
> starting up simultaneously may believe that the other one was the first,
> resulting in a deadlock where no initial schema is created.
>
> What would be a proper way to add synchronization to mnesia startup to
> ensure that a single node is always the first to run?

You should separate installation from normal startup. The installation is
just run once and startup should assume that the schema is created.

/Håkan


More information about the erlang-questions mailing list