SlideShare a Scribd company logo
1 of 20
Download to read offline
Advanced Database Technologies
Eric Umuhoza, PhD
Email: eric.umuhoza@gmail.com
Twitter: @EricUmuhoza
June 25, 2023
1 / 20
Transactional Systems
In this lecture
• Introduction to the concept of transaction
• Properties of a transaction
• Modules of the DBMS responsible of guaranteeing such
properties
2 / 20
Transactional Systems
Definition of Transaction
• An atomic logical unit of work
– containing one or more SQL commands
• Example: money transfer between two bank accounts
– Decrement first account
– Increment second account
• The effects of all the SQL statements in a transaction can be:
– either all committed (applied – permanently - to the database)
– or all rolled back (undone from the database)
3 / 20
Transactional Systems
Definition of Transaction
• Each transaction is encapsulated within two commands:
– begin transaction (bot)
– end transaction (eot)
• Within a transaction one of the commands below is executed
(exactly once):
– commit work (commit)
– rollback work (abort)
• Transactional System: a system capable of providing the
definition and execution of transactions on behalf of multiple,
concurrent applications.
4 / 20
Transactional Systems
Transaction:Example
begin transaction ;
update Account
set Balance = Balance − 10 where AccNum = 42177;
update Account
set Balance = Balance + 10 where AccNum = 12202;
commit work ;
end transaction ;
5 / 20
Transactional Systems
Transaction:Example with Alternative
begin transaction ;
update Account
set Balance = Balance + 10 where AccNum = 12202;
update Account
set Balance = Balance − 10 where AccNum = 42177;
select Balance into A from Account
where AccNum = 42177;
i f (A>=0) then commit work
else rollback work ;
end transaction ;
6 / 20
Transactional Systems
Transactions in JDBC
• Transaction mode is chosen via a method defined in the
Connection interface
– setAutoCommit(boolean autoCommit)
• con.setAutoCommit(true)
– (Default) ”autocommit”: every single operation is a transaction
• con.setAutoCommit(false)
– Transactions are handled in the program
con.commit()
con.rollback()
• There is no start transaction
7 / 20
Transactional Systems
Well-formed Transactions
• Begin transaction
• Code for data manipulation (reads and writes)
• Commit work — rollback work
• No data manipulation
• End transaction
8 / 20
Transactional Systems
ACID Properties of Transactions
• A transaction is a unit of work enjoying the following properties:
– Atomicity
– Consistency
– Isolation
– Durability
9 / 20
Transactional Systems
Atomicity
• A transaction is an atomic transformation from the initial state
to the final state
• Possible behaviors:
1 Commit work: SUCCESS
2 Rollback work or error prior to commit: UNDO
3 Fault after commit: REDO
10 / 20
Transactional Systems
Consistency
• The transaction satisfies the integrity constraints
– Integrity constraints provide a mechanism for ensuring that data
conforms to guidelines specified by the database administrator
– The most common types of constraints include:
UNIQUE constraints
NOT NULL constraints
FOREIGN KEY constraints
• Consequence:
– If the initial state is consistent
– Then the final state is also consistent
11 / 20
Transactional Systems
Example - Bank transfer
• Assume that after removing 10 from the first account, the
transaction is unable to update the second account.
• Atomicity requires that
– both parts of the transaction complete
– or neither complete.
ù
• Also consistency is violated (with a constraint on the balance
between income/outcome)
12 / 20
Transactional Systems
Isolation
• A transaction is not affected by the behavior of other,
concurrent transactions
• Consequence:
– Its intermediate states are not exposed
13 / 20
Transactional Systems
Example
• Consider two transactions
1 T1 transfers 10 from Acc1 to Acc2
2 T2 transfers 10 from Acc2 to Acc1
• Combined, there are four actions:
1 T1 subtracts 10 from Acc1 (1)
2 T1 adds 10 to Acc2 (2)
3 T2 subtracts 10 from Acc2 (3)
4 T2 adds 10 to Acc1 (4)
• In this order: Isolation is guaranteed
– If T1 fails on operation (2) and is executed atomically, (1) is undone→
T2 sees correct data
• If execution is interleaved (1)(3)(4)(2) and T1 fails on operation
(2), then after (1) Acc1 contains (Initial value-10); T2 performs
its operations and adds 10 to (Initial value-10); T1 fails on
operation (2) and is undone, but T2 has operated on non-valid
values.
14 / 20
Transactional Systems
Durability
• The effect of a transaction that has successfully committed will
last forever
– Independently of any system fault
15 / 20
Transactional Systems
Transaction Properties and Mechanisms
• Atomicity
– Abort-rollback-restart
– Recovery management and Commit protocols
• Consistency
– Integrity checking of the DBMS → at query execution time
• Isolation
– Concurrency control
• Durability
– Recovery management
16 / 20
Transactional Systems
Logical Architecture of a DBMS
17 / 20
Transactional Systems
Transactions and DBMS modules
• Atomicity and durability
– Reliability Manager
• Isolation
– Concurrency Control System
• Consistency
– Integrity Control System at query execution time
18 / 20
Transactional Systems
Next Topics...
• Concurrency Control (Isolation)
– Theory
– DBMS adopted method
• Reliability Control (Atomicity and Durability)
– Commit protocols and 2PC
– Logging and recovery on a single DBMS
19 / 20
Transactional Systems
The End
20 / 20

