
The saga pattern coordinates a business transaction across services as a sequence of local database transactions, each committing immediately and releasing its locks. What the pattern gives up is the isolation half of ACID: nothing hides a saga's intermediate state, so other services and end users can read partially completed work such as a reserved stock row or a pending order. The trade-off follows the CAP theorem's availability-versus-consistency choice, leaving the system responsive and lock-free while consistency becomes eventual. The visible cost is a documented set of data anomalies — lost updates, dirty reads, and non-repeatable reads — along with duplicate processing when at-least-once message delivery re-triggers steps. This article explains where those anomalies come from, how semantic locks and their supporting countermeasures contain them, and how transitional state design and pending-state UI patterns let consumers interpret in-flight data safely. It is written for engineers on saga-based order, payment, and inventory flows who are observing strange reads or double-processing mid-saga.

In a traditional ACID transaction the I (isolation) guarantees that the intermediate state of the transaction is invisible to all other operations until the transaction either commits or aborts. A saga, by contrast, is a chain of independent local transactions. Each step writes to its own database and commits immediately, making its results observable by any other service the moment the commit succeeds. As the Microservices.io pattern catalog notes, this design “lacks isolation” and forces developers to introduce explicit isolation counter‑measures such as versioning, idempotency, or explicit locking【microservices.io】.
The saga still delivers the A, C, and D guarantees of ACID—atomicity, consistency, and durability—by ensuring that either all forward steps succeed or a series of compensating transactions (forward undo operations) reverses the work that has already been done【AWS Docs】,【Microsoft Docs】. Compensations are application‑level actions (e.g., a refund for a charged payment) rather than a database rollback, which is why a saga’s “rollback” is a semantic undo of business behaviour【Renekin Blog】.
The CAP theorem states that during a network partition a distributed system can guarantee only two of three properties: Consistency, Availability, and Partition tolerance. A saga deliberately chooses availability: it never holds distributed locks, and each service remains online even if one or more participants are unreachable. Conduktor’s glossary explains that this choice “allows services to continue operating and only reconciles state later via compensations or retries”【Conduktor】. Consequently the system embraces eventual consistency—the overall transaction is considered complete only after all steps have committed (or been compensated).
Because every intermediate write is visible, external services and end‑users can read partial saga state. This leads to classic data anomalies:
These anomalies are not hidden by the transaction manager; they must be handled in application logic (e.g., version checks, idempotent handlers, or semantic locks).
Version‑sensitive note: the phrase “atomic isolation” appears in Chris Richardson’s Microservices Patterns and Microsoft’s Azure Architecture Center as a way to describe the isolation guarantee that ACID transactions provide but sagas deliberately forgo【Conduktor】. Naming of related counter‑measures (semantic locks, version checks, etc.) varies across editions, so consult the latest documentation when implementing them.

In an e‑commerce system two customers concurrently place orders for the same product SKU.
stock = 95 and proceeds to the payment step.stock = 100, reserves 5 units and writes stock = 95 as well.When the payment for Saga A fails, its compensating step runs and writes back the original value stock = 100. Because the compensation does not know that Saga B has already reserved the same units, the restored value overwrites the later write, effectively “losing” Saga B’s reservation. The inventory record now shows an out‑of‑date quantity, and the second order may later be rejected. This pattern matches the lost‑update description in Azure’s saga documentation【https://learn.microsoft.com/en-us/azure/architecture/patterns/saga】.
A UI service polls the order microservice to display a customer’s current orders.
status = PENDING, and emits an event. The transaction commits, so the row is immediately visible.status = CANCELLED.Because the UI read the intermediate state before the compensation, the user briefly sees an order that never actually completes. Downstream services that react to the PENDING status (e.g., allocating shipping resources) may also act on data that is later rolled back, which is precisely the dirty‑read anomaly described by Microsoft’s saga pattern guide【https://learn.microsoft.com/en-us/azure/architecture/patterns/saga】.
Consider a saga that determines a discount based on current stock levels.
stock = 20 and decides to apply a 10 % discount because the product is abundant.stock = 5.The two reads of the same logical entity (stock) returned different values, leading to inconsistent business logic—an instance of non‑repeatable or fuzzy reads, again noted by Azure’s saga pattern documentation【https://learn.microsoft.com/en-us/azure/architecture/patterns/saga】.
When two independent sagas read overlapping inventory data (e.g., stock > 0) and each decides it can fulfill a request, the combined effect may violate a business invariant such as “do not sell more than available.” Spring‑Boot‑oriented saga tutorials call this write‑skew and suggest optimistic locking or explicit version checks to avoid it【https://dkwebsolutions.medium.com/understanding-the-saga-pattern-managing-distributed-transactions-in-spring-boot-microservices-4ca82685b310】.
These anomalies surface only in distributed deployments; a single‑database test suite will not reproduce them because database‑level isolation cannot span service boundaries. Consequently, debugging teams must look for symptoms such as orders that appear then disappear, inventory counts that jump, or discount calculations that differ between saga steps. Mitigation must be built into the application layer (semantic locks, version checks, idempotent commands) rather than relying on database configuration alone.

