From ea59300d6248fe664605c843287072492a1cd261 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Tue, 16 Nov 2004 20:45:52 +0200 Subject: [PATCH 1/3] ha_innodb.cc: Manually ported this bug fix from 4.0: Fix InnoDB bug #6287: if one uses INSERT IGNORE to insert several rows at a time, and the first inserts are ignored because of a duplicate key collision, then InnoDB in a replication slave assigns AUTO_INCREMENT values 1 bigger than in the master --- sql/ha_innodb.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 6e08fc680b2..8e9e5fd9ed0 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2390,8 +2390,9 @@ ha_innobase::write_row( same SQL statement! */ if (auto_inc == 0 && user_thd->next_insert_id != 0) { - auto_inc = user_thd->next_insert_id; - auto_inc_counter_for_this_stat = auto_inc; + + auto_inc_counter_for_this_stat + = user_thd->next_insert_id; } if (auto_inc == 0 && auto_inc_counter_for_this_stat) { @@ -2399,14 +2400,14 @@ ha_innobase::write_row( this SQL statement with SET INSERT_ID. We must assign sequential values from the counter. */ - auto_inc_counter_for_this_stat++; - incremented_auto_inc_for_stat = TRUE; - auto_inc = auto_inc_counter_for_this_stat; /* We give MySQL a new value to place in the auto-inc column */ user_thd->next_insert_id = auto_inc; + + auto_inc_counter_for_this_stat++; + incremented_auto_inc_for_stat = TRUE; } if (auto_inc != 0) { From a38ac4b26dda28568ded78e7ba98b158562b29f3 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Tue, 16 Nov 2004 23:27:31 +0300 Subject: [PATCH 2/3] Fix comment. --- sql/item_func.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index bf85e5b378a..c07e9f23ea2 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -264,7 +264,7 @@ Item_func::Item_func(THD *thd, Item_func *item) Sets as a side effect the following class variables: maybe_null Set if any argument may return NULL with_sum_func Set if any of the arguments contains a sum function - used_table_cache Set to union of the arguments used table + used_tables_cache Set to union of the tables used by arguments str_value.charset If this is a string function, set this to the character set for the first argument. From b560503386f716c805f4e1a28c40ca1283454d19 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Tue, 16 Nov 2004 22:49:28 +0200 Subject: [PATCH 3/3] ha_innodb.cc: Anthony's http://lists.mysql.com/internals/18505 patch for DROP DATABASE broke caused it to return errno if .ibd files were present (bas_ext() was obsolete in ha_innodb.cc); fix this --- sql/ha_innodb.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 8e9e5fd9ed0..07d8da63733 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1505,17 +1505,14 @@ innobase_close_connection( *****************************************************************************/ /******************************************************************** -This function is not relevant since we store the tables and indexes -into our own tablespace, not as files, whose extension this function would -give. */ +Gives the file extension of an InnoDB single-table tablespace. */ const char** ha_innobase::bas_ext() const /*========================*/ - /* out: file extension strings, currently not - used */ + /* out: file extension string */ { - static const char* ext[] = {".InnoDB", NullS}; + static const char* ext[] = {".ibd", NullS}; return(ext); }