On Mon, Mar 14, 2005 at 11:50:45AM -0700, Ara T Howard wrote:
> > > does anyone have a strategy for doing massive updates to a db and 
> > atomicly> replacing it in a multi-process situation?
> > 
> > Assuming you have a cgi-like application with many processes that just
> > looks up a row, displays and then exits. You can simple use the 
> > rename call
> > to atomically replace the db file(see man 2 rename for bordercases) 
> > withanother and without locking.
> > 
> > lothar
> 
> but this will lose any update currently begin written by any of the
> active cgi processes  - even if they are in the middle of a transaction?

yes, this will only work with a read-only db, e.g. all your data is
pre-calculated once a day to a second db file, and then replace the primary
read-only db with it.

But with read-only, one should avoid transactions at all. There will be the
risk of a -journal that doesn't correspond to the db-file. I think this
will break if rolled back?

lothar

Reply via email to