Transaction & Concurrency Control Unit-5
Transaction A sequence of separate operations that execute in a atomic manner • Free from interference by operations being performed on behalf of other concurrent clients. • Either all of the operations must be completed successfully or they must have no effect at all in the presence of server crashes. A transaction is an execution of a program that accesses a database. In the context of a transactional file server, a transaction is an execution of a sequence of client request for file operations. In the clients point of view, a transaction is a sequence of operations that forms a single step, transforming the server data from one consistent state to another.
ACID Properties: • Atomicity: a transaction must be all or nothing. • Consistency: a transaction takes the system from one consistent state to other consistent state. • Isolation: each transaction must be performed without interference from other transaction. • Durability: after a transaction has completed successfully, all its effects are saved in permanent storage.
Nested Transactions: • Transactions are composed of other transactions. Several transactions may be started from within a transaction allowing transactions to be regarded as modules that can be composed as required. • Top level transaction: the outer most transaction in a set of nested transactions. Sub-transactions: transactions other than the top level transactions. • A sub transaction appears atomic to its parent with respect to transaction failures and to concurrent access. • Sub transactions at the same level can run concurrently but their access to common objects is serialized. • Each sub transaction can fail independently of its parent and of the other sub transactions. • When a sub transaction aborts the parent transaction can sometimes choose an alternative sub transaction to complete its task.