liveBook · Manning

Data inconsistency

As explained in Spring Start Here, Second Edition

A data inconsistency is a condition in which related stored or exchanged data does not agree or satisfy the application's consistency rules.

Data inconsistency occurs when related stored data no longer agrees or reflects a valid state. It can happen when one step in a multi-step operation succeeds but a later step fails. section 13.0 section 13.1

A money transfer goes wrong

A transfer subtracts money from one account, then adds it to another. If the second step fails, the money is lost; if it is mistakenly repeated, the destination account may receive too much. A transaction treats both changes as one unit: it commits both on success or rolls back changes if a step fails. section 13.0 section 13.1

Figure 13.1 An example of a use case. When transferring money from one account to another account, the app executes two operations: it subtracts the transferred money from the first account and adds it to the second account. We’ll implement this use case, and we need to make sure its execution won’t generate inconsistencies in data.

Trace the two account changes in a transfer and see why they must succeed or fail together. section 13.1

How Spring Start Here, Second Edition covers it

How deep it goes
Defines inconsistency through failed transfers and explains commit and rollback, but stops short of Spring implementation details.
Examples
Uses a wallet transfer with failed account updates and REST endpoint calls that may fail.
What you can do after
Understand how committing or rolling back a transaction can prevent partial changes from leaving data inconsistent.
How it connects
Connects data inconsistency to transactions, commit, rollback, and REST service failures.

Also explained in

Compare how 2 books explain data inconsistency →

Related concepts

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