Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  Why mnesia:move_table_copy is not working ?

vsp
Posted: Fri Jun 04, 2010 2:16 pm Reply with quote
User Joined: 03 Mar 2010 Posts: 14
Have a RAM only table
on nodeX
table_info(pos,all)

----------------


Code:


result=[{access_mode,read_write},
        {active_replicas,['nodeX@host1']},
        {arity,54},
        {attributes,
            [... fields .....]},
        {checkpoints,[]},
        {commit_work,[]},
        {cookie,
            {{1275,612421,604288},'nodeX@host1'}},
        {cstruct,
            {cstruct,pos,set,
                ['nodeX@host1'],
                [],[],0,read_write,[],[],false,pos,
                [... fields ....],
                [],[],
                {{1275,612421,604288},
                 'nodeX@host1'},
                {{2,0},[]}}},
        {disc_copies,[]},
        {disc_only_copies,[]},
        {frag_properties,[]},
        {index,[]},
        {load_by_force,false},
        {load_node,'nodeX@host1'},
        {load_order,0},
        {load_reason,{dumper,create_table}},
        {local_content,false},
        {master_nodes,[]},
        {memory,6524080},
        {ram_copies,['nodeX@host1']},
        {record_name,pos},
        {record_validation,{pos,54,set}},
        {type,set},
        {size,15266},
        {snmp,[]},
        {storage_type,ram_copies},
        {subscribers,[]},
        {user_properties,[]},
        {version,{{2,0},[]}},
        {where_to_commit,
            [{'nodeX@host1',ram_copies}]},
        {where_to_read,'nodeX@host1'},
        {where_to_write,['nodeX@host1']},
        {wild_pattern,
            {pos,'_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
                '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
                '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
                '_','_','_','_','_','_','_','_'}}]







I want to move the content of that table to another node that has the same table with 0 rows.

I tried with 'backup restore' but -- this is RAM only so backup did not capture it.

When I try the move_table_copy command I get

Code:



mnesia:move_table_copy(pos,'nodeX@host1',node()).


mnesia:move_table_copy(pos,'nodeX@host1',node()).
{aborted,{already_exists,pos,
                         'nodeY@host2}}






on the other hand if I first drop the table,
and then try to do the same command, I get
'pos' does not exist.



So how does this work? How can I move ram tables around ?

Also how can I take backups of those tables and 'recreate them' completely in another node

I typically first convert a backup from one node to another and then do restore, but since ram copies do not get backed up who do they get moved to another node?


thank you in advance
View user's profile Send private message
spawn.think
Posted: Thu Jul 29, 2010 1:25 pm Reply with quote
User Joined: 29 Sep 2009 Posts: 21
You can delete the empty table on nodeY
nodeY@host2 > mnesia:delete_table(pos).

Then from nodeX, use add_table_copy/3 to add a copy (replica) to any node you want
http://www.erlang.org/doc/man/mnesia.html#add_table_copy-3

nodeX@host1 > mnesia:add_table_copy(pos, 'nodeY@host2', ram_copies).
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum