Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Simultaneous Database Builds Dangerous?

Quote Reply
Simultaneous Database Builds Dangerous?
We are currently evaluating the use of Links for an upcoming site we're building and ran into an interesting problem. Two people were adding links and building the site using 'Build All' when the links database became corrupted and most of the links were lost (luckily we had a backup!). Does Links assume that only one person will be building the database? Does the software support simultaneous database builds? I looked at nph-build.cgi and discovered that the links.db file is actually built into a temporary file first, then copied to the real file. The copy doesn't seem to be protected by any sort of locking code. Does the Perl open() function take care of this by default?
Quote Reply
Re: Simultaneous Database Builds Dangerous? In reply to
Hi Andrew,

No, Links assumes there is only one person building at a time. open() does not provide any locking support, and that's probably what corrupted things.

Also, since building is such a complex process, I wouldn't want to try and have two people doing it at once. Perhaps a "in use" file should be created and building not be allowed if that file exists.

Cheers,

Alex