Distributed SystemsVol. 5 · Part V
0 / 0

Shelves / Distributed Systems

DS·73

Distributed Transactions

Keeping data consistent across services and databases: two-phase commit step by step (and why it blocks), three-phase commit, XA and its practical limits, modern 2PC over consensus groups (Spanner, Percolator, CockroachDB), sagas with compensation, orchestration versus choreography, saga design techniques (pivot steps, semantic locks, countermeasures), durable execution engines (Temporal), and the transactional outbox and change data capture (Debezium) that make event publication reliable. Code in Java, Go, Python, SQL and Elixir.

29 topics · ~22 min read · 30-question quiz
Updated Suggest a correction

Start here: one change, several databases

The problem

Moving ₹300 from Asha's account in one database to Ravi's in another must happen entirely or not at all. Each database can make its own part atomic, but nothing local makes both parts atomic together: one could commit and the other fail. There are two families of answers: make the databases agree before anyone commits (two-phase commit), or let each commit separately and undo with compensating actions if a later step fails (sagas).

Two-phase commit

A coordinator asks every participant to prepare: do all the work, write it durably, keep the locks, and vote yes or no. Only if every vote is yes does it tell them all to commit.

Python
a.execute("UPDATE accounts SET balance = balance - 300 WHERE name = 'asha'")
b.execute("UPDATE accounts SET balance = balance + 300 WHERE name = 'ravi'")
a.execute("PREPARE TRANSACTION 'transfer-1:a'"); b.execute("PREPARE TRANSACTION 'transfer-1:b'")   # phase 1: both vote yes
a.execute("COMMIT PREPARED 'transfer-1:a'"); b.execute("COMMIT PREPARED 'transfer-1:b'")           # phase 2
Text
1) phase 1 done, both databases prepared; balances seen by others meanwhile: (1000, 0)
   phase 2 done: (700, 300)

It's atomic: a prepared transaction can no longer fail on its own, so once all have prepared, commit is certain. The weakness shows when the coordinator dies between the phases:

Text
2) coordinator died after phase 1; in-doubt transactions in bank_a: [('transfer-2:a',)]
   another payment from Asha's account: blocked, gave up after 3.0 s
   coordinator recovered and committed: (500, 500) | the payment now: ok after 0.0 s

A participant that has voted yes must not decide alone: maybe the other side committed, maybe not. So it waits, holding locks, until the coordinator returns (the lab shows it survives even a database restart). 2PC is blocking: it trades availability for atomicity. It's used inside systems that control every participant (Spanner, CockroachDB, and XA transactions between a database and a broker), with the coordinator's decision itself replicated by consensus so it can't simply vanish.

Sagas

Microservices usually can't hold each other's locks. A saga is a sequence of local transactions, each committed immediately, with a compensating transaction for each step that undoes it semantically:

