ContentsThe library

Moving Data Without Losing Any

The Sender Cannot Tell Which Half of the Journey Failed

Last timeThe Four Ways It Goes Wrong

A sender that gets no answer cannot know whether the request or the response was lost. Everything about delivery guarantees follows from that one gap, including why exactly once is not on offer.

The trace in the previous lesson showed a duplicate produced by two parties

both behaving correctly. This lesson works out why that is unavoidable, which

determines everything built in the rest of the course.

The gap that cannot be closed

A sender transmits a request and waits. Nothing comes back. Write down exactly

what it knows.

It knows it sent something. It knows it has heard nothing. That is the whole

list.

Three different worlds produce that observation. The request never arrived, so

nothing happened. The request arrived and failed, so nothing happened, but for

a different reason. The request arrived and succeeded, and the response was

lost on the way back. From the sender, these are identical: the same silence,

for the same duration, with the same logs.

FIG 1What the sender can conclude, and where it stops
Two outcomes and one decision that must be taken without the information that would settle it. The shape of the diagram is the argument: the three worlds converge on one node, and everything after that node is the same regardless of which world is real. This is why no amount of care at the sender helps, and why the repair has to live at the destination.

Retry or do not

Since the ambiguity cannot be resolved, the sender picks an error to prefer.

Retry, and if the work had already been done, it is now done twice. The

guarantee is at least once: every request is handled, possibly more than once.

Do not retry, and if the work had not been done, it never will be. The

guarantee is at most once: no request is handled twice, and some are not

handled at all.

Almost everything should choose at least once, for an asymmetric reason. A

duplicate is detectable at the destination and repairable by the next three

lessons. A loss is often undetectable, because the destination cannot miss what

it never heard of, and unrepairable once the source has moved on.

The lesson stops here

3 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01Nothing Crashed, Nothing Alerted, and the Total Is Short by Nine Hundred
  2. 02The Sender Cannot Tell Which Half of the Journey Failedyou are here
  3. 03Run It Twice on Purpose and See What Breaksopening only
  4. 04Two Writes, and the Order Between Them Is the Whole Designopening only
  5. 05The Row Was Saved at 10:04 and Became Visible at 10:06opening only
  6. 06Start the Stream Before You Read the Old Rowsopening only
  7. 07Tuesday's Number Arrived on Friday and Tuesday Is Already Publishedopening only
  8. 08The Check Takes Four Minutes a Day and Almost Nobody Runs Itopening only

Read alongside