More Related Content

Similar to Transactional systems in Advanced Database

Introduction to transaction management
Introduction to transaction managementIntroduction to transaction management
Introduction to transaction managementDr. C.V. Suresh Babu
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Prosanta Ghosh
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlbalamurugan.k Kalibalamurugan
 
24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMS24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMSkoolkampus
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik TambekarPratik Tambekar
 
Chapter-10 Transaction Processing and Error Recovery
Chapter-10 Transaction Processing and Error RecoveryChapter-10 Transaction Processing and Error Recovery
Chapter-10 Transaction Processing and Error RecoveryKunal Anand
 
Distributed system TimeNState-Tanenbaum.ppt
Distributed system TimeNState-Tanenbaum.pptDistributed system TimeNState-Tanenbaum.ppt
Distributed system TimeNState-Tanenbaum.pptTantraNathjha1
 
Concepts of Real time Systems (RTS)
Concepts of Real time Systems (RTS)Concepts of Real time Systems (RTS)
Concepts of Real time Systems (RTS)EngKarrarSMuttair
 
Transaction management and concurrency control
Transaction management and concurrency controlTransaction management and concurrency control
Transaction management and concurrency controlDhani Ahmad
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency ControlRavimuthurajan
 
Optimistic Algorithm and Concurrency Control Algorithm
Optimistic Algorithm and Concurrency Control AlgorithmOptimistic Algorithm and Concurrency Control Algorithm
Optimistic Algorithm and Concurrency Control AlgorithmShounak Katyayan
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlAbDul ThaYyal
 

Similar to Transactional systems in Advanced Database (20)

Introduction to transaction management
Introduction to transaction managementIntroduction to transaction management
Introduction to transaction management
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013
 
transaction_processing.ppt
transaction_processing.ppttransaction_processing.ppt
transaction_processing.ppt
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency control
 
24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMS24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMS
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik Tambekar
 
Transactions
TransactionsTransactions
Transactions
 
Chapter-10 Transaction Processing and Error Recovery
Chapter-10 Transaction Processing and Error RecoveryChapter-10 Transaction Processing and Error Recovery
Chapter-10 Transaction Processing and Error Recovery
 
Distributed system TimeNState-Tanenbaum.ppt
Distributed system TimeNState-Tanenbaum.pptDistributed system TimeNState-Tanenbaum.ppt
Distributed system TimeNState-Tanenbaum.ppt
 
Concepts of Real time Systems (RTS)
Concepts of Real time Systems (RTS)Concepts of Real time Systems (RTS)
Concepts of Real time Systems (RTS)
 
DBMS UNIT IV.pptx
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptx
 
Transaction management and concurrency control
Transaction management and concurrency controlTransaction management and concurrency control
Transaction management and concurrency control
 
Transactions
TransactionsTransactions
Transactions
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency Control
 
Optimistic Algorithm and Concurrency Control Algorithm
Optimistic Algorithm and Concurrency Control AlgorithmOptimistic Algorithm and Concurrency Control Algorithm
Optimistic Algorithm and Concurrency Control Algorithm
 
