http://qs1969.pair.com?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