[erlang-questions] Mnesia Backup/Fallback Problems With Schema

Gordon Guthrie <>
Fri Jun 8 12:52:33 CEST 2012


Ok

At another impasse...

I was backing up some tables (or so I thought) with
mnesia:backup_checkpoint/3 and passing in the table list.

Turns out the table list applies to the checkpoint and not the backup
which includes all tables...

So if I restore this backup I will restore all the tables from the
original site, not some of them...

Is it possible to selectively restore tables at all?

Gordon

On 8 June 2012 11:20, Gordon Guthrie <> wrote:
> Chandru
>
> Made some progress - if you back up with a schema you can install the
> fallback...
>
> BUT if you have crashed during a failed install_fallback from a
> schemaless backup mnesia thinks that a fallback is installed and borks
> out with this message
>
>     {error,{"Cannot install fallback",
>              {already_exists,''}}}
>
> So you need to run mnesia:uninstall_fallback/0 after all the failed
> attempt whilst you are writing your code :(
>
> Upwards and onwards...
>
> Gordon
>
> On 8 June 2012 10:41, Gordon Guthrie <> wrote:
>> Chandru
>>
>> I have built a code changer/backup traverser based on the same code.
>>
>> I am trying to get the full cycle to work backing up and restoring on
>> the same node first before I move to the two-node cycle.
>>
>> I can't restore a partial backup on the same node with
>> install_fallback at the moment.
>>
>> Gordon
>>
>> On 8 June 2012 10:33, Chandru <> wrote:
>>> Hi Gordon,
>>>
>>> The node name is in the schema. If you want to install_fallback on another
>>> node, you have to change the node name in the backup file. Attached is a
>>> module which might be of use to you. We use it quite a lot in our setup.
>>>
>>> The code here is based on an example in the Mnesia user guide.
>>>
>>> cheers
>>> Chandru
>>>
>>> On 8 June 2012 09:47, Gordon Guthrie <> wrote:
>>>>
>>>> Folks
>>>>
>>>> Having some problems with mnesia backups.
>>>>
>>>> I have servers running with lots of tables for lots of site, so we use
>>>> a naming convention for the tables to separate the data:
>>>> site_1_table_1, ..., site_1_table_n
>>>> ...
>>>> site_m_table_1, ..., site_m_table_n
>>>>
>>>> I want to be able to backup individual sites and restore them - maybe
>>>> on the original machine, maybe on another one.
>>>>
>>>> So I setup a checkpoint across a set of tables (site_1_table_1 to
>>>> site_1_table_n) and back it up.
>>>>
>>>> The tables can be quite big so mnesia:restore/2 isn't practical and I
>>>> have to use mnesia:install_fallback - this is where I hit problems.
>>>>
>>>> I get the error message:
>>>>
>>>>     {error,{"Cannot install fallback",
>>>>              {"Cannot lookup",schema}}}
>>>>
>>>> Ok, I figured it needs the schema to be backed up as well, so I then
>>>> build a checkpoint with the schema and the set of tables I want to
>>>> backup. But when I run that I get a different error:
>>>>
>>>>     {error,{"Cannot install fallback",
>>>>              {already_exists,''}}}
>>>>
>>>> So I am at a bit of a loss.
>>>>
>>>> Does install_fallback only work with whole table backups?
>>>>
>>>> Gordon
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> 
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>



More information about the erlang-questions mailing list