diff options
author | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-06-07 15:50:13 +0500 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-06-07 15:50:13 +0500 |
commit | 675d0941d9f0311dba7f5348ad4e287871d3b76a (patch) | |
tree | 555e7ee267ac4c279063746544643ae1348f4435 /sql/ha_partition.cc | |
parent | 10a21ed042e39c8800893dbb8ba711d54daf4896 (diff) | |
download | mariadb-git-675d0941d9f0311dba7f5348ad4e287871d3b76a.tar.gz |
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().
mysql-test/r/partition.result:
Fix for bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
- test result.
mysql-test/t/partition.test:
Fix for bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
- test case.
sql/ha_partition.cc:
Fix for bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
- use info(HA_STATUS_AUTO) calls to get autoincrement values for partitions,
set the auto_increment_value as the biggest one.
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r-- | sql/ha_partition.cc | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e9f4bc4c745..0c4f3cf708f 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4253,22 +4253,16 @@ int ha_partition::info(uint flag) if (flag & HA_STATUS_AUTO) { - ulonglong nb_reserved_values; + ulonglong auto_increment_value= 0; DBUG_PRINT("info", ("HA_STATUS_AUTO")); - /* we don't want to reserve any values, it's pure information */ - - if (table->found_next_number_field) + file_array= m_file; + do { - /* - Can only call get_auto_increment for tables that actually - have auto_increment columns, otherwise there will be - problems in handlers that don't expect get_auto_increment - for non-autoincrement tables. - */ - get_auto_increment(0, 0, 0, &stats.auto_increment_value, - &nb_reserved_values); - release_auto_increment(); - } + file= *file_array; + file->info(HA_STATUS_AUTO); + set_if_bigger(auto_increment_value, file->stats.auto_increment_value); + } while (*(++file_array)); + stats.auto_increment_value= auto_increment_value; } if (flag & HA_STATUS_VARIABLE) { |