Home All Groups Group Topic Archive Search About

Transactions for File I/O?

Author
14 Nov 2006 4:44 AM
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...

Author
14 Nov 2006 5:03 AM
Jani Järvinen [MVP]
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
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Author
14 Nov 2006 5:39 PM
cmay
Thanks Jani.




Jani Järvinen [MVP] wrote:
Show quote
> 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
> ja***@removethis.dystopia.fi
> http://www.saunalahti.fi/janij/

AddThis Social Bookmark Button