Transactional file system (begin, rollback and commit)

Hello,

In advance, sorry for my poor english. I have search on Google and not found (or not understanding terms) that i need.

In a maintenance PHP script, i need to update database (innoDB tables, in MySQL, in transactional mode) and need to rename, delete, and create some files. The problem is appear if i have a problem during files operations; i cant rollback file system state.

I search (if it exists) a *BSD "transactional file system" with begin, rollback and commit commands. Can you provide me a file system name ? what API ? what terms for searching ?

Thank you in advance.
 
Not at that fine-grained of control, no.

If you use ZFS, and you create a separate ZFS filesystem for each directory you need this for, then you can do a sequence similar to this:
  • snapshot filesystem
  • do your file operations
  • if the file operations are successful, delete snapshot
  • if the file operations fail, roll-back to the snapshot
Just be aware that this snapshot/rollback applies to the whole filesystem, so you really need to narrow it down to 1 directory, and do some kind of serialising or locking to make sure only 1 process is using that directory.

There may be other options. That's the only one I can think of.
 
Back
Top