Lost Mnesia Fragments

Evans, Matthew <>
Fri Jun 12 02:15:19 CEST 2009


Hello,

I sent this to Erlang bugs, not sure if that was appropriate.

I have a somewhat unusual issue with fragmented Mnesia tables. 

I have a mesh of 6 nodes, and have created 24 fragments over those nodes using the command: 

mnesia:create_table(index_data, [{frag_properties,[{node_pool, NodeList},{n_fragments,24},{n_disc_copies,0}, {n_disc_only_copies,0}]},{index,[type]},{attributes, record_info(fields, index_data)},{type, bag}]).

As part of a test protocol I wanted to test what happens if I kill a node. To do this I physically unplug the node.
What I see is that when I do a mnesia:info() is the fragments that were on that node are in this state:

[] = [index_data_frag21,index_data_frag15,index_data_frag9,index_data_frag3]

Of course, I can not read data from those fragments.

However I can not seem to delete those fragments either.

Worse still, when I try to insert a record the hashing function attempts to pick up one of those “lost” fragments and the insert aborts with error:

{aborted,{no_exists,index_data_frag11}}

This insert is dirty, using the code:

    AddFun = fun() -> mnesia:write(index_data, #index_data{asset = Asset, npt = Npt, type = Type, inpoint = Inpoint, data = Data}, write) end,
    mnesia:activity(async_dirty, AddFun, [], mnesia_frag).

Am I missing something?

I there was a way to remove the "bad" fragment, I could catch the error and remove it by hand.

Thanks

Matt


More information about the erlang-questions mailing list