Peering and recovery stepper
In the book: Chapter 35
Lab
Peering and recovery stepper
Step through three stories of one PG with three replicas and watch the PeeringState machine, the up and acting sets and the PG logs.
pg 1.7 · peering · epoch 45
up[0,1,2]
acting[0,1,2]
6/8 · merge_log rewinds the divergent entry
merge_log sees that 40'4 is not in the authoritative history: rewind_divergent_log drops it and _merge_divergent_entries decides the object's fate. D did not exist before, so it is removed; E and B become missing on osd.0.
Follows: PGLog::merge_log, rewind_divergent_log, _merge_divergent_entries
- Reset
- Started
- Primary
- Peering
- GetInfo
- GetLog
- GetMissing
- WaitUpThru
- WaitActingChange
- Active
- Activating
- WaitLocalRecoveryReserved
- WaitRemoteRecoveryReserved
- Recovering
- WaitLocalBackfillReserved
- WaitRemoteBackfillReserved
- Backfilling
- Recovered
- Clean
- ReplicaActive
- Stray
- ToDelete
osd.0 primary
last_update 41'5
- 5'1 A
- 5'2 B
- 5'3 C
- 41'4 E to recover
- 41'5 B to recover
missing: {E, B}
removed by the log merge: D
osd.1 replica
last_update 41'5
- 5'1 A
- 5'2 B
- 5'3 C
- 41'4 E
- 41'5 B
osd.2 replica
last_update 41'5
- 5'1 A
- 5'2 B
- 5'3 C
- 41'4 E
- 41'5 B
What happened so far
- e40 The primary logs a write
- e41 osd.0 is gone; osd.1 leads
- e41 New writes in the new interval
- e45 osd.0 returns as primary
- e45 The log of osd.1 wins
- e45 merge_log rewinds the divergent entry
Follows:
src/osd/PeeringState.h :: struct Started, Primary, Peering, GetInfo, GetLog, GetMissing, Active, …the state machine and its nestingsrc/osd/PeeringState.cc :: start_peering_interval, should_restart_peering, build_priorwhen peering restarts and which past OSDs to asksrc/osd/PeeringState.cc :: find_best_info, choose_acting, calc_replicated_actingthe authoritative log and the acting setsrc/osd/PeeringState.cc :: proc_master_log, proc_replica_log, activatemerging logs and activating the replicassrc/osd/PGLog.cc :: merge_log, rewind_divergent_log, _merge_divergent_entries, proc_replica_logmerging and rewinding divergent entriessrc/osd/PrimaryLogPG.cc :: start_recovery_ops, recover_primary, recover_replicas, recover_backfilllog-based recovery and backfill