Atomicity is the guarantee against partial writes


Last Updated on Jan 22, 2021

Atomicity is one of the four safety guarantees that databases provide to avoid certain error scenarios and concurrency issues.

In databases that guarantee atomicity, the writes can be grouped together into an atomic transaction. If the transaction cannot be completed (committed) due to a fault, then the transaction is aborted and the database discards or reverts any writes made so far in the transaction.

Without atomicity, if an error were to occur halfway through a transaction, the system would be left in an intermediate state. It would be challenging to know which changes have taken effect and which haven't. Trying the transaction is risky as well because of the risk of making a change twice.

The database simplifies this problem with the guarantee of atomicity. Atomicity is the database's guarantee against partial writes.

If a transaction is aborted, the application can be sure that nothing changed in the database, and the transaction can be safely retried. In the absence of partial writes, we can remain assured that data invariants remain satisfied.


Related:

© 2022 Ambitious Systems. All Rights Reserved.