-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Cache and Eviction
-
None
-
Storage Engines - Transactions
-
25.283
-
SE Transactions - 2026-07-03
-
3
Motivation
We don't currently know whether the shared disk hash table's bucket locks are contended. Adding a contention counter makes this observable so we can tell whether contention is a real problem and track it over time.
Approach
On each bucket-lock operation, call __wt_spin_trylock first, and only if it fails we increment the stat before calling __wt_spin_lock again. In this way we don't add any overhead on a successful path, and on failure the stat increment is hidden under the lock wait as we need a backoff anyway.
Alternative considered
__wt_spin_lock_track provides a richer metric—wait time spent acquiring the lock, plus an acquisition count—but it calls __wt_clock() twice on every acquisition, a plain contention counter is the cheaper choice for now; we can revisit the tracked path if we need to quantify wait time.