Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 04 · From Scratch · Kafka · with code: Go · about 18 min to read

Play it as a journeyTutor comes with a plan

Kafka 07: Exactly Once

Exactly Once
Exactly Once · Open board

Sits under the project this build is part of, Build Your Own Kafka, From Scratch, filling in the one paragraph that lesson gives to exactly-once delivery.

Before you start. This series builds a small copy of Kafka, a program that keeps one shared, ordered notebook of everything that happened and lets any number of other programs read it at their own pace, instead of passing notes hand to hand. So far the notebook has copies on more than one machine called a broker, so one machine dying doesn’t lose it (Kafka: Replication and Durability), and many readers can split the work of going through it without re-reading each other’s pages (Kafka 05: Consumer Groups). A producer is any program adding new lines to it. A topic is the notebook’s name, split into ordered slices called partitions, one or more per broker. This lesson is about the one thing none of that fixes: a program can never be completely sure whether a line it tried to write actually landed.

Lesson 30 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1975: a messenger who can never come home certain
  • The one fact that won’t go away
  • The fix: give every line a number, and remember the highest one seen
  • Two limits on that fix
  • The bigger promise: a transaction, and an id that survives a restart
  • Drafts stay in the notebook: why a reader asks for “read committed”
  • Where the promise stops being Kafka’s problem

Terms it explains: broker, producer, topic, partitions, at-most-once, at-least-once, sequence number, idempotent, transaction, transactional id, read committed, loss, duplicates, producer id (PID), bumps its epoch, fenced, transaction coordinator, transaction marker, Last Stable Offset (LSO), lost outgoing line, lost reply, chosen by you, epoch, Last Stable Offset, idempotency key, do not commit, KIP-447.

Related paper

Review From Scratch