[erlang-questions] how to remove failed node from mnesia schema ?

karol skocik <>
Wed May 25 20:58:22 CEST 2011

  this should be solvable, but I can't google anything.
The situation, in distributed mnesia:

1.) node A starts
2.) node B starts, creates table T, ram_copy, only on node B. (schema
table now contains T)
3.) node B crashes
4.) node B is started again, and wants to either:
   a.) create fresh table B, if no other node C already has ram_copy of T
   b.) add_table_copy, if some node C has ram_copy of T

but, the situation is somehow, not intuitive.
When I check schema with ets:i(schema) or mnesia:table_info, I see
table T there.

> mnesia:table_info(T, all).

But I can't really do anything with it!

Delete table fails (on both A and B):
> mnesia:delete_table(T).

I can't do del_table_copy (on B, where was T originally created before
it crashed):
> mnesia:del_table_copy(T, node()).

Additionally, I can't "recreate" the table again (silly, I know):
()20> Nodes = [node()].
()21> Def = [{type, ordered_set},
()21>        {ram_copies, Nodes},
()21>        {record_name, tq_entry},
()21>        {attributes, record_info(fields, tq_entry)}].
()22> mnesia:create_table(T, Def).

Now, modifying schema table directly fails:
> mnesia:transaction(fun () -> mnesia:delete({schema, T}) end).

So, what should I do to remove crashed node from schema?
Thanks for any ideas!

More information about the erlang-questions mailing list