4

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?

G__
  • 7,003
  • 5
  • 36
  • 54

2 Answers2

5

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.

Adam Lindberg
  • 16,447
  • 6
  • 65
  • 85
2

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

0xYUANTI
  • 404
  • 2
  • 4
  • What would the behavior be for step 6? If network connectivity were restored, how would it respond to the conflict? – G__ Feb 18 '11 at 09:50
  • @Greg: the answer is in the slides linked in the other answer: Mnesiadetects the condition Mnesiadetects the condition – Issues a “running partitioned network” event – Refuses to merge the tables – Peer Stritzinger Feb 18 '11 at 11:21