Transaction Processing IS698 Min Song. 2 What is a Transaction?  When an event in the real world changes the state of the enterprise, a transaction is.

Slides:



Advertisements
Similar presentations
Chapter 1 Overview of Databases and Transaction Processing.
Advertisements

1 Integrity Ioan Despi Transactions: transaction concept, transaction state implementation of atomicity and durability concurrent executions serializability,
Chapter 15: Transactions Transaction Concept Transaction Concept Concurrent Executions Concurrent Executions Serializability Serializability Testing for.
Chapter 16: Transaction Management
Em Spatiotemporal Database Laboratory Pusan National University File Processing : Transaction Management 2004, Spring Pusan National University Ki-Joune.
Overview of Databases and Transaction Processing Chapter 1.
Chapter 7 Transactions 7.1 Transaction Concept 7.2 Transaction State 7.3 Implementation of Atomicity and Durability 7.4 Concurrent Executions 7.5 Serializability.
©Silberschatz, Korth and Sudarshan15.1Database System ConceptsTransactions Transaction Concept Transaction State Implementation of Atomicity and Durability.
Chapter 8 : Transaction Management. u Function and importance of transactions. u Properties of transactions. u Concurrency Control – Meaning of serializability.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 15: Transactions.
Database Management Systems I Alex Coman, Winter 2006
©Silberschatz, Korth and Sudarshan15.1Database System Concepts Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity.
©Silberschatz, Korth and Sudarshan15.1Database System Concepts Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity.
1 Recap Database: –collection of data central to some enterprise that is managed by a Database Management System –reflection of the current state of the.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Transactions.
Transaction Management WXES 2103 Database. Content What is transaction Transaction properties Transaction management with SQL Transaction log DBMS Transaction.
1 Introduction Introduction to database systems Database Management Systems (DBMS) Type of Databases Database Design Database Design Considerations.
Transaction. A transaction is an event which occurs on the database. Generally a transaction reads a value from the database or writes a value to the.
Chapter 1 Overview of Databases and Transaction Processing.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 14: Transactions.
Transactions Sylvia Huang CS 157B. Transaction A transaction is a unit of program execution that accesses and possibly updates various data items. A transaction.
TRANSACTIONS. Objectives Transaction Concept Transaction State Concurrent Executions Serializability Recoverability Implementation of Isolation Transaction.
Transactions. Chapter 14: Transactions Transaction Concept Transaction State Concurrent Executions Serializability Recoverability Implementation of Isolation.
Lecture 7- Transactions Advanced Databases Masood Niazi Torshiz Islamic Azad University- Mashhad Branch
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan Chapter 15: Transactions.
Transaction Lectured by, Jesmin Akhter, Assistant professor, IIT, JU.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 15: Transactions.
1 Transactions. 2 Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various data items. E.g. transaction.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 15: Transactions.
Chapter 15: Transactions
Concurrency Control in Database Operating Systems.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 15: Transactions.
©Silberschatz, Korth and Sudarshan15.1Database System Concepts Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity.
Database Techniek Lecture 4: Transactions (Chapter 13/15)
©Silberschatz, Korth and Sudarshan15.1Database System Concepts Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity.
Chapter 15: Transactions Loc Hoang CS 157B. Definition n A transaction is a discrete unit of work that must be completely processed or not processed at.
Computing & Information Sciences Kansas State University Wednesday, 05 Nov 2008CIS 560: Database System Concepts Lecture 28 of 42 Wednesday, 05 November.
Chapter 14 Transactions Yonsei University 1 st Semester, 2015 Sanghyun Park.
Chapter 10 Recovery System. ACID Properties  Atomicity. Either all operations of the transaction are properly reflected in the database or none are.
Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity and Durability Concurrent Executions Serializability Recoverability.
Chapter 1 Overview of Databases and Transactions.
15.1 Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various data items. E.g. transaction to transfer.
©Silberschatz, Korth and Sudarshan14.1Database System Concepts - 6 th Edition Chapter 14: Transactions Transaction Concept Transaction State Concurrent.
Database System Concepts, 5th Ed. Bin Mu at Tongji University Chapter 15: Transactions.
Advanced Database- Dr. Arasteh1 Advanced Database Bahman Arasteh ( Ph.D, Software Engineering ) Department of Software Engineering, Azad University of.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 14: Transactions.
Software System Lab. Transactions Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various.
D ATABASE A DMINISTRATION L ECTURE N O 5 Muhammad Abrar.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 14: Transactions.
Chapter 1 Overview of Databases and Transaction Processing.
Chapter 15: Transactions
Chapter 15: Transactions
Chapter 14: Transactions
Database Management System
Part- A Transaction Management
Transactions.
Transactions.
Overview of Databases and Transaction Processing
Chapter 15: Transactions
Transactions.
Transactions Sylvia Huang CS 157B.
Chapter 14: Transactions
Chapter 14: Transactions
Chapter 14: Transactions
UNIT -IV Transaction.
Presentation transcript:

Transaction Processing IS698 Min Song

2 What is a Transaction?  When an event in the real world changes the state of the enterprise, a transaction is executed to cause the corresponding change in the database state With an on-line database, the event causes the transaction to be executed in real time  A transaction is an application program with special properties - discussed later - to guarantee it maintains database correctness

