Bug #28806 Running SHOW TABLE STATUS during high INSERT load crashes server
Submitted: 31 May 2007 13:26 Modified: 16 Jun 2007 13:00
Reporter: Victoria Reznichenko Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.1.18 OS:Any
Assigned to: Ramil Kalimullin CPU Architecture:Any

[31 May 2007 13:26] Victoria Reznichenko
Description:
If you have tables with many partitions (5 tables with 1024 partitions each) and have INSERT load (50 threads insert data to the same table) and while INSERTs are running you do SHOW TABLE STATUS MySQL server crashes.

Here is a backtrace:
[Switching to Thread 1162717536 (LWP 17762)]
0x000000000082502b in ha_myisam::get_auto_increment ()
(gdb) bt
#0  0x000000000082502b in ha_myisam::get_auto_increment ()
#1  0x00000000006cb272 in ha_partition::get_auto_increment ()
#2  0x00000000006ca486 in ha_partition::info ()
#3  0x00000000006e6792 in get_schema_tables_record ()
#4  0x00000000006e5ebc in get_all_tables ()
#5  0x00000000006ecbba in get_schema_tables_result ()
#6  0x000000000063633b in JOIN::exec ()
#7  0x00000000006366aa in mysql_select ()
#8  0x0000000000631f79 in handle_select ()
#9  0x00000000005fcb61 in execute_sqlcom_select ()
#10 0x00000000005f3aaa in mysql_execute_command ()
#11 0x00000000005f9970 in mysql_parse ()
#12 0x00000000005f24e6 in dispatch_command ()
#13 0x00000000005f20ef in do_command ()
#14 0x00000000005f0bb4 in handle_one_connection ()
#15 0x0000003243b060aa in start_thread () from /lib64/tls/libpthread.so.0
#16 0x00000032432c5b43 in clone () from /lib64/tls/libc.so.6
#17 0x0000000000000000 in ?? ()

How to repeat:
1. create table with many partitions
2. run ./testcase that inserted data into partitioned table
3. while testcase is running in the new connection run "SHOW TABLE STATUS"

after 3-5 minutes MySQL server crashes.
[7 Jun 2007 8:15] 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/28267

ChangeSet@1.2545, 2007-06-07 13:15:01+05:00, ramil@mysql.com +3 -0
  Fux for bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
  
  Problem: getting an autoincrement value for a partition table in the ::info() method we call
  the get_auto_increment() for all partitions. That may cause a problem for at least MyISAM
  tables that rely on some table state (in this particular case table->naxt_nuber_field is 
  set to 0 in the mysql_insert() and we get a crash). 
  Moreover, calling get_auto_increment() is superfluous there.
  
  Fix: use ::info(HA_STATUS_AUTO) calls to get autoincrement values for partitions instead of
  get_auto_increment() ones in the ha_partition::info().
[7 Jun 2007 10:50] 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/28281

ChangeSet@1.2545, 2007-06-07 15:50:13+05:00, ramil@mysql.com +3 -0
  Fix for bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
  
  Problem: getting an autoincrement value for a partition table in the ::info() method we call
  the get_auto_increment() for all partitions. That may cause a problem for at least MyISAM
  tables that rely on some table state (in this particular case table->naxt_nuber_field is 
  set to 0 in the mysql_insert() and we get a crash). 
  Moreover, calling get_auto_increment() is superfluous there.
  
  Fix: use ::info(HA_STATUS_AUTO) calls to get autoincrement values for partitions instead of
  get_auto_increment() ones in the ha_partition::info().
[16 Jun 2007 4:51] Bugs System
Pushed into 5.1.20-beta
[16 Jun 2007 13:00] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 5.1.20 changelog.