A semantic lock is an application‑level lock that lives on the business entity itself. Instead of acquiring a distributed lock across services, the service that owns the record writes a status flag (e.g., PENDING, RESERVED, IN_PROGRESS) inside the same local transaction that performs the substantive update. The flag therefore becomes part of the entity’s persisted state and is visible to any downstream consumer that reads the table. Because the lock is created atomically with the business write, no separate coordination protocol is needed, and the service remains fully available – the lock is “soft” in shared data rather than a hard mutex held across network calls.
PENDING.APPROVED, REJECTED, CONFIRMED, etc.). If a compensation is required, the status is cleared or set to CANCELLED.Because the lock is stored in the same row, concurrent sagas that attempt to process the same entity will see the provisional status and can decide to skip, wait, or reject the request. This prevents lost‑updates, dirty reads, and duplicate processing without sacrificing the high availability that the saga pattern promises.
In the classic order saga, the Order Service creates an Order row with status = PENDING. The orchestrator immediately issues a ReserveCredit command to the Payment Service. While the payment is pending, any other service that queries the order must treat the PENDING row as provisional – it cannot ship items, issue invoices, or display a final confirmation. When the payment replies, the Order Service atomically transitions the row to APPROVED (credit reserved) or REJECTED (insufficient funds). The lock is released automatically because the status is no longer provisional. This flow matches the guidance in the microservices.io saga pattern, which recommends explicit status values such as pending, confirmed, and cancelled to make intermediate states safe for readers【source】(https://microservices.io/patterns/data/saga.html).
Any service or saga that encounters a record in a provisional state must obey the following contract:
| Provisional status | Required action |
|---|---|
PENDING / RESERVED | Do not perform irreversible work. Either wait for a terminal status, return a “try later” response, or skip the operation. |
IN_PROGRESS (business‑level lock) | Treat the entity as locked; reject conflicting commands or queue them for later. |
By respecting this contract, downstream services avoid making decisions that could be undone by a later compensation.
Because the lock is written to the participant’s local database, it does not introduce a distributed lock that would block other services. The data remains readable (albeit with a provisional flag), preserving the saga’s hallmark of high availability while providing a bounded form of isolation. This approach is described in AWS’s prescriptive guidance on saga choreography as “semantic locking” applied before a saga step【source】(https://docs.aws.amazon.com/prescriptive-guidance/latest/cloud-design-patterns/saga-choreography.html) and aligns with the terminology introduced in Richardson’s Microservices Patterns and Microsoft’s Azure saga documentation, whose exact phrasing may differ across versions.

Microsoft’s Azure saga guidance groups the remaining anti‑anomaly techniques into a small toolbox. Each tool attacks a specific isolation flaw that appears when a saga’s intermediate state is visible to other services.
Design the business operation so the effect is order‑independent – e.g. balance += amount instead of overwriting a total. Because any sequence of identical commutative updates yields the same final state, concurrent sagas cannot race on update order.
Targets: lost‑update anomalies.
Place the most “dangerous” write first and keep the following reads inside the same retryable, idempotent transaction. A classic ordering is reserve‑stock → charge‑card. By shrinking the window in which other services can observe a half‑finished entity, dirty reads are prevented, and the transaction’s idempotency guarantees safe retries.
Targets: dirty reads and non‑repeatable reads.
Before applying a change, fetch the current record and compare it with the version you observed earlier. If the data has moved, abort and restart the step. The same verification must be performed in compensation handlers, ensuring they act on the latest state rather than stale caches.
Targets: lost updates and dirty reads (by avoiding stale writes).
Every write appends a monotonically increasing version number (or timestamp) and an audit entry. Update logic rejects a request whose expected version is older than the stored one, and compensation logic rejects if the entity’s version exceeds the compensation’s target. This enforces a total ordering of changes and makes lost‑update collisions visible immediately.
Targets: lost updates; also aids debugging of any anomaly.
Treat the countermeasure list as a menu rather than a fixed checklist.
When the business risk of an inconsistency is high (e.g., financial ledger entries), prefer a stronger concurrency model such as a distributed transaction; otherwise, a saga with the above toolkit is sufficient.
Note: The exact naming and grouping of these techniques vary between Azure documentation editions and Richardson’s saga book. Always verify the current terminology before codifying it in internal standards.
Sources: Microsoft Azure Architecture patterns – saga counter‑measures list1, additional anomaly definitions and mitigation mapping2.

When a saga writes an intermediate entity—e.g., a reserved‑stock row—other services can read it before the saga finishes. To keep that visibility safe, the record must expose an explicit status field that captures the contract between the owner and its consumers. Typical values are PENDING (the operation has been attempted but may still roll back), CONFIRMED (the forward step succeeded and will not be undone), and CANCELLED (a compensation has been applied). Every downstream handler treats PENDING as “the transaction may still roll back” and refrains from irreversible actions such as shipping or analytics aggregation 【1†https://encore.dev/articles/saga-pattern-microservices】.
PENDING row, but after the saga either reaches CONFIRMED or runs a compensation, the final state converges to a consistent view.PENDING for a bounded window while a retry or external call completes. During this window the owning service tracks the pending saga ID and expects it to resolve soon 【2†https://codelit.io/blog/saga-pattern-distributed-transactions】.UPDATE stock SET status='RESERVED' WHERE id=? AND status='PENDING'.CONFIRMED or CANCELLED.ReleaseInventory, RefundCustomer) must be idempotent: repeated execution produces the same outcome and does not double‑undo the effect 【7†https://www.conduktor.io/glossary/saga-pattern-for-distributed-transactions】.WHERE status!='CANCELLED').PENDING row, a later rollback cleanly reverts the business effect without leaving stray side‑effects.The set of status values is an API contract owned by the team that owns the saga’s data model. Downstream features—shipping, reporting, analytics—should be defined to act only on CONFIRMED (or CANCELLED when a compensation is final). By restricting exposure to committed states, the architecture prevents transitional data from leaking into irreversible processes, preserving overall system correctness while still benefitting from the saga’s lock‑free availability.

When an orchestrator does not receive a reply within its timeout, it resends the command. Because most message brokers provide at‑least‑once delivery, the original step may already have succeeded while the acknowledgment was lost. The second attempt must therefore be harmless, otherwise the saga can double‑charge, double‑reserve, or double‑refund.12
order‑123:reserve‑stock) or use an explicit request‑ID supplied by the client.INSERT INTO processed_messages(message_id, result)
VALUES ($1, $2)
ON CONFLICT (message_id) DO NOTHING
RETURNING result;
The INSERT … ON CONFLICT DO NOTHING pattern guarantees that duplicates are ignored in a single, atomic statement.3
Many downstream services already support idempotency keys (e.g., Stripe, PayPal). Pass a deterministic key such as saga:{id}:step:{n}; the provider stores the key and returns the same charge object on retries, eliminating duplicate side effects.45
Compensations must follow the same discipline. Before releasing stock or issuing a refund, check the current state (WHERE released = false) or record a compensation log and skip the operation if it already exists. This “stateless compensation” approach ensures that repeat retries are no‑ops.6
If a message cannot be cleanly deduplicated—e.g., missing a reliable key or the downstream service lacks idempotency support—route it to a quarantine or dead‑letter queue. Human operators can investigate without causing endless automatic retries that would otherwise amplify inconsistency.1
Delivery semantics differ between brokers and even between configurations of the same broker. Kafka, for instance, offers exactly‑once semantics only with transactional producers, while its default is at‑least‑once.7 Teams must verify the current guarantees in their broker’s documentation and adjust timeout/retry policies accordingly.
By persisting deduplication keys, enforcing idempotent APIs, making compensations safe to repeat, and isolating unrecoverable duplicates, a saga can tolerate the inevitable duplicate messages without corrupting business data.

During a saga the order record lives in a PENDING or PROCESSING status. The UI should never render the order as Confirmed; instead show a clear “Processing” label and, if appropriate, a spinner or progress bar. This prevents a dirty read from reaching the user and aligns the presentation layer with the saga’s eventual‑consistency guarantees.
Pending orders must be filtered out of analytics pipelines, shipping queues, and other services that only act on fully‑committed data. Using an explicit status column (pending, approved, failed) enables downstream consumers to ignore rows that might later be rolled back — a practice documented as a best‑practice for saga‑driven UIs【2†url】.
If a compensation flow runs (e.g., inventory reservation failed and the payment was refunded), the UI should surface a concise error message such as “We could not reserve the items; your payment has been refunded.”. Including the saga identifier in admin panels lets support staff trace the exact step where the failure occurred — a recommended pattern for operational visibility【2†url】.
Microservices.io identifies three common ways a client learns the final saga outcome — each with distinct latency and resource trade‑offs【1†url】:
OrderApproved or OrderRejected event arrives.orderId; the client periodically calls GET /orders/{orderId} to inspect the status.orderId, the service later notifies the client via WebSocket, webhook, or Server‑Sent Events.Choosing among them depends on the UI’s tolerance for wait time versus implementation complexity.
When the service writes the request to an outbox and returns 200 OK, the client should treat the operation as in‑flight. Recommended UI tactics include:
creating/pending.approved or failed.failed — as described in the outbox pattern guide【5†url】.Presenting a pending record as final constitutes a dirty read delivered straight to the user, violating the isolation half of ACID that sagas deliberately relax. By mirroring the saga’s state machine in the UI—showing pending, confirming only on Approved, and clearly flagging failures—applications keep the user experience consistent with the underlying consistency model and avoid misleading data exposure.
https://learn.microsoft.com/en-us/azure/architecture/patterns/saga ↩ ↩2 ↩3
https://singhajit.com/saga-pattern-distributed-transactions/ ↩ ↩2 ↩3
Singh Ajit, Inbox (processed‑messages) table for consumers (2025). ↩
Singh Ajit, Idempotency keys at the API boundary (2025). ↩
Encore.dev, Saga pattern – idempotent external calls (2024). ↩
System Design Academy, Ensuring idempotency for saga steps and compensations (2025). ↩
Apache Kafka Documentation, Exactly‑once semantics (2026). ↩