3 What is a Transaction Processing System?  Transaction execution is controlled by a TP monitor Creates the abstraction of a transaction, analogous to the way an operating system creates the abstraction of a process TP monitor and DBMS together guarantee the special properties of transactions  A Transaction Processing System consists of TP monitor, databases, and transactions

4 Transaction Processing System TP Monitor DBMS database transactions DBMS database

5 System Requirements  High Availability: on-line => must be operational while enterprise is functioning  High Reliability: correctly tracks state, does not lose data, controlled concurrency  High Throughput: many users => many transactions/sec  Low Response Time: on-line => users are waiting

6 System Requirements (con’t)  Long Lifetime: complex systems are not easily replaced Must be designed so they can be easily extended as the needs of the enterprise change  Security: sensitive information must be carefully protected since system is accessible to many users Authentication, authorization, encryption

7 Roles in Design, Implementation, and Maintenance of a TPS  System Analyst - specifies system using input from customer; provides complete description of functionality from customer’s and user’s point of view  Database Designer - specifies structure of data that will be stored in database  Application Programmer - implements application programs (transactions) that access data and support enterprise rules

8 Roles in Design, Implementation and Maintenance of a TPS (con’t)  Database Administrator - maintains database once system is operational: space allocation, performance optimization, database security  System Administrator - maintains transaction processing system: monitors interconnection of HW and SW modules, deals with failures and congestion

9 Transaction Concept  A transaction is a unit of program execution that accesses and possibly updates various data items.  E.g. transaction to transfer $50 from account A to account B: 1.read(A) 2.A := A – 50 3.write(A) 4.read(B) 5.B := B write(B)  Two main issues to deal with: Failures of various kinds, such as hardware failures and system crashes Concurrent execution of multiple transactions

10 Example of Fund Transfer  Transaction to transfer $50 from account A to account B: 1.read(A) 2.A := A – 50 3.write(A) 4.read(B) 5.B := B write(B)  Atomicity requirement if the transaction fails after step 3 and before step 6, money will be “lost” leading to an inconsistent database state  Failure could be due to software or hardware the system should ensure that updates of a partially executed transaction are not reflected in the database  Durability requirement — once the user has been notified that the transaction has completed (i.e., the transfer of the $50 has taken place), the updates to the database by the transaction must persist even if there are software or hardware failures.

11 Example of Fund Transfer (Cont.)  Transaction to transfer $50 from account A to account B: 1.read(A) 2.A := A – 50 3.write(A) 4.read(B) 5.B := B write(B)  Consistency requirement in above example: the sum of A and B is unchanged by the execution of the transaction  In general, consistency requirements include  Explicitly specified integrity constraints such as primary keys and foreign keys  Implicit integrity constraints e.g. sum of balances of all accounts, minus sum of loan amounts must equal value of cash-in-hand A transaction must see a consistent database. During transaction execution the database may be temporarily inconsistent. When the transaction completes successfully the database must be consistent  Erroneous transaction logic can lead to inconsistency

12 Example of Fund Transfer (Cont.)  Isolation requirement — if between steps 3 and 6, another transaction T2 is allowed to access the partially updated database, it will see an inconsistent database (the sum A + B will be less than it should be). T1 T2 1.read(A) 2.A := A – 50 3.write(A) read(A), read(B), print(A+B) 4.read(B) 5.B := B write(B  Isolation can be ensured trivially by running transactions serially that is, one after the other.  However, executing multiple transactions concurrently has significant benefits.

13 Transaction State  Active – the initial state; the transaction stays in this state while it is executing  Partially committed – after the final statement has been executed.  Failed -- after the discovery that normal execution can no longer proceed.  Aborted – after the transaction has been rolled back and the database restored to its state prior to the start of the transaction. Two options after it has been aborted: restart the transaction  can be done only if no internal logical error kill the transaction  Committed – after successful completion.

14 Transaction State (Cont.)

15 Implementation of Atomicity and Durability  The recovery-management component of a database system implements the support for atomicity and durability.  E.g. the shadow-database scheme: all updates are made on a shadow copy of the database  db_pointer is made to point to the updated shadow copy after the transaction reaches partial commit and all updated pages have been flushed to disk.

16 Implementation of Atomicity and Durability (Cont.)  db_pointer always points to the current consistent copy of the database. In case transaction fails, old consistent copy pointed to by db_pointer can be used, and the shadow copy can be deleted.  The shadow-database scheme: Assumes that only one transaction is active at a time. Assumes disks do not fail Useful for text editors, but  extremely inefficient for large databases Variant called shadow paging reduces copying of data, but is still not practical for large databases Does not handle concurrent transactions

17 Concurrent Executions  Multiple transactions are allowed to run concurrently in the system. Advantages are: increased processor and disk utilization, leading to better transaction throughput  E.g. one transaction can be using the CPU while another is reading from or writing to the disk reduced average response time for transactions: short transactions need not wait behind long ones.  Concurrency control schemes – mechanisms to achieve isolation that is, to control the interaction among the concurrent transactions in order to prevent them from destroying the consistency of the database