liveBook · Manning

Log replication

As explained in Think Distributed Systems

Log replication is the process of copying log entries across nodes so that they maintain a consistent replicated log.

Log replication copies an ordered sequence of operations across nodes. Unlike state-based replication, which sends the current state or a diff, it sends the operations that produced that state. With deterministic state machines, replicas starting alike and applying identical operations in identical order reach the same result. section 8.4.4 section 10.8

A useful system model separates the replicated log from the application state machine:

  • A leader accepts client operations and propagates log entries to the other nodes. section 10.6.2
  • After an entry is committed, the platform-level protocol hands it to the application-level state machine, which applies it. section 10.6.1
  • In Raft, each term begins with leader election and continues with log replication; term numbers reject messages from older leaders. section 10.6.2

A counter replicated by operations

A counter begins at zero and receives increment-by(2), followed by increment-by(3). State-based replication might send counter = 2 and counter = 5; log-based replication sends the two operations. Every deterministic replica can therefore reproduce the same final state by applying the same sequence. section 8.4.4

Figure 10.3 Raft’s log abstraction
A diagram of a number of indexes

AI-generated content may be incorrect.

Use the Raft log abstraction to connect committed entries with safe application to the replicated state machine. section 10.6.1

Figure 10.4 The Raft consensus protocol advances in terms, with each term consisting of a leader-election phase and a log-replication phase.
A diagram of a diagram of a diagram

AI-generated content may be incorrect.

Use the term diagram to visualize how Raft alternates leader election with log replication. section 10.6.2

How Think Distributed Systems covers it

How deep it goes
Explains operation ordering, leadership, commitment, and term fencing, while deferring detailed Append Entries mechanics.
Examples
Uses a replicated counter and Raft’s leader-election and log-replication phases as concrete examples.
What it assumes
Assumes deterministic state machines and identical starting state, while introducing replication and consensus roles.
What you can do after
Evaluate/understand how ordered operations produce consistent application state across replicated nodes.
How it connects
Connects state machine replication, deterministic state machines, leader election, consensus, and state-based replication.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Think Distributed Systems. The section links point to the parts of the book it draws on.