Text
3) a saga: reserve stock, then charge the card; if the charge fails, run the compensating step
   order 1: reserved 3
   order 1: charged ₹180
   order 1: CONFIRMED
   order 2: reserved 4
   order 2: card declined
   order 2: compensation: released 4, CANCELLED
   stock left: 7 (10 − 3; order 2's reservation was undone)

No locks are held between steps and each service stays independent. The costs: intermediate states are visible (for a while order 2's 4 units looked sold), compensations must always eventually succeed, every step and compensation must be idempotent (they'll be retried), and the saga's progress must be stored so a crashed orchestrator can resume.

Two-phase commit Saga
Atomicity Real, all-or-nothing Eventual, via compensation
Isolation Locks held until commit None between steps
Failure of the coordinator Participants block Resume from saved state
Coupling Participants must support prepare Only local transactions and events
Typical home Inside one distributed database Across microservices

How deep to go in distributed transactions

Volume 17 defines six mastery levels. For this chapter they look like this; the chapter aims at L3 everywhere, and its lab at L4.

Level What you can do
L1 Explain why cross-service changes aren't atomic, and 2PC and sagas at a high level
L2 Implement a saga with compensations and idempotent steps; use the outbox
L3 Explain 2PC failure modes, XA, choreography versus orchestration, and saga isolation countermeasures
L4 Diagnose stuck in-doubt transactions, abandoned sagas, failed compensations and anomalies
L5 Choose transaction boundaries and saga designs for a system; workflow engines (Temporal, Step Functions)
L6 Design platform-wide transaction and workflow infrastructure with auditing and reconciliation

The problem

Atomicity across boundaries

A single database gives you ACID transactions: either all of a transaction's writes happen or none do (Vol. 4 ch. 59). Once a business operation spans several databases or services, there's no single transaction manager:

  • Place order: Orders DB inserts an order, Payments charges a card, Inventory reserves stock, Shipping schedules delivery.
  • Transfer money between accounts stored in two shards.
  • Update a database and publish an event to Kafka (the dual-write problem, chapter 68).

If one step fails after others succeeded, the system is left inconsistent: a charged card with no order, reserved stock nobody will ship. There are two families of solutions:

Approach Idea Isolation Availability
Atomic commit (2PC and relatives) All participants vote, then commit or abort together Strong (locks held until decision) Blocks if the coordinator fails; every participant must be up
Sagas Sequence of local transactions; on failure, run compensating transactions for completed steps None between steps (intermediate states visible) High: each step is local and independent

Two-phase commit (2PC)

The protocol

A coordinator (transaction manager) drives participants (resource managers: databases, queues):

Phase 1: prepare (voting)

  1. The coordinator sends PREPARE to every participant.
  2. Each participant does everything needed to guarantee it can commit: writes changes and a prepare record to its durable log, holds locks. Then it votes YES (prepared, "I promise to commit if asked, even after a crash") or NO.

Phase 2: commit (decision)

  1. If all voted YES, the coordinator durably writes COMMIT to its own log (the commit point) and sends COMMIT to all. If any voted NO or timed out, it writes and sends ABORT.
  2. Participants apply the decision, release locks and acknowledge. The coordinator retries until every participant acknowledges, forever if necessary.
coordinatorOrders DBPayments DB ① PREPARE ② YESYES ③ log COMMITcommit point ④ COMMIT ⑤ ack in doubt:locks held
Two-phase commit. Phase 1 asks every participant to prepare and vote; phase 2 broadcasts the decision. Once a participant votes yes it's 'in doubt' and must wait for the coordinator's decision, holding its locks, even if the coordinator crashes.

Why 2PC blocks

The critical weakness: after voting YES, a participant can't decide on its own. It promised to commit if told, so it can't abort unilaterally; it doesn't know whether others voted NO, so it can't commit unilaterally. If the coordinator crashes after collecting votes but before sending the decision, prepared participants are in doubt and must hold their locks until the coordinator recovers. Other transactions touching those rows block too.

  • 2PC is safe (never inconsistent) but not live under coordinator failure: it's a blocking protocol.
  • Participants can ask each other ("cooperative termination"): if any participant knows the decision or voted NO, they can proceed, but if all voted YES and none got the decision, they still block.
  • In-doubt transactions occasionally need manual resolution (heuristic commit/abort by an operator), which can violate atomicity.

Other costs:

  • Latency: two round trips plus several forced log writes (fsyncs) on the critical path.
  • Availability: the transaction fails if any participant is down; availability is the product of all participants'.
  • Locks held across network round trips reduce throughput.
  • Coordinator as a single point of failure, unless the coordinator's log is itself replicated.

Three-phase commit

3PC (Skeen, 1981) adds a pre-commit phase so participants can tell whether a commit decision might have been made, letting them make progress after a coordinator crash. But it assumes a synchronous network with bounded delays and no partitions; with network partitions it can reach inconsistent decisions. It's rarely used in practice. The real fix for coordinator blocking is to replicate the coordinator with consensus, as modern databases do.

XA

X/Open XA (1991) standardises 2PC between a transaction manager and resource managers (databases, JMS brokers). Java's JTA exposes it (UserTransaction, XAResource), with transaction managers such as Narayana (WildFly/Quarkus), Atomikos, and Bitronix (abandoned). Databases expose prepared transactions: PostgreSQL PREPARE TRANSACTION / COMMIT PREPARED (disabled by default: max_prepared_transactions = 0), MySQL XA START … XA PREPARE … XA COMMIT, Oracle, SQL Server (MSDTC).

SQL
-- PostgreSQL: the participant side of 2PC
BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 'A';
PREPARE TRANSACTION 'tx-7f3a';      -- durable, locks held, survives restart; session can now disconnect
-- … later, the coordinator decides:
COMMIT PREPARED 'tx-7f3a';          -- or ROLLBACK PREPARED 'tx-7f3a'
-- In-doubt transactions are visible in pg_prepared_xacts; forgotten ones hold locks and block VACUUM.

Why XA is rare in modern architectures:

  • Microservices own their data behind APIs; you can't enlist another team's database in your transaction, and HTTP/gRPC services aren't XA resources.
  • Kafka doesn't support XA; most NoSQL stores and cloud services don't either.
  • Blocking, latency, and operational complexity (in-doubt transactions, heuristic outcomes).
  • Recovery depends on the transaction manager's log, which is usually inside an app server.

XA still appears within monoliths that span two databases or a database plus a JMS broker. Even there, the outbox pattern is usually simpler.

2PC done right: inside distributed databases

Distributed SQL databases run 2PC internally, across shards, but make every participant and the coordinator highly available via consensus (each shard is a Raft/Paxos group), which removes the blocking problem: if a coordinator node dies, its replicated state lets another replica finish the protocol.

  • Spanner: 2PC across Paxos groups, with TrueTime timestamps for external consistency.
  • Percolator (Google, 2010; used by TiDB/TiKV): 2PC built on a key-value store, with a primary lock whose state is the commit point; other locks point to it, so any reader can resolve an abandoned transaction by checking the primary.
  • CockroachDB: a transaction record on one range is the commit point; parallel commits let it commit in roughly one consensus round trip by treating "all writes succeeded" as an implicit commit.
  • FoundationDB: optimistic concurrency with a central (replicated) resolver.

So "avoid distributed transactions" really means avoid 2PC across independently owned systems. Inside one database that does it for you, cross-shard transactions are fine, at some latency cost.

Sagas

The idea

A saga (Garcia-Molina and Salem, 1987, originally for long-lived database transactions) splits a business transaction into a sequence of local transactions T1, T2, …, Tn, each committed independently in its own service. Each Ti (except possibly the last) has a compensating transaction Ci that semantically undoes it. If Tk fails, the saga runs Ck−1, …, C1 in reverse.

T1 createorder PENDING T2 reservestock T3 charge ✕card declined T4 ship, T5 approve(not reached) C2 releasestock C1 cancelorder REJECTED compensate in reverse
A saga for placing an order. Each step is a local transaction in its own service. When payment fails at step 3, compensations run in reverse for the completed steps: release the stock, then cancel the order.

Compensation is semantic, not a rollback

A compensating transaction can't erase history: other transactions may have seen or acted on the intermediate state. It applies a business-level undo:

  • Charge → refund (fees may not come back; the customer sees both lines on their statement).
  • Reserve stock → release stock.
  • Send confirmation email → send cancellation email.
  • Book a flight → cancel (maybe with a penalty).

Compensations must be idempotent and retryable until they succeed: a saga that can't compensate is stuck in an inconsistent state. They should be commutative with late-arriving forward steps where possible (a "cancel" that arrives before the "reserve" must still win).

Saga structure: compensatable, pivot, retriable

Chris Richardson's classification of steps:

  • Compensatable transactions: can be undone (reserve stock, create pending order).
  • Pivot transaction: the point of no return; once it commits, the saga will complete (e.g. charging the card, or a step that can't be compensated, such as sending goods).
  • Retriable transactions: after the pivot, steps that are guaranteed to eventually succeed with retries (they must not fail for business reasons).

Order steps so that compensatable steps come first, then the pivot, then retriable steps, and put steps most likely to fail early.

Lack of isolation and countermeasures

Sagas are ACD (no I): other transactions see intermediate states. Anomalies:

  • Lost updates: one saga overwrites another's change.
  • Dirty reads: another transaction reads stock reserved by a saga that will later compensate.
  • Fuzzy reads: a saga sees data change between its steps.

Countermeasures:

Countermeasure How
Semantic lock Mark records with a state (PENDING, APPROVAL_PENDING); other operations treat them specially (reject, wait, or warn)
Commutative updates Design operations so order doesn't matter (debit/credit amounts rather than set balance)
Pessimistic view Reorder steps to reduce business risk (e.g. increase available credit only in the last, retriable step)
Reread value Before updating, verify the record hasn't changed (optimistic version check)
Version file Record operations as they arrive so out-of-order ones can be reordered
By value Choose per request: high-risk requests use distributed transactions or stricter flows, low-risk use sagas

Choreography and orchestration

Two ways to coordinate saga steps:

choreography (events) Orders Inventory Payments OrderCreated StockReserved PaymentFailed no central brain; flow is implicit orchestration (commands) orchestrator Inventory Payments Reserve Charge explicit state machine; easy to trace
Choreography versus orchestration. In choreography, services react to each other's events with no central controller. In orchestration, a saga orchestrator sends commands to each service and decides the next step from their replies.
Choreography Orchestration
Coordination Each service listens for events and decides what to do next A central orchestrator (saga manager) sends commands and tracks state
Coupling Loose at deploy time; but the workflow is implicit, spread over services Services know nothing of the saga; the orchestrator knows all participants
Visibility Hard to see the whole flow or current status; needs tracing The orchestrator's state is the status; easy to query and debug
Risk Cyclic dependencies, "event spaghetti", hard to change flows Orchestrator can become a "god service" if it absorbs business logic
Best for Simple flows with few steps; broadcasting facts to many listeners Complex flows, many steps, timeouts, human tasks, compensation logic

Most systems use both: orchestration within a business process, events (choreography) to inform other domains of outcomes.

Durable execution

Writing an orchestrator by hand means persisting saga state, handling timeouts, retries, crashes and redelivery: easy to get wrong. Durable execution engines let you write the saga as ordinary code and make it crash-proof by persisting every step's result in an event history and replaying the function to rebuild state after a failure:

  • Temporal (and its predecessor Cadence): workflows in Go, Java, Python, TypeScript, .NET, Ruby, PHP; activities do side effects with retries; workflows must be deterministic (no direct I/O, randomness or wall-clock time inside workflow code; use SDK APIs).
  • Restate, DBOS (durable execution backed by Postgres), Inngest, AWS Step Functions (JSON/YAML state machines), Azure Durable Functions, Camunda / Zeebe (BPMN), Netflix Conductor (now Orkes).
// Go: Temporal workflow implementing an order saga with compensations
func OrderSaga(ctx workflow.Context, o Order) (err error) {
    ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
        StartToCloseTimeout: 30 * time.Second,
        RetryPolicy: &temporal.RetryPolicy{MaximumAttempts: 5,
            NonRetryableErrorTypes: []string{"CardDeclined", "OutOfStock"}},
    })
    var compensations []func(workflow.Context) error
    defer func() {
        if err != nil {                                     // run compensations in reverse, even after crashes
            dctx, _ := workflow.NewDisconnectedContext(ctx)
            for i := len(compensations) - 1; i >= 0; i-- { _ = compensations[i](dctx) }
        }
    }()

    if err = workflow.ExecuteActivity(ctx, ReserveStock, o).Get(ctx, nil); err != nil { return err }
    compensations = append(compensations, func(c workflow.Context) error {
        return workflow.ExecuteActivity(c, ReleaseStock, o).Get(c, nil) })

    if err = workflow.ExecuteActivity(ctx, ChargeCard, o).Get(ctx, nil); err != nil { return err }   // pivot
    return workflow.ExecuteActivity(ctx, ScheduleShipping, o).Get(ctx, nil)                         // retriable
}

