Gossamer Forum
Home : Products : DBMan : Customization :

flock and uploading new database updates

Quote Reply
flock and uploading new database updates
The database I am running never has any entries added, modified, or deleted online.
The entire database is updated offline and ftped to the site four times a day.

Since there are two seperate data providers, there are two files uploaded. I have a cron routine that concatenates the two files, and then renames (mv) the new file to the database name.

My question is: what would happen if someone were accessing the database at the same time that cron decided to mv the file? Would it just overwrite it anyway? Would it generate an error and not update the file? Would it crash the database program?

If this does pose a problem, would the solution be to just turn off flock, since no one will ever be changing the file online? (All such permissions are turned off; it is a view/search only database).

Any ideas/comments will be much appreciated!

Ciao,

Bruce


------------------
Bruce Dienes
bdienes@iname.com
Quote Reply
Re: flock and uploading new database updates In reply to
If a user tries to view at the same time the file is being updated then they might not see all the data. The chance of this happening is really small as a system level 'mv' is very quick. I wouldn't worry about it.

flock() won't help as it only works if the other program is using flock(), if your cron routine isn't using flock() it would ignore any locks DBMan has put on the file.

If you are not doing updates, you can safely turn flock off.

Cheers,

Alex