Transactions for File I/O?

  • Thread starter Thread starter cmay
  • Start date Start date
C

cmay

I am wrapping a bunch of DB calls into an MSDTC transaction, using the
..net 2.0 System.Transactions transactionscope.

Part of the operations I need to do in this transaction include some
writing to the file system (deleting a file / creating a file).

There is no way to rollback changes to the file system correct?

Just checking...
 
Hello,
Part of the operations I need to do in this transaction include some
writing to the file system (deleting a file / creating a file).
There is no way to rollback changes to the file system correct?

If you need to have transactional support on the file system, then you need
to take a different approach than using DTC. Windows Vista and the future
server operating system version of Vista ("Longhorn") does provide a
technology called Transactional NTFS (TxF), which is using a feature called
The Kernel Transaction Manager (KTM). Currently, there's no managed API
wrapper for these APIs (as far as I know), although you could use P/Invoke
to call these APIs. See here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/KTM/fs/ktm_start_page.asp

My opinion is that if you require real transactions on the file system, then
use KTM on Vista. Of course, that is easily more said than done because you
probably require your application to work on Windows XP, Windows Server
2003, etc. as well. In that case, think about the approach used by many SQL
databases like Microsoft SQL Server, which use an internal log file to
implement transactions even though the operating system doesn't guarantee
that file operations succeed.

Hope this helps.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 
Thanks Jani.



Hello,


If you need to have transactional support on the file system, then you need
to take a different approach than using DTC. Windows Vista and the future
server operating system version of Vista ("Longhorn") does provide a
technology called Transactional NTFS (TxF), which is using a feature called
The Kernel Transaction Manager (KTM). Currently, there's no managed API
wrapper for these APIs (as far as I know), although you could use P/Invoke
to call these APIs. See here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/KTM/fs/ktm_start_page.asp

My opinion is that if you require real transactions on the file system, then
use KTM on Vista. Of course, that is easily more said than done because you
probably require your application to work on Windows XP, Windows Server
2003, etc. as well. In that case, think about the approach used by many SQL
databases like Microsoft SQL Server, which use an internal log file to
implement transactions even though the operating system doesn't guarantee
that file operations succeed.

Hope this helps.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 
Back
Top