Bug #75504 btr_search_guess_on_hash makes found block young twice?
Submitted: 14 Jan 2015 12:52 Modified: 22 Jan 2015 14:51
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: ahi, innodb, performance

[14 Jan 2015 12:52] Laurynas Biveinis
Description:
btr_search_guess_on_hash(...)
{
...
	if (!has_search_latch) {

		if (!buf_page_get_known_nowait(
			latch_mode, block, BUF_MAKE_YOUNG,
			__FILE__, __LINE__, mtr)) {
...
	if (!has_search_latch && buf_page_peek_if_too_old(&block->page)) {

		buf_page_make_young(&block->page);
	}
...
	return(TRUE);
}

buf_page_get_known_nowait makes the page young, and so does the direct call later. I cannot see any change of has_search_latch or block between the two.

How to repeat:
Code analysis

Suggested fix:
Remove the buf_page_peek_if_too_old / buf_page_make_young calls. Then make the former static to buf0buf.cc.
[16 Jan 2015 19:38] Laurynas Biveinis
The patch uploaded to bug 75534 includes a fix for this bug.
[19 Jan 2015 16:21] MySQL Verification Team
What version of server contains this code ???
[22 Jan 2015 5:40] Laurynas Biveinis
Some of the versions containing this code are: 5.7.5, 5.6.22, 5.5.41. Are we looking at different places perhaps?
[22 Jan 2015 14:51] MySQL Verification Team
Your code analysis is true.

However, I do not opine that this is a serious performance issue, particularly since the second block of code has additional condition which would make page setting young again obsolete.

Still, additional code cleaning is welcome. Verified as reported.

Thank you for your contribution.