liveBook · Manning

Lost update anomaly

As explained in Microservices Patterns, Second Edition

A concurrency anomaly in which one update overwrites another update made from the same previously read data without detecting the conflict.

A lost update occurs when two concurrent sagas read the same data and one overwrites the other’s update without detecting the conflict. Because sagas lack isolation across services, local transaction safeguards do not guarantee globally consistent outcomes. section 9.3.1

Create Order and Cancel Order

When these sagas execute concurrently, the Create Order Saga can overwrite a change to the Order state. The Cancel Order Saga can then release credit that was never reserved, leaving the system inconsistent. section 9.3.1

Figure 9.7 Concurrent execution of these two sagas leaves the system in an inconsistent state. The Create Order Saga overwrites the change to the Order state. The Cancel Order Saga releases credit that was never reserved.
anomaly example scenario 1

View the concurrent saga execution and its inconsistent outcome. section 9.3.1

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines the overwrite conflict and illustrates its consequences in concurrent sagas without detailing a prevention procedure.
Examples
Uses concurrent Create Order and Cancel Order sagas, where an overwrite accompanies credit being released without reservation.
What you can do after
Understand how concurrent saga execution can overwrite updates and violate business invariants.
How it connects
Connects lost updates to sagas, isolation, serialization anomalies, and application-level countermeasures.

Also explained in

Compare how 3 books explain lost update anomaly →

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.