The transactional outbox

The dual-write problem, again

Every saga step and every event-driven service must change its database and publish a message. Doing both separately is unsafe:

  • DB commit, then publish fails or the process crashes: the event is lost; downstream never learns.
  • Publish, then DB commit fails: downstream acts on a change that never happened.

The pattern

  1. In the same local transaction as the business change, insert the message into an outbox table.
  2. A separate relay reads the outbox and publishes to the broker, then marks rows as sent (or deletes them).
  3. Publication is at-least-once (the relay may crash after publishing, before marking), so consumers must be idempotent (chapter 74), with the outbox row ID as the message ID.
order service one DB transaction orders (row) outbox (event) relaypoll or CDC Kafkaat-least-once consumers dedup by id
Transactional outbox. The service writes the business row and the outbox row in one local transaction. A relay (polling, or change data capture reading the database log) publishes outbox rows to the broker, at least once; consumers deduplicate by message ID.

Relay options

Relay How Notes
Polling publisher SELECT … FROM outbox WHERE sent_at IS NULL ORDER BY id LIMIT 100 FOR UPDATE SKIP LOCKED, publish, mark Simple; adds DB load and polling latency; multiple relays need SKIP LOCKED or leader election
Transaction log tailing (CDC) Read the database's replication log (PostgreSQL logical decoding, MySQL binlog) for outbox inserts Low latency, no polling load; needs CDC infrastructure (Debezium, with its outbox event router transform)
Postgres pg_logical_emit_message Write the event straight into the WAL without a table No table to clean; needs CDC to read it
Framework support Spring Modulith event publication registry, Eventuate Tram, MassTransit transactional outbox, NServiceBus outbox, Wolverine (.NET) Handles relay, retries, and cleanup

