[erlang-questions] Question about distributed mnesia behavior

Ulf Wiger ulf@REDACTED
Sat Apr 28 14:13:22 CEST 2012


When test1 comes up, and detects that test2 is down, it also notes that it has no log entry of test2 dying. Therefore it assumes that test2 has a newer copy and decides to wait for it.

Remember that mnesia has no built-in heuristics for conflict resolution. It does provide a function to 'force_load' a table, if your application (or operator) can determine that it's the right thing to do.

Fair warning, though, make sure that test2 doesn't start loading in the middle of this. All bets are off then.

BR,
Ulf W

Ulf Wiger, Feuerlabs, Inc.
http://www.feuerlabs.com

28 apr 2012 kl. 10:25 skrev "cao.xu" <cao.xu@REDACTED>:

> Hi,
> 
>    I am using mnesia recently under OTP R15B, and feel confused about some behavior of distributed mnesia.
> 
>    I ran two nodes with sname 'test1' and 'test2', and then executed the following command "mnesia:create_schema(['test1', 'test2']), mnesia:create_table(test, [{disc_copies,['test1', 'test2']}]" on 'test1'. After that, I was able to use table 'test' on both nodes, everything seemed fine.
> 
>     Then I shutdown these two nodes and restarted 'test2', the table 'test' was still accessible and I could read and write on it.  But when I shutdown 'test2' and restarted 'test1', the table 'test' was unaccessible. The function wait_for_table would timeout and operations on table 'test' would fail. Only if 'test2' is running, the table becomes accessible again on 'test1'.
> 
>    I was wondering if this is an expected behavior, or the table should work properly on both nodes when run alone.
> 
> BR
> 
> Xu Cao



More information about the erlang-questions mailing list