Caution: the Architecture Guide is not updated in lockstep with the code base and is not necessarily correct or complete for any specific release.
This page describes the current nested locking hierarchy of WiredTiger.
Cache and Eviction locks
cache->evict_pass_lock
→
TRY cache->evict_walk_lock
→
cache->evict_queue_lock
→
queue->evict_lock
cache->evict_walk_lock
→
cache->evict_pass_lock
→
cache->evict_queue_lock
→
queue->evict_lock
cache->evict_queue_lock
→
queue->evict_lock
NOTE: A different locking order is used for evict_pass_lock and evict_walk_lock.
Log locks
log_slot_lock
→
log_fs_lock
log_slot_lock
→
log_writelsn_lock
WRITE log_remove_lock
→
READ debug_log_retention_lock
NOTE: Some functions expect log_slot_lock to be acquired, then they temporarily release it and re-acquire it.
Checkpoint and Schema locks
checkpoint_lock
→
schema_lock
→
WRITE table_lock
checkpoint_lock
→
schema_lock
→
READ table_lock
checkpoint_lock
→
schema_lock
→
api_lock
checkpoint_lock
→
schema_lock
→
metadata_lock
→
READ table_lock
checkpoint_lock
→
schema_lock
→
turtle_lock
checkpoint_lock
→
schema_lock
→
WRITE dhandle_lock
checkpoint_lock
→
turtle_lock
NOTE: Checkpoint and schema locks are mostly used via WT_WITH_*_LOCK and the functions are covered with WT_ASSERT_SPINLOCK_OWNED statements which make the code easier to read.