Re: Database syncronization
Date: Fri, 26 Apr 2002 21:45:08 -0400
Message-ID: <m38z797w4b.fsf_at_chvatal.cbbrowne.com>
The world rejoiced as "Bytter" <bytter_at_netc.pt> wrote:
> Hi,
>
> I've got a problem that I can't seem to resolve in a simple way. My problem
> is: one database in 'n' computers (to make it simple, lets start with 2).
> Both have the same tables, which have the same fields. But both run on two
> different computers. On both, they can add new things, delete old ones, and
> modify existing entries. But, at one time, they must syncronize. They data
> must be shared: those entries added, must be added, those modified must be
> modified, and so on... (simple uh :)) Let's start using a simple table, with
> an unsigned long int primary key:
>
> Names
> -------
> Cod (LONG INT) (PK) (auto-increment)
> Name (varchar)
>
> Ok until here... Now let's run it on two diferent computers. Tables are
> empty, we create two diferent entries on both computers. They get the same
> 'Cod'... :-(
>
> Now, let's change our 'Cod' to a TIMESTAMP... The problem seems to be
> resolved but then, who said that it wouldn't be possible two create two
> entries at the same second? Nothing guarantees that the clock is
> synchronized, nothing guarantees how many users are using it at the SAME
> TIME... So, problem unresolved.
>
> Third try: add an ID to the end of 'Cod', and mantain it TIMESTAMP. Well,
> fine... Problem is when 'n' (number of computers running the database
> independently) starts to grow... It doesn't seem a genial way to do it...
>
> So, what's next ? Any ideas ? I'm really needing some help here... Oh, and
> they are meant to be practically implemented (consider performance).
Two things should be helpful:
- You _must_ keep the clocks synchronized. This is truly and fundamentally important.
If "nothing guarantees that the clock is synchronized," then you're up a creek without a paddle; you're in bad trouble. You NEED a synchronized clock.
See <http://www.ntp.org/> for the software you should be using for this.
2. If you're looking for uniqueness, there's the OSF/DCE GUID notion.
<http://www.globecom.net/ietf/draft/draft-kindel-uuid-uri-00.html>
-- (concatenate 'string "cbbrowne" "_at_cbbrowne.com") http://www.cbbrowne.com/info/languages.html "A good system can't have a weak command language." -- Alan Perlis [This explains why MS-DOS and Windows can't possibly be good systems...]Received on Sat Apr 27 2002 - 03:45:08 CEST