[erlang-questions] Should I use wait_for_tables/2 right after creating tables?

Sergey Samokhin <>
Sun Mar 8 18:47:17 CET 2009


Hello.

I often find myself using mnesia:wait_for_tables/2 to ensure that all newly
created tables are ready to use:

create_tables() ->
    % At this point mnesia is already started
    mnesia:create_table(foo,   [{attributes, record_info(fields, foo)}]),
    mnesia:create_table(bar,   [{attributes, record_info(fields, bar)}]),
    mnesia:wait_for_tables([foo, bar], 20000).

Is it necessary to wait here?

I started doubting this habbit after I had read that "all schema
manipulation functions are implemented with normal transaction management
system" in mnesia man. As I know, any function involving standard
transaction mechanism returns when all things are completely done, so
wait_for_tables can be (can it be?) safety removed here.

-- 
Sergey Samokhin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090308/6c3b5055/attachment.html>


More information about the erlang-questions mailing list