Howdy all, it’s been a while!
Has anyone managed to use Mnesia fragmented tables with external storage tables? I’m currently using OTP 29.1.1 (erts-17.1, according to erlang:system_info(system_version).
I was playing around with mnesia_eleveldb and created a table using leveldb_copies as the storage type. I can read from and write to this table so it all appears to be correct.
I can turn on fragmentation for the table using the usual mnesia:change_table_frag(mytable, {activate, []}) method and this doesn’t throw up any immediate issues. I can continue to write new records to and read new and existing records from a single-fragment “fragmented” leveldb_copies table.
But when I attempt to add a fragment with the expected mnesia:change_table_frag(mytable, {add_frag, [node()]}) command on this table I am hit with a function_clause error from within the depths of mnesia_schema:
** exception error: no match of right hand side value {aborted,
{function_clause,
[{mnesia_schema,'-verify_nodes/1-inlined-1-',
[nonode@nohost],
[{file,"mnesia_schema.erl"},{line,1250}]},
{lists,foreach_1,2,[{file,"lists.erl"},{line,2641}]},
{mnesia_schema,verify_nodes,1,
[{file,"mnesia_schema.erl"},{line,1249}]},
{mnesia_schema,assert_correct_cstruct,1,
[{file,"mnesia_schema.erl"},{line,1107}]},
{mnesia_schema,verify_cstruct,1,
[{file,"mnesia_schema.erl"},{line,1023}]},
{mnesia_schema,unsafe_make_create_table,1,
[{file,"mnesia_schema.erl"},{line,1561}]},
{mnesia_frag,make_add_frag,2,
[{file,"mnesia_frag.erl"},{line,873}]},
{mnesia_frag,make_multi_add_frag,2,
[{file,"mnesia_frag.erl"},{line,820}]}]}}
Changing the storage type of the table to ram_copies or disc_copies instead of leveldb_copies lets the above commands work, and I’m able to create however many fragments I like, as usual. As far as I can tell from looking at the mnesia_frag.erl and mnesia_schema.erl files it seems that external storage tables are supposed to be supported, so maybe I’m not setting the add_frag options correctly for this table storage type?
Thanks,
Phil