When One Machine Is Not Enough
Which Thing Happened First
Last timeGetting Machines To Agree
Separate machines cannot agree on what time it is, so ordering events by their timestamps quietly produces wrong answers, and the fix is to count rather than to read a clock.
Two writes arrive for the same record. One carries the timestamp 14:02:07.113 and
the other 14:02:07.109. The second one is kept because it is later. This is wrong
often enough to matter, and the reason is that the two numbers were read from two
different clocks.
Clocks disagree, and they lie about it
A machine's clock drifts because its oscillator is imperfect. Corrections arrive
over the network, which has an unknown delay, so the correction itself is
approximate. The result is that two machines in the same rack commonly read tens
of milliseconds apart.
Worse, a clock can move backwards. When a correction decides the machine is
ahead, the clock is set back, and an event happening after another can be stamped
with an earlier time. Any logic that assumes timestamps increase has a bug
waiting for that moment.
The lesson stops here
7 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