Bug #69422 small performance impact with heap block debugging info in release builds
Submitted: 7 Jun 2013 9:18 Modified: 16 Dec 2013 17:49
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:5.6.12 OS:Any
Assigned to: CPU Architecture:Any

[7 Jun 2013 9:18] Shane Bester
Description:
I don't think we need memory block debugging details on release builds. It impacts by a tiny amount on every heap creation, but is not used unless innodb dies due to some corruption.  Here's the call stack of one of the small time-consuming parts:

mysqld.exe!ut_strlcpy_rev - ut0mem.cc
mysqld.exe!mem_heap_create_block+0x155 - mem0mem.cc:371
mysqld.exe!page_cur_tuple_insert+0x78 - page0cur.ic:267
mysqld.exe!btr_cur_optimistic_insert+0x39c - btr0cur.cc:1416
mysqld.exe!row_ins_clust_index_entry_low+0x42a - row0ins.cc:2481
mysqld.exe!row_ins_clust_index_entry+0x92 - row0ins.cc:2875
mysqld.exe!row_ins+0x1a9 - row0ins.cc:3186
mysqld.exe!row_ins_step+0x101 - row0ins.cc:3311
mysqld.exe!row_insert_for_mysql+0x19f - row0mysql.cc:1312
mysqld.exe!ha_innobase::write_row+0x2e2 - ha_innodb.cc:6567
mysqld.exe!handler::ha_write_row+0xca - handler.cc:7200
mysqld.exe!write_record+0x9c - sql_insert.cc:1875
mysqld.exe!mysql_insert+0x98b - sql_insert.cc:1026
mysqld.exe!mysql_execute_command+0x1819 - sql_parse.cc:3394
mysqld.exe!mysql_parse+0x1ec - sql_parse.cc:6185
mysqld.exe!dispatch_command+0x6c4 - sql_parse.cc:1332
mysqld.exe!do_command+0x166 - sql_parse.cc:1036
mysqld.exe!do_handle_one_connection+0x133 - sql_connect.cc:977
mysqld.exe!handle_one_connection+0x39 - sql_connect.cc:893

The above call stack responsible for ~0.6% cpu in my simple benchmark.

How to repeat:
read the code, benchmark innodb dml, breakpoint on mem_heap_create_block.
[16 Dec 2013 17:49] Daniel Price
Fixed as of 5.6.16, 5.7.4, and here's the changelog entry:

 Heap block debugging information ("file_name", "lineno"), used for
logging diagnostics, would appear in release builds. This information
should only appear in debug builds. 

Thank you for the bug report.
[3 Feb 2014 11:03] Laurynas Biveinis
5.6$ bzr log -r 5672
------------------------------------------------------------
revno: 5672
committer: Thirunarayanan B<thirunarayanan.balathandayuth@oracle.com>
branch nick: r-5.6
timestamp: Mon 2013-12-09 10:32:10 +0530
message:
  Bug #16924719	 SMALL PERFORMANCE IMPACT WITH HEAP BLOCK
  			DEBUGGING INFO IN RELEASE BUILDS
  Problem:
   	Memory block debugging details (file_name, lineno) is present on
  release builds.It impacts by a tiny amount on every heap creation.
  
  Solution:
  	Removed file_no, lineno of block details in release builds.
  
  	[Approved by Marko #rb 4022]
[3 Feb 2014 11:04] Laurynas Biveinis
5.6$ bzr log -r 5674
------------------------------------------------------------
revno: 5674
committer: Thirunarayanan B<thirunarayanan.balathandayuth@oracle.com>
branch nick: r-5.6
timestamp: Mon 2013-12-09 11:56:43 +0530
message:
  Bug #16924719	 SMALL PERFORMANCE IMPACT WITH HEAP BLOCK
  			DEBUGGING INFO IN RELEASE BUILDS
  	Fixed build problem in debug mode.
[3 Feb 2014 11:41] Laurynas Biveinis
5.6$ bzr log -r 5690
------------------------------------------------------------
revno: 5690
committer: Thirunarayanan B<thirunarayanan.balathandayuth@oracle.com>
branch nick: r-5.6
timestamp: Mon 2013-12-16 12:29:20 +0530
message:
  Bug #16924719	 SMALL PERFORMANCE IMPACT WITH HEAP BLOCK
  			DEBUGGING INFO IN RELEASE BUILDS
  Problem:
   	Memory block debugging details (file_name, lineno) is present on
  release builds.It impacts by a tiny amount on every heap creation.
  
  Solution:
  	Removed the file_name, line no parameters from mem_heap_create_func()
  	and mem_alloc_func() in release builds.
  
  	[Approved by Marko #rb 4022]