Mnesia fragmented tables: mnesia:dirty_next and mnesia:dirty_first
Evans, Matthew
mevans@REDACTED
Thu Jun 10 00:59:29 CEST 2010
Hi,
I have a fragmented database where I want to do an mnesia:dirty_first(Tab), and mnesia:dirty_next(Tab,Key).
These don't appear to be supported.
I have got around this by:
1) Using mnesia:table_info/2 to get the frag hash state.
2) Create a list of all my fragments (as atoms), in a specific order.
The above data is saved in a state record.
Then whenever I get a get_next I call mnesia_frag_hash:key_to_frag_number/2, and from the list of fragments I saved in 2, above, I can get the actual fragment to search in.
I can then call mnesia:dirty_next(Fragment,Key). If I get '$end_of_table' I can move to the next fragment in the list of fragments and so on until the list of fragments is exhausted.
Other than doing something similar with mnesia:dirty_slot/2 is there any other way to do a get_next traversal of a fragmented table?
Thanks
Matt
More information about the erlang-questions
mailing list