NOTE

4.4 Replication Logs

Physical and logical change logs, statement- versus row-oriented replication, and why deterministic replay and schema/storage coupling matter.

Distributed SystemsCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. Why Replication Uses Logs

Replicas need a durable representation of state changes so another node can reproduce or receive those changes in the same logical history.

2. Log Styles

2.1 Physical Logs

Record low-level storage changes, such as modifications to pages or blocks. They can be efficient and exact for a specific storage engine, but are tightly coupled to physical format and engine version.

2.2 Logical Logs

Describe changes in terms of higher-level data operations rather than raw storage bytes.

Statement-Based

Replicate the original command or statement. This is compact, but replay must be deterministic. Functions based on current time, randomness, external state, or nondeterministic row order can produce different results.

Row-Based

Record inserted, updated, or deleted row values/identities. It avoids many statement nondeterminism problems but can create larger logs for operations that affect many rows.

3. Examples

MySQL binlog supports logical replication formats including statement and row modes, while InnoDB redo logs are physical/recovery-oriented logs. Redis AOF records commands for reconstruction. Other systems use purpose-built replicated logs or operation streams.

The important distinction is the abstraction level of the change record and whether another replica can replay it safely.

Loading helpful count