volume_mute

Transaction Atomicity

publish date2026/06/11 07:37:11.141023 UTC

volume_mute

A user makes an online flight booking. The system deducts the seat from the available inventory, charges the credit card, and sends a confirmation email. Halfway through, the network fails after the seat is reserved but before the payment is processed. What is the correct behaviour of a transaction processing system in this scenario?

Correct Answer

The entire transaction is rolled back - none of the operations (seat reservation, payment, confirmation) take permanent effect until all steps are completed successfully

Explanation

A database transaction is treated as a single atomic unit. All of the operations in a transaction must be completed before the database changes are made permanent. This ensures that failure of operations within the transaction does not lead to inconsistencies in the database. If the network fails mid-transaction, the seat reservation is not committed and the database remains unchanged - ensuring consistency.

Reference

Software Engineering, Ian Sommerville, 10th edition


Quizzes you can take where this question appears