Re: [Hampshire] High availability database

Top Page

Reply to this message
Author: Daniel Pope
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] High availability database
Imran Chaudhry wrote:
> To keep things simple, I'm going to assume only one PC in the
> "cluster" does an update at any one time. As you mention "just a few
> thousand items" I'm thinking sqlite along with a cron that runs every
> minute with a Perl script. This checks the stored MD5 of the sqlite
> database (which is just one self-contrained file) if the MD5 is
> different to the stored MD5 then this PC has updated the database and
> it is pushed out to all the others.


Copying an active database file can corrupt data.

Copying is not atomic. It runs sequentially through a file, which means
there's a race condition: the part that is copied last can be a later
revision than the part that's copied first, and it could be referring to
data that wasn't present when that part of the copy was taken.

You should use a copy-on-write filesystem snapshot if you want to copy
the database without compromising its integrity.

Dan