Ordering: relay in outbox ID order per aggregate, and publish with the aggregate ID as the Kafka key so per-entity order is preserved. Clean up sent rows (or partition the outbox table by time and drop old partitions).

Inbox pattern (the consumer side): record received message IDs in an inbox table in the same transaction as processing (chapter 68), which gives effectively-once processing.

Listen to yourself: an alternative where the service publishes an event first and updates its own state by consuming its own event (event sourcing style). This avoids dual writes but adds read-your-writes delays.

Change data capture

Change data capture (CDC) streams every committed change from a database's log as events, without changing application code:

  • Debezium (Red Hat; runs on Kafka Connect, standalone Debezium Server to other sinks, or embedded): connectors for PostgreSQL (logical decoding with pgoutput), MySQL/MariaDB (binlog), MongoDB (change streams), SQL Server, Oracle, Db2, Cassandra and more. It emits change events with before, after, op (c/u/d/r) and source metadata (LSN, transaction ID), takes an initial snapshot, then streams.
  • Cloud services: AWS DMS, Google Datastream, Azure Data Factory, and native streams (DynamoDB Streams, MongoDB change streams, Cosmos DB change feed, Spanner change streams).

Uses:

  • Outbox relay (Debezium's outbox event router).
  • Keeping derived systems in sync: search indexes (Elasticsearch, OpenSearch), caches, data warehouses and lakes (Vol. 4 ch. 63), read models (CQRS).
  • Strangler-fig migrations: stream a legacy database's changes into new services.
  • Audit trails.

Caveats:

  • Raw table CDC exposes your internal schema as a public contract. Prefer the outbox for domain events, and raw CDC for internal data replication.
  • Replication slots in PostgreSQL retain WAL until consumed; a stopped connector can fill the primary's disk (monitor slot lag, and cap retained WAL with max_slot_wal_keep_size, PostgreSQL 13+; PostgreSQL 17 adds slot synchronisation to standbys for failover).
  • Schema changes need coordination with consumers (Schema Registry, chapter 67).
  • Delivery is at-least-once (replays after connector restarts), so consumers must be idempotent.
JSON
{
  "name": "orders-outbox",
  "config": {
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "database.hostname": "orders-db", "database.dbname": "orders",
    "database.user": "debezium", "database.password": "${file:/secrets/db.properties:password}",
    "plugin.name": "pgoutput", "slot.name": "orders_outbox", "topic.prefix": "orders",
    "table.include.list": "public.outbox",
    "transforms": "outbox",
    "transforms.outbox.type": "io.debezium.transforms.outbox.EventRouter",
    "transforms.outbox.route.by.field": "aggregate_type",
    "transforms.outbox.table.field.event.key": "aggregate_id"
  }
}

Choosing

Situation Approach
Data inside one database (even sharded, distributed SQL) Use its transactions
A service updating its DB and notifying others Transactional outbox (+ idempotent consumers)
Business process across services Saga, preferably orchestrated with a durable execution engine; idempotent steps and compensations
Two resource managers in one legacy application server XA is possible; consider outbox instead
Need strict atomic isolation across services Rethink boundaries: data that must change atomically probably belongs in one service

Lab: two-phase commit and sagas, measured

PostgreSQL 16 on one machine (max_prepared_transactions = 20), two databases for 2PC and one database whose three tables stand in for three services for the saga. Python with psycopg 3.

Experiment 1: what 2PC costs

1,000 transfers, as one local transaction in one database and as 2PC across two:

Text
one local transaction median 0.38 ms | 2PC across two databases median 1.08 ms

2PC nearly tripled the time on the same machine: two prepares (each a durable WAL flush), two commits (two more flushes) and four round trips instead of one commit. Across a network the extra rounds add RTTs, and locks are held for all of it, so contention rises too. That's the price of real atomicity.

Experiment 2: an in-doubt transaction outlives a restart

A participant prepared, the coordinator vanished, and then PostgreSQL itself was restarted:

Text
after restarting PostgreSQL: in-doubt transactions [('stuck:a',)]; is Asha's row still locked? yes, still blocked

A prepared transaction is a durable promise: the database can't drop it on restart, so its row locks came back with it. Forgotten prepared transactions also block vacuum (the oldest xmin can't advance) and can lead to transaction ID wraparound warnings. PostgreSQL ships with max_prepared_transactions = 0 for this reason; if you enable it, monitor pg_prepared_xacts and have a runbook for resolving in-doubt transactions.

