[erlang-questions] Mnesia create tables best practices
Jesper Louis Andersen
Sun Feb 8 16:47:38 CET 2015
On Sat, Feb 7, 2015 at 7:45 PM, Roberto Ostinelli <roberto@REDACTED>
> Dear list,
> What best practice do you have when you have a release and want to insure
> a node has a properly initialised mnesia scheme?
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.
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,
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
Unfortunately, creation of Mnesia databases is not an idempotent operation.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions