[erlang-questions] how to remove failed node from mnesia schema ?
karol skocik
karol.skocik@REDACTED
Wed May 25 20:58:22 CEST 2011
Hi,
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).
[{access_mode,read_write},
{active_replicas,[]},
{arity,3},
....]
But I can't really do anything with it!
Delete table fails (on both A and B):
> mnesia:delete_table(T).
{aborted,{no_exists,'waiting_task.type.2'}}
I can't do del_table_copy (on B, where was T originally created before
it crashed):
> mnesia:del_table_copy(T, node()).
{aborted,{no_exists,'waiting_task.type.2'}}
Additionally, I can't "recreate" the table again (silly, I know):
(slave@REDACTED)20> Nodes = [node()].
[slave@REDACTED]
(slave@REDACTED)21> Def = [{type, ordered_set},
(slave@REDACTED)21> {ram_copies, Nodes},
(slave@REDACTED)21> {record_name, tq_entry},
(slave@REDACTED)21> {attributes, record_info(fields, tq_entry)}].
(slave@REDACTED)22> mnesia:create_table(T, Def).
{aborted,{already_exists,'waiting_task.type.2'}}
Now, modifying schema table directly fails:
> mnesia:transaction(fun () -> mnesia:delete({schema, T}) end).
{aborted,{bad_type,schema}}
So, what should I do to remove crashed node from schema?
Thanks for any ideas!
Karol
More information about the erlang-questions
mailing list