i have the following code:
J = fun()->mnesia:clear_table(names) end.
mnesia:activity(transaction, J, [], mnesia_frag).
and i get this error:
** exception exit: {aborted,{aborted,nested_transaction}}
i could just run
mnesia:clear_table(names)
but since table name is fragmented over several nodes i thought i have to use mnesia_frag module.
what am i doing wrong ? and how would it be correct?
Thank you.
you are correct that mnesia:clear_table(names) will not clear the entire fragmented table.
mnesia:clear_table/1 already runs inside a transaction, so you can not use it with the mnesia:activity transaction AccessContext.
instead try:
if you look at the source code in mnesia_frag.erl, you’ll see that it’s just calling mnesia:clear_table/1 on each individual table. Assuming 4 frags, the above is basically equivalent to:
the table names coming from: