Re: Questions about multiuser locking in database design

From: Walt <foo_at_on.spammers>
Date: Wed, 30 Jan 2002 07:55:09 -0700
Message-ID: <232g5uc99j7j2uaa11u8vds7lrvknl7h7s_at_4ax.com>


On Tue, 29 Jan 2002 22:02:36 -0800, Jeff Zucker <jeff_at_vpservices.com> wrote:

>Here's my advice:
>
>* Always use exclusive locks if there is any writing
>(insert,update,delete).
>
>* Never release the lock before that process is completely done with the
>file.
>
>> I'd like this to work in at least two environments: Inside MS Windows from our
>> applications, and from within a web server (certainly under Linux, maybe under
>> other OS's too), from a perl script.
>
>Since you mention Perl, there are many locking related modules on CPAN,
>several of which implement semaphore files so they can run with or
>without native support for flock(). Or better yet, use one of the perl
>DBI file database modules which provide appropriate locking behind the
>scenes without you needing to do anything.

I've used perl's actual file locking in shopping cart systems and (as far as I know) it's been reliable. I prefer to stay away (far away, actually) from pre-coded modules. While it's nice to get large chunks of functionality, it's not nice to inherit other people's presumptions and bugs. I can definitely write anything I need here, so that's where I'm going to go.

That leaves Windows. I'll hunt around today and see what's in there for semaphores and file locking tools - I prefer fread,fwrite style I/o for it's compatibility and wide support, but I've never had to do any multiuser stuff with it before, so dunno what I'll find.

Thanks a lot for responding!

walt Received on Wed Jan 30 2002 - 15:55:09 CET

Original text of this message