Suboptimal debug code in mem_init_buf() and mem_erase_buf()

Bug #1158154 reported by Laurynas Biveinis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.1
Won't Fix
Low
Unassigned
5.5
Triaged
Low
Unassigned
5.6
Triaged
Low
Unassigned
5.7
Fix Released
Low
Unassigned
Percona XtraBackup moved to https://jira.percona.com/projects/PXB
Fix Released
Undecided
Laurynas Biveinis
2.0
Fix Released
Undecided
Laurynas Biveinis
2.1
Fix Released
Undecided
Laurynas Biveinis

Bug Description

Callgrind simulated profiling of compact_compressed testcase on 5.6 debug configuration shows it spending ~56% of its cycles in ut_rnd_gen_ibool(), which is only called from UNIV_MEM_DEBUG-enabled mem_init_buf() / mem_erase_buf(), with a significant numbers of calls coming from UNIV_ZIP_DEBUG page_zip_validate().

Both mem_init_buf() and mem_erase_buf() fill the buffer with one of the two possible values, chosen randomly for each individual byte:

for each byte
       if (ut_rnd_gen_ibool()) {
                       *ptr = value1;
               } else {
                       *ptr = value2;
       }

This is very inefficient (reported upstream as http://bugs.mysql.com/bug.php?id=68725), and easy to replace with memset(), which would lose the randomness but would be much faster. Adding such memsets() to innodb56.patch shows compact_compressed testcase cycles to be cut 3x. There are similar results on 5.5 debug configuration as well.

Thus let's add this to XtraBackup InnoDB patches for improved testcase runtime.

Tags: upstream

Related branches

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

A highly unscientific wall time measurement showed the testcase runtime to be reduced from ~1h on compact_compressed testcase to 7min + 8mins for the split compact_compressed_8kb and _16kb.

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Reverting Fix Released and the milestone for 2.0 until innodb56.patch is fixed there too.

tags: added: upstream
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXB-1206

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1983

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.