[erlang-questions] auto-syncing mnesia after a network split

Joel Reymont joelr1@REDACTED
Tue Dec 2 21:34:02 CET 2008

On Dec 2, 2008, at 8:24 PM, David Mercer wrote:

> How do you handle unsynched clocks on the two nodes?

I don't know. Should they go out of sync during the split if the split  
is short?

> How about two different transactions that occur at the same time on  
> the two
> nodes right after the split?

That would be a transaction that

1) happens at the same time, down to a microsecond in Erlang,
2) updates the same table,
3) updates the same primary key of said table,
4) whilst no other transactions have happened so that they version  
number is the same.

I think all of the above is highly unlikely.

> And if an account with balance x before the split on one node has a  
> balance
> of x + d1 after a deposit, while the other node has balance x + d2  
> after
> another deposit, all you have during the merge is the balances x +  
> d1 and x
> + d2, and no way to identify d1 and d2 without knowing x.

You would code defensively, obviously, and would have a separate  
ledger for deposits and withdrawals that you could always reconcile to  
arrive at the proper balance.


More information about the erlang-questions mailing list