Advanced DBMS presentation
Advanced DBMS presentationAdvanced DBMS presentation
Advanced DBMS presentation
 
Ho20
Ho20Ho20
Ho20
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency control
 
Transaction processing
Transaction processingTransaction processing
Transaction processing
 
0903 1
0903 10903 1
0903 1
 

Recently uploaded

20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdf20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdfkhraisr
 
Introduction to Statistics Presentation.pptx
Introduction to Statistics Presentation.pptxIntroduction to Statistics Presentation.pptx
Introduction to Statistics Presentation.pptxAniqa Zai
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...HyderabadDolls
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxchadhar227
 
Lake Town / Independent Kolkata Call Girls Phone No 8005736733 Elite Escort S...
Lake Town / Independent Kolkata Call Girls Phone No 8005736733 Elite Escort S...Lake Town / Independent Kolkata Call Girls Phone No 8005736733 Elite Escort S...
Lake Town / Independent Kolkata Call Girls Phone No 8005736733 Elite Escort S...HyderabadDolls
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...nirzagarg
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteedamy56318795
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...nirzagarg
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRajesh Mondal
 
Case Study 4 Where the cry of rebellion happen?
Case Study 4 Where the cry of rebellion happen?Case Study 4 Where the cry of rebellion happen?
Case Study 4 Where the cry of rebellion happen?RemarkSemacio
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareGraham Ware
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...gajnagarg
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabiaahmedjiabur940
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangeThinkInnovation
 
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...ThinkInnovation
 
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...HyderabadDolls
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...SOFTTECHHUB
 
Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numberssuginr1
 
Giridih Escorts Service Girl ^ 9332606886, WhatsApp Anytime Giridih
Giridih Escorts Service Girl ^ 9332606886, WhatsApp Anytime GiridihGiridih Escorts Service Girl ^ 9332606886, WhatsApp Anytime Giridih
Giridih Escorts Service Girl ^ 9332606886, WhatsApp Anytime Giridihmeghakumariji156
 

Recently uploaded (20)

20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdf20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdf
 
Introduction to Statistics Presentation.pptx
Introduction to Statistics Presentation.pptxIntroduction to Statistics Presentation.pptx
Introduction to Statistics Presentation.pptx
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
 
Lake Town / Independent Kolkata Call Girls Phone No 8005736733 Elite Escort S...
Lake Town / Independent Kolkata Call Girls Phone No 8005736733 Elite Escort S...Lake Town / Independent Kolkata Call Girls Phone No 8005736733 Elite Escort S...
Lake Town / Independent Kolkata Call Girls Phone No 8005736733 Elite Escort S...
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
Case Study 4 Where the cry of rebellion happen?
Case Study 4 Where the cry of rebellion happen?Case Study 4 Where the cry of rebellion happen?
Case Study 4 Where the cry of rebellion happen?
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
 
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
 
Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbers
 
Giridih Escorts Service Girl ^ 9332606886, WhatsApp Anytime Giridih
Giridih Escorts Service Girl ^ 9332606886, WhatsApp Anytime GiridihGiridih Escorts Service Girl ^ 9332606886, WhatsApp Anytime Giridih
Giridih Escorts Service Girl ^ 9332606886, WhatsApp Anytime Giridih
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 

