[erlang-questions] mnesia backup oddity

Lukas Larsson lukas@REDACTED
Wed Feb 27 10:55:46 CET 2008


aha, the data was being modified while I was doing the backup. That
explains it. Thanks!

Lukas
Erlang Trainer & Consulting Ltd

On Wed, Feb 27, 2008 at 10:37 AM, Hakan Mattsson <hakan@REDACTED> wrote:
>
>  The Mnesia backup is performed in several phases:
>
>   - First a checkpoint is activated in order to keep
>     track of the database state as it was at that
>     timepoint.
>
>   - Then Mnesia performs a first iteratation over the
>     tables involved in the checkpoint and puts their
>     contents into the backup.
>
>   - After that Mnesia performs a second iteration over
>     the tables involved in the checkpoint in order to
>     compensate for updates performed during the backup.
>     During this phase more backup items (records and
>     delete marks) are added to the backup.
>
>   - At last the checkpoint is deactivated.
>
>  When iterating over a backup file you should interpret
>  the backup items in the file as operations (write and
>  delete), not as plain data. This means that when you
>  find the first occurrence of a record you should expect
>  a delete mark and/or yet another version of that the
>  record later in the backup file.
>
>  /Håkan
>
>  On Tue, 26 Feb 2008, Lukas Larsson wrote:
>
>  LL> I've been playing around with mnesia:backup and noticed an oddity with
>  LL> the data outputted by it. Let's say I have a table called myTable with
>  LL> three elements. The mnesia:backup dump should look something like
>  LL> this:
>  LL>
>  LL> [{schema,myTable,
>  LL>          [{name,myTable},
>  LL>           {type,ordered_set},
>  LL>           {ram_copies,[]},
>  LL>           {disc_copies,['nonode@REDACTED'']},
>  LL>           {disc_only_copies,[]},
>  LL>           {load_order,0},
>  LL>           {access_mode,read_write},
>  LL>           {index,[]},
>  LL>           {local_content,false},
>  LL>           {record_name,myTable},
>  LL>           {snmp,[{key,integer}]},
>  LL>           {attributes,[key,data,datatwo]},
>  LL>           {user_properties,[]},
>  LL>           {frag_properties,[]},
>  LL>           {cookie,{{1201,677139,173385},'nonode@REDACTED'}},
>  LL>           {version,{{2,0},[]}}]}].
>  LL> [{myTable,1,"mydata","mydata"},
>  LL>  {myTable,2,"mydata2","mydata2"}].
>  LL>
>  LL> This is what usually is outputted. Sometimes however I get the following:
>  LL>
>  LL> [{schema,myTable,
>  LL>          [{name,myTable},
>  LL>           {type,ordered_set},
>  LL>           {ram_copies,[]},
>  LL>           {disc_copies,['nonode@REDACTED'']},
>  LL>           {disc_only_copies,[]},
>  LL>           {load_order,0},
>  LL>           {access_mode,read_write},
>  LL>           {index,[]},
>  LL>           {local_content,false},
>  LL>           {record_name,myTable},
>  LL>           {snmp,[{key,integer}]},
>  LL>           {attributes,[key,data,datatwo]},
>  LL>           {user_properties,[]},
>  LL>           {frag_properties,[]},
>  LL>           {cookie,{{1201,677139,173385},'nonode@REDACTED'}},
>  LL>           {version,{{2,0},[]}}]}].
>  LL> [{myTable,1,"mydata","mydata"},
>  LL>  {myTable,2,"mydata2","mydata2"}].
>  LL> [{myTable,1},
>  LL>  {myTable,2,"mydata2","mydata2"}].
>  LL>
>  LL> The entry is duplicated and the first entry of the second list (I've
>  LL> only seen this happen with two entries in the table) is only the table
>  LL> name and the key. Does anyone have any idea about why I'm getting the
>  LL> extra list in the backup file? The strangest thing is that it only
>  LL> seems to be happening every once in a while, and not whenever I call
>  LL> mnesia:backup.
>  LL>
>  LL> Lukas
>  LL> Erlang Training & Consulting Ltd
>  LL> _______________________________________________
>  LL> erlang-questions mailing list
>  LL> erlang-questions@REDACTED
>  LL> http://www.erlang.org/mailman/listinfo/erlang-questions
>  LL>



More information about the erlang-questions mailing list