I have used mnesia for a while now. I have to confess that i feel like i do not exactly understand the concept of mnesia:wait_for_tables/2. Quoting the documentation here below says this:
Some applications need to wait for certain tables to be accessible in order to doNow, for all the applications i have developed, i have had to call this when starting my backend. In the documentation above, the context of
useful work. mnesia:wait_for_tables/2 hangs until all tables in the Tab List are
accessible, or until timeout is reached.
"Some applications"
was not expanded well and thats where my question is.
RAM (ram_copies)
tables, then i do not need this method in my code. Now, I'm i right to think that if i have only disc_only_copies
, i also do not need this function.disc_copies
as why would an application running entirely on Disc or entirely in RAM need to wait and load tables ?
questions:
Help and examine my thoughts 1, 2 and 3. In general is this function only needed when dealing with mnesia table type: disc_copies
since this type has something to do with data copy on disc and RAM ?
If my tables are all fragmented, (i have always called this method for each fragment to ensure mnesia makes it ready for my apps), do i have to call the method per fragment? is the method ATOMIC or Transactional if i call it within a mnesia transaction (meaning that mnesia will automatically load all the tables fragments if i specify the base table alone) ? does the table type of my fragments also matter concerning this function ?
When starting mnesia, mnesia just queues up all tables that should be loaded from disc or from the network.
mnesia:wait_for_tables/2 gives you a synchronization point so you don't have to poll if the table(s) are ready to be used.
If you don't use the disc and no replication, (i.e. the schema is always empty during start) you don't need to use wait_for_tables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With