Consider the following timeline of a write operation Write0 to a three member replica set:
Note
For simplification, the example assumes:
- All writes prior to Write0 have been successfully replicated to all members.
- Writeprev is the previous write before Write0.
- No other writes have occurred after Write0.
| Time | Event | Most Recent Write | Most Recent w: "majority" write |
|---|---|---|---|
| t0 | Primary applies Write0 | Primary: Write0
Secondary1: Writeprev
Secondary2: Writeprev
|
Primary: Writeprev
Secondary1: Writeprev
Secondary2: Writeprev
|
| t1 | Secondary1 applies write0 | Primary: Write0
Secondary1: Write0
Secondary2: Writeprev
|
Primary: Writeprev
Secondary1: Writeprev
Secondary2: Writeprev
|
| t2 | Secondary2 applies write0 | Primary: Write0
Secondary1: Write0
Secondary2: Write0
|
Primary: Writeprev
Secondary1: Writeprev
Secondary2: Writeprev
|
| t3 | Primary is aware of successful replication to Secondary1 and sends acknowledgement to client | Primary: Write0
Secondary1: Write0
Secondary2: Write0
|
Primary: Write0
Secondary1: Writeprev
Secondary2: Writeprev
|
| t4 | Primary is aware of successful replication to Secondary2 | Primary: Write0
Secondary1: Write0
Secondary2: Write0
|
Primary: Write0
Secondary1: Writeprev
Secondary2: Writeprev
|
| t5 | Secondary1 receives notice (through regular replication mechanism) to update its snapshot of its most recent w: "majority" write | Primary: Write0
Secondary1: Write0
Secondary2: Write0
|
Primary: Write0
Secondary1: Write0
Secondary2: Writeprev
|
| t6 | Secondary2 receives notice (through regular replication mechanism) to update its snapshot of its most recent w: "majority" write | Primary: Write0
Secondary1: Write0
Secondary2: Write0
|
Primary: Write0
Secondary1: Write0
Secondary2: Write0
|