Database / Mnesia basics Interview questions
How do you troubleshoot a Mnesia table stuck in the "loading" state?
A table stuck loading after a restart usually means Mnesia can't decide it has a safe, up-to-date copy to load from — commonly after an unclean shutdown, a network partition that separated replicas, or a node coming back up while unsure whether another replica holds newer data.
mnesia:table_info(person, where_to_read). %% check which node it's trying to read from mnesia:system_info(running_db_nodes). %% confirm which nodes are actually connected
Practical steps: first confirm which other nodes are actually reachable and running
(mnesia:system_info(running_db_nodes)), since the stuck node may simply be waiting on a replica
that's down or unreachable. Check the logs for messages about inconsistent database state, which indicate
Mnesia detected conflicting views of the data and is refusing to guess which copy is authoritative. If you can
confirm which node's copy is actually the correct, most recent one, that's the point where
mnesia:force_load_table/1 becomes the (last-resort) way to break the deadlock.
More Related questions...