Experiment 3: sagas need durable state

500 orders through reserve-then-charge; 10% of cards are declined; the orchestrator crashes right after 5% of reservations:

Text
no saga state:                       27 crashes, units reserved but never paid for: 78, stock accounted for: True
saga state persisted and resumed:    27 crashes, units reserved but never paid for: 0,  stock accounted for: True

Without recorded progress, every crash abandoned a reservation: 78 units sat locked away from customers, with no record of why. Writing the saga's current step to a table before each step let the restarted orchestrator find the 27 unfinished sagas and drive them forward (here their charges succeeded; a decline would have compensated). Declined cards were compensated immediately in both runs, so the books always balanced. Durable execution engines (Temporal, AWS Step Functions, Camunda, Restate) do this record-and-resume for you.

Experiment 4: the missing isolation

20 units of stock; 40 sagas start at lunchtime and all reserve before any charge completes; half the cards are declined:

Text
20 customers told 'sold out', 12 orders confirmed, 8 units left unsold

Reservations that would later be compensated were visible as "sold", so 20 customers were turned away while 8 units ended up unsold. Saga countermeasures for missing isolation include semantic locks (show "pending" rather than "sold out" and let customers wait or join a waitlist), reordering steps (charge or authorise first, reserve after, so the step most likely to fail runs before others see effects), commutative updates, and rereading values before a final step.

