Re: Questions about multiuser locking in database design
Date: Tue, 29 Jan 2002 22:02:36 -0800
Message-ID: <3C578C7C.25928B4D_at_vpservices.com>
Jerry Gitomer wrote:
>
> Walt wrote:
> >
> > It is very possible that more than one application might submit a thumbnail to
> > this database at a time, possibly resulting in a collision of some kind
>
> Stop and think about your application(s). The only time you
> have to worry
> about collisions is when updating. When an image is being
> created no one
> but the creator can access it until it is actually in the
> database.
But that doesn't mean that new rows can be added without locking. Here's what can happen without locking (especially in a web context where user A has a slow connection and user B has a speedy one):
User A opens the database file.
User B opens the database file. User B inserts an image. User B saves the file.
User A inserts an image.
User A saves the file.
Are both images in the file? Nope. So therefore inserting a new image is just as suceptible to collision as an update.
Here's my advice:
> I'd like this to work in at least two environments: Inside MS Windows from our
Since you mention Perl, there are many locking related modules on CPAN,
several of which implement semaphore files so they can run with or
> applications, and from within a web server (certainly under Linux, maybe under
> other OS's too), from a perl script.
-- JeffReceived on Wed Jan 30 2002 - 07:02:36 CET