Transactional systems in Advanced Database

  • 1. Advanced Database Technologies Eric Umuhoza, PhD Email: eric.umuhoza@gmail.com Twitter: @EricUmuhoza June 25, 2023 1 / 20
  • 2. Transactional Systems In this lecture • Introduction to the concept of transaction • Properties of a transaction • Modules of the DBMS responsible of guaranteeing such properties 2 / 20
  • 3. Transactional Systems Definition of Transaction • An atomic logical unit of work – containing one or more SQL commands • Example: money transfer between two bank accounts – Decrement first account – Increment second account • The effects of all the SQL statements in a transaction can be: – either all committed (applied – permanently - to the database) – or all rolled back (undone from the database) 3 / 20
  • 4. Transactional Systems Definition of Transaction • Each transaction is encapsulated within two commands: – begin transaction (bot) – end transaction (eot) • Within a transaction one of the commands below is executed (exactly once): – commit work (commit) – rollback work (abort) • Transactional System: a system capable of providing the definition and execution of transactions on behalf of multiple, concurrent applications. 4 / 20
  • 5. Transactional Systems Transaction:Example begin transaction ; update Account set Balance = Balance − 10 where AccNum = 42177; update Account set Balance = Balance + 10 where AccNum = 12202; commit work ; end transaction ; 5 / 20
  • 6. Transactional Systems Transaction:Example with Alternative begin transaction ; update Account set Balance = Balance + 10 where AccNum = 12202; update Account set Balance = Balance − 10 where AccNum = 42177; select Balance into A from Account where AccNum = 42177; i f (A>=0) then commit work else rollback work ; end transaction ; 6 / 20
  • 7. Transactional Systems Transactions in JDBC • Transaction mode is chosen via a method defined in the Connection interface – setAutoCommit(boolean autoCommit) • con.setAutoCommit(true) – (Default) ”autocommit”: every single operation is a transaction • con.setAutoCommit(false) – Transactions are handled in the program con.commit() con.rollback() • There is no start transaction 7 / 20
  • 8. Transactional Systems Well-formed Transactions • Begin transaction • Code for data manipulation (reads and writes) • Commit work — rollback work • No data manipulation • End transaction 8 / 20
  • 9. Transactional Systems ACID Properties of Transactions • A transaction is a unit of work enjoying the following properties: – Atomicity – Consistency – Isolation – Durability 9 / 20
  • 10. Transactional Systems Atomicity • A transaction is an atomic transformation from the initial state to the final state • Possible behaviors: 1 Commit work: SUCCESS 2 Rollback work or error prior to commit: UNDO 3 Fault after commit: REDO 10 / 20
  • 11. Transactional Systems Consistency • The transaction satisfies the integrity constraints – Integrity constraints provide a mechanism for ensuring that data conforms to guidelines specified by the database administrator – The most common types of constraints include: UNIQUE constraints NOT NULL constraints FOREIGN KEY constraints • Consequence: – If the initial state is consistent – Then the final state is also consistent 11 / 20
  • 12. Transactional Systems Example - Bank transfer • Assume that after removing 10 from the first account, the transaction is unable to update the second account. • Atomicity requires that – both parts of the transaction complete – or neither complete. ù • Also consistency is violated (with a constraint on the balance between income/outcome) 12 / 20
  • 13. Transactional Systems Isolation • A transaction is not affected by the behavior of other, concurrent transactions • Consequence: – Its intermediate states are not exposed 13 / 20
  • 14. Transactional Systems Example • Consider two transactions 1 T1 transfers 10 from Acc1 to Acc2 2 T2 transfers 10 from Acc2 to Acc1 • Combined, there are four actions: 1 T1 subtracts 10 from Acc1 (1) 2 T1 adds 10 to Acc2 (2) 3 T2 subtracts 10 from Acc2 (3) 4 T2 adds 10 to Acc1 (4) • In this order: Isolation is guaranteed – If T1 fails on operation (2) and is executed atomically, (1) is undone→ T2 sees correct data • If execution is interleaved (1)(3)(4)(2) and T1 fails on operation (2), then after (1) Acc1 contains (Initial value-10); T2 performs its operations and adds 10 to (Initial value-10); T1 fails on operation (2) and is undone, but T2 has operated on non-valid values. 14 / 20
  • 15. Transactional Systems Durability • The effect of a transaction that has successfully committed will last forever – Independently of any system fault 15 / 20
  • 16. Transactional Systems Transaction Properties and Mechanisms • Atomicity – Abort-rollback-restart – Recovery management and Commit protocols • Consistency – Integrity checking of the DBMS → at query execution time • Isolation – Concurrency control • Durability – Recovery management 16 / 20
  • 18. Transactional Systems Transactions and DBMS modules • Atomicity and durability – Reliability Manager • Isolation – Concurrency Control System • Consistency – Integrity Control System at query execution time 18 / 20
  • 19. Transactional Systems Next Topics... • Concurrency Control (Isolation) – Theory – DBMS adopted method • Reliability Control (Atomicity and Durability) – Commit protocols and 2PC – Logging and recovery on a single DBMS 19 / 20