From: mattiasj Date: February 21 2008 12:10pm Subject: bk commit into 5.1 tree (mattiasj:1.2520) BUG#33479 List-Archive: http://lists.mysql.com/commits/42744 X-Bug: 33479 Message-Id: <20080221121040.5528B845285@witty.localhost> Below is the list of changes that have just been committed into a local 5.1 repository of mattiasj. When mattiasj does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2008-02-21 13:10:34+01:00, mattiasj@witty. +2 -0 Bug#33479: auto_increment failures in partitioning This patch build on the previous 'code only' patch Missed some special case initializations found when trying with falcon. sql/ha_partition.cc@stripped, 2008-02-21 13:10:32+01:00, mattiasj@witty. +18 -17 Bug#33479: auto_increment failures in partitioning Missed some special case initializations sql/ha_partition.h@stripped, 2008-02-21 13:10:32+01:00, mattiasj@witty. +1 -0 Bug#33479: auto_increment failures in partitioning Missed some special case initializations diff -Nrup a/sql/ha_partition.cc b/sql/ha_partition.cc --- a/sql/ha_partition.cc 2008-02-21 10:09:42 +01:00 +++ b/sql/ha_partition.cc 2008-02-21 13:10:32 +01:00 @@ -2739,24 +2739,21 @@ int ha_partition::write_row(uchar * buf) since the partitions can have higher auto_increment_value which should be used. */ - if (!ha_data->auto_inc_initialized && !table->s->next_number_keypart) + if (!ha_data->auto_inc_initialized && + !table->s->next_number_keypart && + table_share->tmp_table == NO_TMP_TABLE) { - if (table_share->tmp_table != NO_TMP_TABLE) - info(HA_STATUS_AUTO); - else - { - /* - If auto_increment in table_share is not initialized, we must - have a mutex around update_auto_increment, - get_auto_increment and write_row. - (get_auto_increment can be called from update_auto_increment - and update_auto_increment can be called from write_row). - Not needed for tmp-tables, or auto_increment in secondary - columns in multi-column index. - Also check ha_partition::get_auto_increment(). - */ - lock_auto_increment(&auto_increment_lock); - } + /* + If auto_increment in table_share is not initialized, we must + have a mutex around update_auto_increment, + get_auto_increment and write_row. + (get_auto_increment can be called from update_auto_increment + and update_auto_increment can be called from write_row). + Not needed for tmp-tables, or auto_increment in secondary + columns in multi-column index. + Also check ha_partition::get_auto_increment(). + */ + lock_auto_increment(&auto_increment_lock); } error= update_auto_increment(); /* @@ -4472,6 +4469,10 @@ int ha_partition::info(uint flag) DBUG_PRINT("info", ("file->stats.auto_increment_value: %llu", file->stats.auto_increment_value)); } while (*(++file_array)); + + /* This should not occur unless bugs in the other storage engine */ + if (auto_increment_value == 0) + auto_increment_value= 1; stats.auto_increment_value= auto_increment_value; if (!table_share->next_number_keypart) { diff -Nrup a/sql/ha_partition.h b/sql/ha_partition.h --- a/sql/ha_partition.h 2008-02-21 10:09:42 +01:00 +++ b/sql/ha_partition.h 2008-02-21 13:10:32 +01:00 @@ -868,6 +868,7 @@ private: { lock_auto_increment(is_locked); ha_data->next_auto_inc_val= nr + 1; + ha_data->auto_inc_initialized= TRUE; } }