Does MNesia support synchronization after disconnected operation?

636 views Asked by At

I'm starting to architect a project with the following requirements:

  • The overall system will be distributed across multiple physical nodes on a WAN
  • Each node will be using and manipulating a common set of data records
  • Operations on these records must be resilient to network outages

I'm considering utilizing Mnesia/Erlang as the base platform for this project, but I'd like to know how well it (Mnesia) can handle simultaneous disconnected conflicting operations on the data set.

An illustrative scenario:

  1. Nodes A and B have connectivity and an empty data set.
  2. Node A adds record (1, ABC).
    • Here, the record sets should transparently synchronize and now node B also has record (1, ABC).
  3. Network connectivity between them is lost.
  4. Node A alters the record to (1, DEF).
  5. Node B (later timestamp) alters the record to (1, GHI).
  6. Network connectivity is restored
    • Expected: After a transparent synchronization, both nodes contain the record (1, GHI).

To simplify, let's assume that a complete change history is not required (e.g. it's not important that record 1 used to contain ABC or DEF, it's only important that it now contains GHI).

Is this an out-of-the-box (or trivial to implement) capability of Mnesia?

2

There are 2 answers

0
Adam Lindberg On BEST ANSWER

Ulf Wiger had a talk last Erlang Factory in San Francisco (2010) on this topic. You can find his slides here: http://www.erlang-factory.com/upload/item/7/UlfWiger-10minutetalk.pdf

They contains an overview of the problems and also pointers to some source code that might be of use to you.

2
0xYUANTI On

Steps 1-5 should work. Automatic conflict resolution (step 6): no.