Bug #38769 Backup: write table data does not stop iterating when all drivers are handled

Submitted: 13 Aug 2008 13:00 Modified: 29 Sep 2008 23:14
Reporter: Jørgen Løland Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S5 (Performance)
Version:6.0.7-backup OS:Any
Assigned to: Jørgen Løland CPU Architecture:Any

[13 Aug 2008 13:00] Jørgen Løland
Description:
In data_backup.cc#write_table_data, the for-loop that adds drivers to the scheduler or the inactive list iterates 256 times regardless of the number of drivers:

444  // add unknown "at end" drivers to scheduler, rest to inactive list
445
446  for (uint n=0; n < 256; ++n)
447  {
448    Snapshot_info *i= info.m_snap[n];
449
450    if (!i)
451      continue;

Very little processing is done in the extra iterations; because of lines 450-451, each loop is short-circuited. Hence, this is a pure performance issue.

How to repeat:
Code investigation

Suggested fix:
Replace 
"for (uint n=0; n < 256; ++n)"
with
"for (uint n=0; n < info.snap_count(); ++n)

Nothing in Image_info::add_snapshot indicates that there can be holes in m_snap so that there can be drivers at m_snap[n] where n >= snap_count
[13 Aug 2008 13:03] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/51526

2683 Jorgen Loland	2008-08-13
      Bug#38769 - Backup: write table data does not stop iterating when all drivers are handled
      
      Fix: stop iteration that adds drivers to the scheduler when there are no more drivers in Image_info.m_snap
[13 Aug 2008 13:06] Jørgen Løland
The attached patch fixes the problem (checked with single-stepping in gdb). All backup tests passed with the fix.
[1 Sep 2008 15:24] Rafal Somla
Good to push.
[2 Sep 2008 7:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/53036

2688 Jorgen Loland	2008-09-02
      Bug#38769 - Backup: write table data does not stop iterating when all drivers are handled
            
      Fix: stop iteration that adds drivers to the scheduler when there are no more drivers in Image_info.m_snap
[2 Sep 2008 7:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/53037

2688 Jorgen Loland	2008-09-02
      Bug#38769 - Backup: write table data does not stop iterating when all drivers are handled
            
      Fix: stop iteration that adds drivers to the scheduler when there are no more drivers in Image_info.m_snap
[28 Sep 2008 19:23] Øystein Grøvlen
Pushed to 6.0 main for 6.0.8
[29 Sep 2008 23:14] Paul DuBois
No user impact. No changelog entry needed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.044 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.