File.Copy() is not atomic

May 27, 2013 at 11:23 AM
Hi chinhdo,
It is a great project, I've learn a lot from it.
I have some concerns as follows:
  1. I found it uses File.Copy() to back up for recovery, but File.Copy() is not atomic.
    If it is copying the backup while the system is shutting down, the backup file could be corrupted and can't be used for recovery.
  2. In TxFileManager.cs EnlistOperation()
    For each thread and each transaction scope, there is a enlistment, when would a specific enlistment be removed from _enlistments? Would there be more and more items in _enlistments as time goes by?
Thank you.
Jun 6, 2013 at 1:07 AM
Hi Enjaychang:

Re (1), that's a limitation of this library. It relies on the OS to do the actual file operations. The next step would be to create a file system driver or something of that nature and that would be a very big project outside the scope of this library. There may be incremental things we can add to improve the chance that transaction integrity is preserved in the event of errors.

Re (2), let me look into that. That sounds like it could be a potential memory leak issue there.