About
An Atomic commit is a commit that implements atomicity for a transaction.
Either all the tasks in a transaction must happen, or none of them. The transaction must be completed, or else it must be undone (rolled back).
A transaction groups task (such as SQL statements) so that they are either all committed, which means they are applied to the data, or all rolled back, which means they are undone from the data.
Atomicity (or atomicness) is one of the ACID transaction properties. In an atomic transaction, a series of operations either all occur, or nothing occurs.
It means that either all changes within a single transaction occur or none of them occur.
The transactions should be atomic even if the transaction is interrupted by an operating system crash or power failure.
Implementation
Atomic commit is implemented via a rollback journal
Hardware and Atomicity
Atomic commit cannot be implemented with the hardware disk because:
- a transaction may write data in different sector (different place)
- writing a single sector is serial and takes a finite amount of time
- the action can't therefore be instantaneous
Therefore the application needs to creates the illusion of atomic commit (ie the transactions appear to be atomic)