[erlang-questions] Adding new disc_copies node to existing schema

Dmitriy Gorbenko bazil@REDACTED
Tue Sep 25 21:13:07 CEST 2007


Hi all.

I need an advice: I have two nodes (node1@REDACTED and node2@REDACTED). The
are in the same schema.
And I want to add a new node node3@REDACTED to existing schema.

Next code is helpless, because it creates ram_copies node in schema:

mnesia:change_config(extra_db_nodes, [node3@REDACTED]).
mnesia:add_table_copy(tt, node3@REDACTED, ram_copies).

but I need create a disc_copies node.

If I create a backup and change node name - this is also not helping me:


(node1@REDACTED)6> mnesia:backup("./backup").
ok
(node1@REDACTED)7> c(a).
{ok,a}
(node1@REDACTED)8> a:change_node_name(node1@REDACTED, node3@REDACTED, "./backup",
"./new_backup").

 * Checking table: 'schema'
   + Checking key: 'disc_copies'
     - Replacing nodename: ''node1@REDACTED'' with: ''node3@REDACTED''
     - Node: ''node2@REDACTED'' will not be modified (it is not
''node1@REDACTED'')
   + Checking key: 'disc_only_copies'

 * Checking table: 'tt'
   + Checking key: 'disc_copies'
     - Replacing nodename: ''node1@REDACTED'' with: ''node3@REDACTED''
     - Node: ''node2@REDACTED'' will not be modified (it is not
''node1@REDACTED'')
   + Checking key: 'disc_only_copies'
{ok,switched}
(node1@REDACTED)9>


Then I copied this backup to node3@REDACTED, and trying to restore one:

(node3@REDACTED)2> mnesia:start().
ok
(node3@REDACTED)4> mnesia:restore("./new_backup", [{default_op,
recreate_tables}]).
{aborted,{'EXIT',{aborted,{bad_commit,{missing_lock,'node2@REDACTED'}}}}}
(node3@REDACTED)5> 


I think it's impossible to create another disc_copies node in existing
schema. Only ram_copies.
Or, I could be possible, if I could remove at node1 from schema node2,
then create backup, and then collect all nodes into one schema. But I
did not find how I could remove node from schema. Like:

mnesia:remove_node_from_schema(node3@REDACTED).

If anyone knows how to solve the problem - please, help me.

Dmitriy.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2244 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070925/7a87d976/attachment.bin>


More information about the erlang-questions mailing list