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.
These are my thoughts:
1. Waiting in this method means that we are loading mnesia tables from say the Disc to RAM (case of Disc_copies)
2. I personally think that if my application is consisting of only
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.3. Also, i need this function when am loading mnesia tables from the network,especially when my tables are replicated, so my apps need to wait for mnesia on start up to make these tables ready. But this still only applies for tables of type
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 ?