Try it yourself

  1. Kill the coordinator in experiment 1 between the two COMMIT PREPARED calls. Write the recovery tool that reads a coordinator log and finishes or rolls back each in-doubt transaction.
  2. Reorder the saga to authorise the card first, then reserve, then capture. Rerun experiment 4.
  3. Rewrite the saga as choreography: each service publishes events on JetStream and reacts to the others. Where does the "what's the state of order 42?" answer live now?
  4. Implement the saga in Temporal and kill the worker mid-saga.

Revision sheet: distributed transactions

Key ideas

  • The problem: atomic change across independent resources; local transactions alone can't provide it.
  • 2PC: prepare (vote, durable, locks held) and commit/abort; blocking on coordinator failure; XA standard; 3PC isn't used in practice; Paxos/Raft-replicated coordinators (Spanner, CockroachDB parallel commits).
  • Sagas (Garcia-Molina and Salem, 1987): sequence of local transactions with compensations; forward recovery (retry) and backward recovery (compensate); pivot transactions.
  • Orchestration vs choreography: central coordinator with explicit state, or services reacting to events; orchestration is easier to observe and change.
  • Missing isolation countermeasures: semantic locks, commutative updates, pessimistic ordering, reread values, version files.
  • Infrastructure: outbox for reliable step events, idempotent steps, persisted saga state, durable execution engines.
  • CDC feeds events from databases without dual writes.

Numbers to remember

  • Lab: 2PC 1.08 ms vs 0.38 ms local; prepared transactions survived a restart with locks; no saga state left 78 units stranded after 27 crashes, persisted state left 0; missing isolation turned away 20 customers while 8 units went unsold.

Pitfalls

  • Enabling prepared transactions without monitoring pg_prepared_xacts.
  • 2PC across services owned by different teams.
  • Compensations that can fail or aren't idempotent.
  • Saga state only in memory.
  • Ignoring the visibility of intermediate states in the UX.

Glossary

  • Coordinator / participant: 2PC roles.
  • In-doubt transaction: prepared but not yet told the outcome.
  • Compensating transaction: semantic undo of a committed step.
  • Pivot transaction: the saga step after which it must go forward.
  • Orchestrator: component directing a saga's steps.
  • Choreography: services coordinating through events.