Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Basic TxF Concepts

Read Isolation

Transactional NTFS (TxF) provides read-committed consistency.

A transacted writer refers to a transacted file handle opened with any permission that is not part of generic read access but is part of generic write access. A transacted writer views the most recent version of a file that includes all of the changes by the same transaction. There can be only one transacted writer per file. Non-transacted writers are always blocked by a transacted writer, even if the file is opened with shared-write permissions.

A transacted reader refers to a transacted file handle opened with any permission that is a part of generic read access but is not part of generic write access. A transacted reader views a committed version of the file that existed at the time the file handle was opened. The transacted reader is isolated from the effects of transacted writers. This provides a consistent view of the file only for the life of the file handle and blocks non-transacted writers.

Note  When a handle has been opened for modification with the CreateFileTransacted function, all subsequent opens of the file within that transaction—whether read-only or not—are converted by the system to be a transacted writer for the purposes of isolation and other transactional semantics. This means that subsequently, when a handle is opened for read-only access, the handle does not receive a view of the file prior to the start of the transaction; it receives the active transaction view of the file.

A non-transacted file handle does not see any changes made within a transaction until the transaction is committed. The non-transacted file handle receives an isolated view that is similar to a transacted reader, but unlike a transacted reader, it receives the file update when a transacted writer commits the transaction.

Isolation Levels

TxF provides read-committed isolation. This means that file updates are not seen outside the transaction. In addition, if a file is opened more than once while reading files within the transaction, you may see different results with each subsequent opening. Files that were available the first time you accessed them may not be available (because they were deleted), or vice versa.

Transactional Locking

Creating a transacted writer on a file transactionally locks the file. After a file is locked by a transaction, other file system operations external to the locking transaction that try to modify the transactionally locked file will fail with either ERROR_SHARING_VIOLATION or ERROR_TRANSACTIONAL_CONFLICT.

The following table summarizes transactional locking.

File currently opened byFile open attempted by
TransactedNon-Transacted
ReaderReader/WriterReaderReader/Writer
Transacted ReaderYesYesYesNo2
Transacted Reader/WriterYesNo2YesNo2
Non-Transacted ReaderYesYesYesYes
Non-Transacted Reader/WriterNo1No1YesYes

1. Fails with ERROR_TRANSACTIONAL_CONFLICT

2. Fails with ERROR_SHARING_VIOLATION

 

If you open a named stream for a modification that is using a transaction, the entire file is required to be locked.

In addition to transactional locking, typical NTFS file-sharing rules apply.

You need to consider the following two file sharing modes in parallel:

  • The transactional locking mode.
  • Normal file-sharing modes.
Whichever mode is more restrictive is the one that applies.

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.