liveBook · Manning

Dirty read

As explained in Microservices Patterns, Second Edition

A dirty read is a concurrency anomaly in which a transaction reads data written by another transaction before that write is committed.

A dirty read occurs when a transaction or saga reads data written by a saga that has not yet completed. Because sagas lack isolation across services, interleaving can expose temporary state and produce outcomes unlike any serial execution. section 9.3.1

Figure 9.8 Concurrent execution of these two sagas enables the Create Order Saga to succeed even though the Customer has insufficient available credit. This occurs because the Cancel Order Saga temporarily increases the available credit.
anomaly example scenario 2

A Cancel Order Saga temporarily increases available credit, allowing a concurrent Create Order Saga to succeed despite insufficient credit. section 9.3.1

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines the read-before-completion condition and illustrates its business impact, without detailing a dirty-read-specific prevention technique.
Examples
Uses concurrent Create Order and Cancel Order sagas, where temporary available credit lets an order succeed despite insufficient credit.
What you can do after
Understand how concurrent saga steps can expose uncommitted state and violate business invariants.
How it connects
Connects dirty reads to saga isolation and other serialization anomalies, including lost updates, nonrepeatable reads, phantom reads, and write skew.

Also explained in

Compare how 3 books explain dirty read →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.