[erlang-questions] backing up mnesia ram_copies tables
Dan Gudmundsson
dangud@REDACTED
Thu Dec 13 13:10:33 CET 2012
It is the way it is intended.
If you create your own checkpoint you can specify what you want to be
included in the backup.
/Dan
On Thu, Dec 13, 2012 at 12:36 PM, Philip Clarke <send2philip@REDACTED>wrote:
> Hi,
>
> Should it be possible to make a backup of tables in mnesia if you just
> have ram_copies ?
>
> The documentation at http://www.erlang.org/doc/man/mnesia.html#backup-1 does
> not seem to imply that there is any such limitation.
>
> However when I examine the backup file created from mnesia:backup/1 it
> does not seem to have any table data.
>
> I use this simple test to check the backup. It will fail
> with {aborted,{no_exists,bup_rec,all}}.
>
>
> -record(bup_rec, {key, val}).
>
> test_cannot_restore_backup() ->
> Node = node(),
> mnesia:lkill(),
> ok = mnesia:delete_schema([Node]),
> mnesia:start(),
> mnesia:wait_for_tables([schema], infinity),
>
> OldBup = "old.BUP",
> file:delete(OldBup),
>
> CreateList = [{ram_copies, [Node]},
> {attributes, record_info(fields, bup_rec)}],
> {atomic, ok} = mnesia:create_table(bup_rec, CreateList),
> mnesia:wait_for_tables([bup_rec], infinity),
> OldRecs = [#bup_rec{key = I, val = I * I} || I <- lists:seq(1, 10)],
> lists:foreach(fun(R) -> ok = mnesia:dirty_write(R) end, OldRecs),
>
> mnesia:backup(OldBup),
>
> mnesia:stop(),
> ok = mnesia:delete_schema([Node]),
> mnesia:start(),
> mnesia:wait_for_tables([schema], infinity),
>
> mnesia:restore(OldBup, [{default_op, recreate_tables}]),
> ok = mnesia:table_info(bup_rec, all).
>
>
> I would like to know if I am doing the backup wrong, or if this is
> something which is not supported.
>
> Thanks
> Philip
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121213/f96aa13d/attachment.htm>
More information about the erlang-questions
mailing list