| Bug #77957 | search_latch_timeout doesn't make sense after supporting multi AHI latch | ||
|---|---|---|---|
| Submitted: | 6 Aug 2015 9:31 | Modified: | 12 Aug 2015 17:16 |
| Reporter: | zhai weixiang (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
| Version: | 5.7.8 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[6 Aug 2015 15:22]
MySQL Verification Team
Thank you for your report. I have analyzed carefully the code that you are quoting and it does seem that there is some unnecessary code left for cleaning up. Verified.
[7 Aug 2015 12:02]
Laurynas Biveinis
Related entry in 5.7.9 release notes: "InnoDB: After disabling the adaptive hash index feature, an adaptive hash index latch was unnecessarily obtained and released . (Bug #21407023)"
[12 Aug 2015 17:16]
Daniel Price
Posted by developer: Fixed as of the upcoming 5.7.9, 5.8.0 releases, and here's the changelog entry: Code that provided a timeout mechanism intended to reduce adaptive hash index search latch (btr_search_latch) contention was removed. The code became obsolete after the introduction of adaptive hash index search system partitioning in MySQL 5.7.8. Thank you for the bug report.
[14 Dec 2015 10:47]
Laurynas Biveinis
See also bug 79631

Description: After supporting multi ahi latch in MySQL 5.7.8, btr_search_latch is always released in function row_search_mvcc if shortcut search is chosen. grep the source code: $grep 'search_latch_timeout' -R * --color Binary file CMakeFiles/innobase.dir/row/row0sel.cc.gcno matches handler/i_s.cc: (longlong) row->trx_search_latch_timeout, true)); include/trx0i_s.h: ulint trx_search_latch_timeout; include/trx0i_s.h: /*!< search_latch_timeout in trx_t */ include/trx0trx.h: ulint search_latch_timeout; row/row0sel.cc: trx->search_latch_timeout = BTR_SEA_TIMEOUT; trx/trx0trx.cc: trx->search_latch_timeout = BTR_SEA_TIMEOUT; trx/trx0i_s.cc: row->trx_search_latch_timeout = trx->search_latch_timeout; Since we never hold a persistent btr_search_latch, I think the code bellow may be redundant quoted from row_search_mvcc: if (trx->has_search_latch #ifndef INNODB_RW_LOCKS_USE_ATOMICS && rw_lock_get_writer( btr_get_search_latch(index)) != RW_LOCK_NOT_LOCKED #endif /* !INNODB_RW_LOCKS_USE_ATOMICS */ ) { /* There is an x-latch request on the adaptive hash index: release the s-latch to reduce starvation and wait for BTR_SEA_TIMEOUT rounds before trying to keep it again over calls from MySQL */ trx_search_latch_release_if_reserved(trx); trx->search_latch_timeout = BTR_SEA_TIMEOUT; } How to repeat: Read the code Suggested fix: remove the redundant code.