[erlang-questions] mnesia:table_info(Table, size) returns 0 for remote tables

Ulf Wiger (TN/EAB) ulf.wiger@REDACTED
Thu Jun 5 09:57:12 CEST 2008


Serge Aleynikov wrote:
> I ran into this non-intuitive behavior of the mnesia:table_info(Table, 
> size) function.  Unlike other calls of the mnesia:table_info/2 family 
> this one returns 0 if a table is not local.
>
> The work around is to do:
> Node = mnesia:table_info(Table, where_to_read),
> rpc:call(Node, mnesia, table_info, [Table, size]).
>
> Though, it's not clear to me why the caller of mnesia:table_info/2 has 
> to go though this trouble.  Can this be fixed?
>
> Serge
>   

You can use the mnesia_frag callback:

Eshell V5.5.4  (abort with ^G)
(m1@REDACTED)1> mnesia:start().
ok
(m1@REDACTED)2> mnesia:create_table(t2,[{ram_copies,[m2@REDACTED]}]).
{atomic,ok}
(m1@REDACTED)3> mnesia:table_info(t2,size).
0
(m1@REDACTED)4> mnesia:activity(transaction,fun() -> 
mnesia:table_info(t2,size) end,mnesia_frag).
1
(m1@REDACTED)5>


BR,
Ulf W



More information about the erlang-questions mailing list