liveBook · Manning

Atomicity

As explained in Grokking Software Architecture

A transaction property requiring its operations to succeed or fail as a single indivisible unit.

Atomicity means a transaction succeeds or fails as one indivisible unit: partial changes are rolled back, leaving the data as though the transaction never happened. section 8.2.1

The last pair of sneakers

A purchase must both deduct the last pair from inventory and create an order. If payment times out or power fails halfway through, atomicity rolls back the changes; the sneakers return to the shelf. section 8.2.1

Atomicity within one database does not make a database write and a network publish happen together reliably. Saving an order but losing the event can leave downstream workers unaware; publishing first can announce an order that was never saved. The Transactional Outbox Pattern is identified as a way to address this dual-write risk. section 7.5.1

How Grokking Software Architecture covers it

How deep it goes
Defines all-or-nothing behavior with a purchase example and flags dual-write failure, while deferring the outbox pattern.
Examples
Uses a last-pair sneaker purchase and an order-save versus event-publish failure to illustrate atomicity risks.
What you can do after
Understand why partial database updates must be rolled back and why publishing an event alongside a database write poses a separate risk.
How it connects
Connects atomicity to ACID, relational databases, transactions, event brokers, and the Transactional Outbox Pattern.

Also explained in

Compare how 19 books explain atomicity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.