Transactions

Those of you familiar with client/server applications should be accustomed to dealing with transactions. A transaction can be defined as a logical unit of work. It is performed as an atomic operation in that it either succeeds or fails as a whole. A simple example is that of transferring money from a savings account to a checking account. The transaction includes both the withdrawal of money from savings and the addition of the same amount of money into the checking account. If one of these steps fails, the transaction fails. Likewise, if the transaction fails, any step that had succeeded must be rolled back.

MTS simplifies the task of developing application components by allowing you to perform work with transactions. This protects applications from anomalies caused by concurrent updates or system failures.

Transactions maintain what are known as the ACID properties, as follows:

  • Atomicity ensures that all the updates completed under a specific transaction are either committed and made durable, or aborted and rolled back to their previous state.
  • Consistency means that a transaction is a correct transformation of the system state, preserving the state invariants.
  • Isolation protects concurrent transactions from seeing each other's partial and uncommitted results, which might create inconsistencies in the application state. Resource managers use transaction-based synchronization protocols to isolate the uncommitted work of active transactions.
  • Durability means that committed updates to managed resources—such as a database record—survive failures, including communication failures, process failures, and server system failures. Transactional logging even allows you to recover the durable state after disk media failures.

The intermediate states of a transaction are not visible outside the transaction, and either all the work happens or none of it does. This allows you to develop application components as if each transaction executes sequentially and without regard to concurrency. This simplifies the lives of application developers: they can develop code without having to worry about multiple users executing the same code. They can simply write the code as if it's intended for a single user.



Programming Microsoft Visual InterDev 6. 0
Programming Microsoft Visual InterDev 6.0
ISBN: 1572318147
EAN: 2147483647
Year: 2005
Pages: 143

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net