MDEV-35189: Updating cache for INNODB_LOCKS et al is suboptimal - #3584
Conversation
|
|
mariadb-DebarunBanerjee
left a comment
There was a problem hiding this comment.
The improvement looks good. Added one minor suggestion.
On a independent note, it does seem to be a very good idea to get rid of the has table abstraction and pull in the search/insert code in different part of the code. This comment is not specific to this patch ... just a note.
| ut_ad((heap_no == 0xFFFF) == lock.is_table()); | ||
| if (heap_no == 0xFFFF) |
There was a problem hiding this comment.
I would prefer the condition to be if (lock.is_table()) which should be used uniformly in all places. heap_no is not relevant for table lock and to have the value as "0xFFFF" is good but we better not create functional dependency on it.
There was a problem hiding this comment.
The 0xFFFF is special only within this subsystem, returned by the function wait_lock_get_heap_no(). We have debug assertions in place (including the one that you quoted) to document this special rule. In non-debug builds, referring to heap_no == 0xFFFF should yield better performance than dereferencing lock, because that parameter is likely to reside in a register.
ha_storage_put_memlim(): Invoke my_crc32c() to "fold", and traverse the hash table only once. fold_lock(): Remove some redundant conditions and use my_crc32c() instead of ut_fold_ulint_pair(). trx_i_s_cache_t::add(): Replaces add_lock_to_cache(), search_innodb_locks(), and locks_row_eq_lock(). Avoid duplicated traversal of the hash table. Reviewed by: Debarun Banerjee
06082b9 to
ccb6cd8
Compare
Description
There are some performance issues with the cache that is underlying the
INFORMATION_SCHEMAtablesINNODB_LOCKS,INNODB_LOCK_WAITSandINNODB_TRX.ha_storage_put_memlim(): Invokemy_crc32c()to "fold", and traverse the hash table only once.fold_lock(): Remove some redundant conditions and usemy_crc32c()instead ofut_fold_ulint_pair().trx_i_s_cache_t::add(): Replacesadd_lock_to_cache(),search_innodb_locks(), andlocks_row_eq_lock(). Avoid duplicated traversal of the hash table.Release Notes
The performance of some InnoDB hash table operations was slightly improved.
How can this PR be tested?
Basing the PR against the correct MariaDB version
mainbranch.Some of this would be applicable to 10.5 as well, but we target 10.6 because of the MDEV-35190 dependency.
PR quality check