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.
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 contentsThis 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