http://www.perlmonks.org?node_id=529340


in reply to Atomic use of unlink() and SQL DELETE? How?

Why don't you first delete data from database and then from the filesystem? That's the way I implemented a similar unlink procedure; this way you use the rollback feature of your db and postpone the unlinking of the file until just after the commit. If the database operations fail, the file will not be touched; if the procedure can't unlink the file, the inconsistency could be repaired by a periodic sort of fsck. Am I wrong?

Ciao, Valerio

  • Comment on Re: Atomic use of unlink() and SQL DELETE? How?

Replies are listed 'Best First'.
Re^2: Atomic use of unlink() and SQL DELETE? How?
by robins (Acolyte) on Jun 14, 2006 at 09:31 UTC
    This seems like the most appropriate solution for my application. I'll just have to build the cleanup process into the backend scheduler. Thanks for the tip (and sorry about the long delay in answering).