INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

Topic lessonTopic: Applied container, data, cost and AI labs

Exercise retries and idempotency|Avoid duplicate writes

A failure between committing a side effect and acknowledging a message can cause reprocessing.

What you will learn

Use durable business event IDs to distinguish replay from a first commit.

Prerequisite

The cases use fictional inputs.

Start the exercise →

What to predict

A failure between committing a side effect and acknowledging a message can cause reprocessing.

From conditions to the decision
From conditions to the decision1: First effect committed — Align conditions — A delivery is repeated. 2: A delivery is repeated — Compare outcomes — Committed ID is stored atomically. 3: Committed ID is stored atomically — Verify the decision — Decision123First effectcommittedA delivery isrepeatedCommitted ID isstored atomicallyDecisionFrom conditions to the decision1: First effect committed — Align conditions — A delivery is repeated. 2: A delivery is repeated — Compare outcomes — Committed ID is stored atomically. 3: Committed ID is stored atomically — Verify the decision — Decision123First effectcommittedA delivery isrepeatedCommitted ID isstoredatomicallyDecision
  1. First effect committed → A delivery is repeatedAlign conditions
  2. A delivery is repeated → Committed ID is stored atomicallyCompare outcomes
  3. Committed ID is stored atomically → DecisionVerify the decision
First effect committed
Yes / No
A delivery is repeated
Yes / No
Committed ID is stored atomically
Yes / No
Decision
Use durable business event IDs to distinguish replay from a first commit.

Compare the cases

Synthetic observations
CaseConditionsDecision
Trial 1First effect committed Yes, A delivery is repeated Yes, Committed ID is stored atomically YesThe repeated ID is recognized. Effective writes: 1.
Trial 2First effect committed Yes, A delivery is repeated Yes, Committed ID is stored atomically NoThe earlier write cannot be identified. This gives 2 effects.
Trial 3First effect committed Yes, A delivery is repeated No, Committed ID is stored atomically YesNo delivery is repeated. Effective writes: 1.
Trial 4First effect committed No, A delivery is repeated Yes, Committed ID is stored atomically YesThe next handling is the first commit. Effective writes: 1.

Acceptance and limits

Uses at most two deliveries of one synthetic ID and assumes atomic storage of result and ID. It omits real ordering, timing and concurrency.

Read the initial conditions and operational goal.

Change one condition and compare the decision.

Record the model boundary and outstanding checks.

Change a condition

Uses at most two deliveries of one synthetic ID and assumes atomic storage of result and ID. It omits real ordering, timing and concurrency.

The repeated ID is recognized. Effective writes: 1.

Check your understanding

Choose an option to see the result and explanation.

What happens in trial 1?
Read the answer and reason

Answer: The repeated ID is recognized. Effective writes: 1. · First effect committed Yes, A delivery is repeated Yes, Committed ID is stored atomically Yes → The repeated ID is recognized. Effective writes: 1.

What happens in trial 2?
Read the answer and reason

Answer: The earlier write cannot be identified. This gives 2 effects. · First effect committed Yes, A delivery is repeated Yes, Committed ID is stored atomically No → The earlier write cannot be identified. This gives 2 effects.

What happens in trial 3?
Read the answer and reason

Answer: No delivery is repeated. Effective writes: 1. · First effect committed Yes, A delivery is repeated No, Committed ID is stored atomically Yes → No delivery is repeated. Effective writes: 1.

Check, then explain in your own words

  1. Read the initial conditions and operational goal.
  2. Change one condition and compare the decision.
  3. Record the model boundary and outstanding checks.
Check your understanding: Use durable business event IDs to distinguish replay from a first commit.

Uses at most two deliveries of one synthetic ID and assumes atomic storage of result and ID. It omits real ordering, timing and concurrency.

Record the model boundary and outstanding checks.

Sources and conditions checked

The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.