Protocol

Stage the mutation before committing it

The safest write is often the one you can inspect before it becomes a write.

About 1 min read

Before you use it

Use when
  • A bulk update can be computed in advance and a wrong write would be costly to reverse.

Keep this limit in mind

  • Staging does not remove concurrency, authorization or downstream-trigger risks; account for changes that can occur between preview and commit.

An idea to explore.

Try this idea.

Inspect the example, try the idea in your situation, then check your next move.

Keep reading

Why it matters

Split the operation into two phases. First generate the proposed changes into a temporary or reviewable form. Validate counts, key fields, invariants and representative examples. Only then apply the verified mutation set. Keep the staged artifact tied to the exact source snapshot so a later apply does not silently target different input.

Steps

  1. Generate the candidate changes without applying them to the authoritative target.
  2. Validate the candidate set against explicit business and data invariants.
  3. Freeze or fingerprint the candidate set and its source snapshot.
  4. Apply only the reviewed candidate set, then verify the result.

An example

For a mass business-partner update, produce the exact keys and new values first, compare them with source data, then execute that fixed set.

Check your result

The team can inspect exactly what will change before the authoritative state is modified.

Save and practise this idea

My learning

Read. Recall. Repeat.

Save this idea and return to it on any device.

Use email
Keep exploring

Connected ideas

You are readingStage the mutation before committing it

Evidence and sources
Supports

Google SRE describes two-phase mutation as storing proposed mutations temporarily, validating them, and applying them only after verification.

Two-phase mutation adds complexity and may not fit every storage system or transaction model.

Improve and Optimize Data Processing Pipelines · Idempotent and Two-Phase Mutations

All sources (1)
Edition and review

Version 0.1.0

No review details are supplied for this edition.

Read this idea as JSON · Release details