Unit 2 of 14 · about 4 hours · explain, measure

Synchronous and asynchronous acknowledgement, replication logs, positions and lag

The local durability boundary from Storage engines and recovery is only one step in a replicated write. Separate received, persisted and applied positions before claiming what survives a crash or what a follower read can see.

You'll be able to

  • Specify receipt, persistence and application as separate acknowledgement boundaries.
  • Compare statement, physical and logical replication logs for deterministic replay and version coupling.
  • Measure position lag without misreporting it as elapsed-time staleness.

Covers

Synchronous versus asynchronous acknowledgementReplication logs, positions and lag
1

Read

In this order, only the parts listed

0 of 1 done

  1. DDIA, 2nd edition: acknowledgement and log representationDDIA 2e - Chapter 6 Replication and Chapter 10 Consistency Sections

    Chapter 6, Replication: Synchronous Versus Asynchronous Replication, pp. 200 to 201; Implementation of Replication Logs, pp. 206 to 208; Monitoring staleness, pp. 234 to 235

2

Focus on

  • Synchronous says the leader waits for a specified replica event, not that every copy is durable or queryable. Name that event and the replicas required.
  • Statement replay needs deterministic inputs and ordering. A physical log couples replicas to storage format; a logical log describes changes at a less storage-specific boundary.
  • Compare positions only within the same log lineage and in the same units. Byte positions, record counts and time lag are different metrics.
  • A follower can have received or persisted a suffix that it has not applied. Read routing must use the boundary relevant to visibility.
Common mistakes · 3
  • Inferring read visibility from a persistence acknowledgement without waiting for application.
  • Subtracting positions across diverged leader histories after failover.
  • Reporting zero position lag as zero wall-clock read latency or as proof that no writes were lost.
3

Try it yourself

Closed-book, before checking anything

In Python 3, model a single ordered log with six records and no failover. Give a follower received, persisted and applied positions of 6, 4 and 2. Assert that its durable backlog relative to the leader's durable position 6 is two records, while its unapplied backlog is four. Crash the follower by clearing volatile state, recover through position 4, then replay the suffix. Keep separate counters rather than a single lag value. These are record positions, not seconds.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.A follower confirms receipt in memory. Does that confirm survival of its process crash?Answer

    No. The contract must require stable storage if the acknowledgement is meant to survive that crash. Receipt alone is insufficient.

  2. 2.Can two replicas execute the same timestamp-producing statement and diverge?Answer

    Yes, if each evaluates a nondeterministic time function independently. Replicate its chosen result or otherwise make execution deterministic.

  3. 3.Why can a follower be 100 records behind without a known time lag?Answer

    Record positions do not encode elapsed time. You need write timing and an explicit visibility boundary; the workload may be bursty or idle.

You're done when

Your trace distinguishes the two-record durable backlog from the four-record unapplied backlog and shows which acknowledgement modes survive the injected crash.

Only when you can do this without notes.

Leads to

Notes

Resources · 1 for this unit, 15 more in the section

Also in this section