Database / Mnesia intermediate to advanced Interview questions
What is the {majority, true} table option and what tradeoff does it introduce?
Setting {majority, true} on a table requires that a write be acknowledged by a majority of the
nodes holding a copy of that table before the transaction is allowed to commit — if a network partition
leaves a node (or minority group of nodes) unable to reach a majority of replicas, writes on that isolated side
are refused rather than silently accepted.
mnesia:create_table(critical_config, [{disc_copies, [n1, n2, n3]}, {majority, true}, {attributes, [key, value]}]).
This directly trades availability for consistency during a partition: the minority side can't write at all until connectivity is restored, whereas without the option, both sides of a partition could keep accepting (potentially conflicting) writes independently. It's the closest thing Mnesia offers to a quorum-based consistency guarantee, at the cost of write availability on whichever side of a split doesn't hold a majority.
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...
