Database / Mnesia intermediate to advanced Interview questions
How does Mnesia decide which node's data wins during schema merge conflicts?
Left to its own defaults, Mnesia doesn't have an inherent basis for deciding whose data "wins" — when
two nodes reconnect and discover their schemas or table contents disagree, it raises an
inconsistent_database_event rather than guessing. Resolution happens through one of a few
explicit mechanisms you configure or invoke:
- Master nodes (
mnesia:set_master_nodes/2) — pre-designating an authoritative node for a table ahead of time. - A custom mnesia_event handler — subscribing to system events and implementing your own resolution policy in response to the inconsistency notification.
- Manual intervention — an operator inspecting both sides and using
force_load_table/1on whichever node's data should be treated as correct.
None of these happen automatically without configuration or explicit action — this is a deliberate design choice, since silently picking a winner risks quietly discarding legitimate data on whichever side loses.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
