[erlang-questions] Mnesia create tables best practices

e@REDACTED e@REDACTED
Sun Feb 8 17:21:10 CET 2015


> Provide a pre-initialized database with your release. Don't attempt
> "figuring out" if there is no database and then create it on demand. It
> just leads to misery.

can't help giving you my thanks. lots of thanks.


> Your system proper only operates if there is a database. The End. When the
> release initially boots, there is a complete database, with a complete
> schema, ready to run, so the nodes can start working immediately. Some
> times, you will me using a method, where there is a file named
> FALLBACK.BUP. This is a "fallback" file, which will "restore" the database
> once the system is booted. This is also how `mnesia:create_schema/2` works,
> incidentally :P
>
> The beauty of this way is that your system is always in a state where it is
> "catching up" from a known good state. And you don't have to handle the
> special case of "initializing", which is completely perpendicular to your
> normal operation.
>
> Unfortunately, creation of Mnesia databases is not an idempotent operation.



More information about the erlang-questions mailing list