question about mnesia distribution

霸气de小男生 提交于 2019-12-04 18:41:57

In this discussion a situation similar to the one you're facing is presented.

Reading from that source:

At startup Mnesia tries to connect with the other nodes and if that suceeds it loads its tables from them. If the other nodes are down, it looks for mnesia_down marks in its local transaction log in order to determine if it has a consistent replica or not of its tables. The node that was shutdown last has mnesia_down's from all the other nodes. This means that it safely can load its tables. If some of the other nodes where started first (as in your case) Mnesia will wait indefinitely for another node to connect in order to load its tables

You're shutting down node 1 first, so it doesn't have the mnesia_down from the other node. What happens if you reverse the shutting down order?

Also, it should be possible to force the table loading via the force_load_table/1 function:

force_load_table(Tab) -> yes | ErrorDescription

The Mnesia algorithm for table load might lead to a situation where a table cannot be loaded. This situation occurs when a node is started and Mnesia concludes, or suspects, that another copy of the table was active after this local copy became inactive due to a system crash.

If this situation is not acceptable, this function can be used to override the strategy of the Mnesia table load algorithm. This could lead to a situation where some transaction effects are lost with a inconsistent database as result, but for some applications high availability is more important than consistent data.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!