uwiger edited this page Sep 14, 2010 · 2 revisions
Clone this wiki locally

Welcome to the unsplit wiki!

This project depends on a mnesia patch, mnesia_merge

Documentation would be nice, but currently, there is none.

For very crude information on how I’ve tested so far, take a look at the commands.txt file.

The first time, you will need to create a mnesia schema and at least one test table.
I’ve used a RAM-only table to simplify testing, as I don’t have to clear away garbage from failed previous test runs.

The approach is to trigger reconciliation through a mnesia event handler. Mnesia should issue a system event flagging an inconsistency on both nodes trying to merge, so the unsplit_server will use a global lock (global:transaction/2) to make sure that only one instance runs the merging code. The other side will also enter the critical section eventually, but before doing anything, it will check the ‘running_db_nodes’ list in mnesia. If the other node is in the list, the merge has already happened and nothing more needs to be done.

The actual deconflict logic is configurable, by setting a user property for each table: {unsplit_method, {M, F, XArgs}}. See the functions in unsplit_lib.erl for some examples.