Fix Bug #59683 :InnoDB latch deadlock detector/violation debug code is very slow
There are two main pain points, one is lookup by thread id for sync_thread_t and the other is to do a lookup by latch or level in sync_thread_t::levels. Changed the sync_thread_t::levels lookup and reserve operation from O(N) to O(1). Pure lookups are still O(N), the main change for pure lookup is that we no longer need to search up to SYNC_THREAD_N_LEVELS but only up to the number of slots actually ever used ie. it is possible some were used in the past but are now on the free list. If the in_use count drops to 0 we reset the free list too. Overload the sync_level_t::level field to track the free list. If sync_thread_t::latch == NULL then sync_thread_t::level contains the ordinal value of the previous free entry. rb://580 Approved by Jimmy Yang.
Showing
This diff is collapsed.
Please register or sign in to comment