[erlang-questions] mnesia node table copy shortcut?

Vinayak Pawar vinayakapawar@REDACTED
Thu Dec 31 05:44:52 CET 2009


Like this?

Node = % node to copy these tables
StorageType = fun(T) -> mnesia:table_info(T, storage_type) end,
Tabs = mnesia:system_info(local_tables) -- [schema],
[mnesia:add_table_copy(Tab, Node, StorageType(Tab)) || Tab <- Tabs].



On Thu, Dec 31, 2009 at 8:33 AM, Jan Koum <jan.koum@REDACTED> wrote:

> hi folks,
>
> is there a shortcut which would let me copy all the tables from one node to
> another node in a single command?  right now when i bring up a new node, i
> have to do:
>
> mnesia:add_table_copy(table1a, node(), ram_copies),
> mnesia:add_table_copy(table1b, node(), ram_copies),
> ...
> mnesia:add_table_copy(table2a, node(), disc_copies),
> mnesia:add_table_copy(table2b, node(), disc_copies),
> ....
> mnesia:add_table_copy(table3a, node(), disc_only_copies),
> mnesia:add_table_copy(table3b, node(), disc_only_copies).
>
> i came across this shortcut on the web while searching for answer, but it
> copies ALL tables into XYZ
>
> Tabs = mnesia:system_info(tables) -- [schema],
> [mnesia:add_table_copy(Tab,node(), XYZ) || Tab <- Tabs].
>
> is there a way to modify above command to copy all ram_copies table as
> ram_copies, disc_copies table as disc_copies, and disc_only_copies as
> disc_only_copies?  thanks and happy new years,
>
> -- yan
>


More information about the erlang-questions mailing list