[erlang-questions] Mnesia and file system snapshot

Paul Mineiro paul-trapexit@REDACTED
Mon Jul 13 18:57:13 CEST 2009


Wde,

I have two answers.

The first is that you should consider using Mnesia's built-in backup
feature, and using other methods should be considered a "bad idea".
It is really quite flexible and I recommend it highly.

The second answer presumes you have considered and rejected the built-in
backup procedure for some very good reason.  In that case, grabbing a file
system snapshot and then restoring it should be similar to asking Mnesia
to recover from an emulator crash.  I think this should mostly work.

  * disc_copies tables are periodically persisted to disk, and incremental
changes are written to the write ahead log, so they should restore ok.
dirty operations also use the logging system so even those should work.

  * ram_copies are not persisted normally, but you can ask mnesia to do so
on a one-time basis explicitly via mnesia:dump_tables/1.

  * disc_only_copies are dets based, and dets makes a pretty good effort
of durably persisting changes to disk when mnesia asks the storage layer
to do so.  You will have to suffer a dets table repair on startup after
restoring your backup which can be time consuming.

If you happen to use tcerl, you will run into trouble
(http://code.google.com/p/tcerl/wiki/Durability)

Cheers,

-- p


On Mon, 13 Jul 2009, wde wrote:

> Hello,
>
> I would like to "backup" the mnesia directory by using a file system snapshot (like zfs snapshot for example). Before to take the snapshot I must be sure that mnesia files are in consistent state. Does the mnesia checkpoint maintain  files (LOG, DAT,DCD,DCL ) in a consistent state (doc refers to tables state but not files) ?
>
>
> Otherwise I can always snaphot a backup file .
>
>
> Any feedback mnesia+file system snapshot would be appreciated.
>
>
> Thank you,
>
>
> wde
>
>
>
>
>
>
>
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>



More information about the erlang-questions mailing list