Cohesive Systems logoCOHESIVE SYSTEMS

Weak Isolation Patterns

Weak Isolation Patterns are design techniques used when one ACID transaction or two-phase commit boundary is unavailable, too expensive, or not aligned with the business process.

As an architecture practice, these patterns are discussed in weak isolation patterns as architecture practice.

They do not make weak isolation disappear. They replace implicit transactional guarantees with explicit rules about ordering, idempotency, retry, recovery, compensation, reconciliation, and invariant preservation.

Common Patterns

  • Optimistic concurrency: use expected-version or etag checks to reject stale transitions.
  • Related-version checks: include versions, etags, read-model positions, policy versions, or causal metadata for related observations used during validation.
  • Idempotency records: remember processed inputs or operation identifiers so retries do not duplicate effects.
  • Transactional outbox: commit local state and publication responsibility in one local transaction, then publish asynchronously.
  • Transactional inbox: commit input receipt, deduplication state, and local effects in one local transaction before acknowledging completion to the delivery boundary.
  • Sagas and process managers: decompose long-running work into steps with explicit recovery, compensation, or forward progress.
  • Compensation: perform semantic follow-up actions when prior accepted work must be counteracted.
  • Reservations and escrow: allocate scarce capacity or rights in advance so later concurrent work cannot overdraw an invariant.
  • Reconciliation: detect divergence after the fact and repair, merge, compensate, or escalate.
  • Commutative or monotone updates: design updates so concurrent application can commute, merge, or converge, as in compatible CRDTs.
  • Durable workflows: persist process progress and decisions so partial work can resume coherently after failure.

Design Requirement

Each pattern must name the guarantee it replaces.

For example, an outbox replaces atomic commit between a database and broker with local atomicity plus asynchronous publication responsibility. An inbox complements it on the consumer side by making redelivery safe through local atomicity and deduplication. A saga replaces one atomic transaction with a process whose partial progress, compensation, and recovery semantics are explicit. A reservation replaces global serializable allocation with a bounded right to consume capacity later.

Weak isolation patterns must be checked against invariants. If the invariant is non-monotonic or requires a globally current view, avoiding coordination may be impossible without changing the model, accepting weaker semantics, or introducing escrow, reservation, or coordination at a narrower boundary.

The CALM theorem supplies a useful diagnostic: when adding facts can invalidate an earlier conclusion, the transition or projection is non-monotone and should not be treated as safely coordination-free. The model must then introduce coordination, versioned dependencies, pending state, reservation, reconciliation, or a deliberately weaker guarantee.

External References

Related concepts: weak isolation patterns as architecture practice, ACID, two-phase commit, isolation, coordination, CALM theorem, concurrency control, consistency models, commit boundaries, effects, ordering, idempotency, retry, recovery, durable execution, transactional outbox, outbox, transactional inbox, dual-write problem, CRDTs, invariants, business transactions.