On 7 Oct 2009, at 7:20pm, Adam DeVita wrote:

> regarding this
> " The fault is that
> almost nobody does it right: they neglect to keep an 'unaltered
> central copy' and think they can cross-apply journals each time two
> databases talk to one-another.  That does not work for various  
> reasons."
>
> Would a central repository of journals that can be applied to local
> repositories be sufficient?  I suppose I assume that running the same
> program on N workstations with the same set of journals should  
> produce N
> identical results.

You need a copy of the database which is not changed by any site.  All  
the sites send in their journals.  The journals are merged into a  
superjournal in time order.  The superjournal is then applied to the  
central copy of the database.  Then the updated database is sent back  
out to all sites.

The problem comes when you apply multiple journals in a different  
order. Start with each site with identical copies of a TABLE with  
three clients: one managed by Mr. Green, one by Mr. Red, and one by  
Mr. Black.  'G R B'.  Then, in this order ...

Mr. Green goes on holiday ...
Site A says that all Mr. Green's customers will be handled by Mr. Red.
UPDATE clients SET contact = 'red' WHERE contact = 'green'

Mr. Red goes on holiday ...
Site B says that all Mr. Red's customers will be handled by Mr. Black.

Then Mr. Green comes back from holiday, and Mr. Black goes on holiday  
so ...
Site C says that all Mr. Black's customers will be handled by Mr. Green.

Then they all synchronise databases.  See if you can make them all end  
up with the same data if they synch against each-other rather than a  
central unaltered copy of the databases.  Doesn't work: one site might  
have 'B B B', another 'R B R'.  You can do it only by luck ... by  
happening to know in which order people went on holiday.  However, if  
you always synch against a central unaltered copy of the database you  
can synch in any order.  Once everyone has synchronised you distribute  
a copy of the central database to everyone and they all have identical  
data once more.  That's the simplest setup.  You can get more  
complicated by having each site remember which journals they've played  
back.

The problem does not occur if any record can only ever be modified by  
one site.  But if you have the normal 'anyone can do anything' setup,  
you have to be really really careful.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to