From 94beb7cd8db07e816ecced8112945d9df9db67e4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jun 2007 13:36:26 -0700 Subject: Bug#25511 "Federated INSERT failures" Federated does not correctly handle "INSERT...ON DUPLICATE KEY UPDATE" However, implementing such support is not reasonably possible without increasing complexity of the storage engine: checking that constraints on remote server match local server and parsing error messages. This patch causes 'ON DUPLICATE KEY' to fail with ER_DUP_KEY message if a conflict occurs and not to fail silently. include/my_base.h: bug25511 new storage engine hint: HA_EXTRA_INSERT_WITH_UPDATE mysql-test/r/federated.result: test for bug25511 mysql-test/t/federated.test: test for bug25511 sql/ha_federated.cc: bug25511 implement support for handling HA_EXTRA_INSERT_WITH_UPDATE hint sql/ha_federated.h: bug25511 new property: insert_dup_update sql/sql_insert.cc: bug25511 implement support for HA_EXTRA_INSERT_WITH_UPDATE When checking duplicates flag, if it is DUP_UPDATE, send hint to the storage engine. --- include/my_base.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/my_base.h b/include/my_base.h index d07a4de8e6a..a26217f8050 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -168,7 +168,13 @@ enum ha_extra_function { These flags are reset by the handler::extra(HA_EXTRA_RESET) call. */ HA_EXTRA_DELETE_CANNOT_BATCH, - HA_EXTRA_UPDATE_CANNOT_BATCH + HA_EXTRA_UPDATE_CANNOT_BATCH, + /* + Inform handler that write_row() should immediately report constraint + violations because a INSERT...ON DUPLICATE KEY UPDATE is in being + performed. + */ + HA_EXTRA_INSERT_WITH_UPDATE }; /* The following is parameter to ha_panic() */ -- cgit v1.2.1 From b4fe5e4408dad197509976857bb7826d8c447ce0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Jun 2007 13:55:16 -0700 Subject: add and amend comments for clarity include/my_base.h: amend comment for clarity sql/ha_federated.cc: add comment --- include/my_base.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/my_base.h b/include/my_base.h index a26217f8050..4ce7a87105d 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -170,9 +170,8 @@ enum ha_extra_function { HA_EXTRA_DELETE_CANNOT_BATCH, HA_EXTRA_UPDATE_CANNOT_BATCH, /* - Inform handler that write_row() should immediately report constraint - violations because a INSERT...ON DUPLICATE KEY UPDATE is in being - performed. + Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be + executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY. */ HA_EXTRA_INSERT_WITH_UPDATE }; -- cgit v1.2.1 From 26af0b96a8d7edb8987ff604f415b3814ee47ece Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Jul 2007 11:31:03 +0200 Subject: Bug#26827 - table->read_set is set incorrectly, causing update of a different column Post-pushbuild fix. bitmap_set_bit() is an inline function in DEBUG builds and a macro in non-DEBUG builds. The latter evaluates its 'bit' argument twice. So one must not use increment/decrement operators on this argument. Moved increment of pointer out of bitmap_set_bit() call. include/my_bitmap.h: Bug#26827 - table->read_set is set incorrectly, causing update of a different column Added a warning comment. sql/sql_partition.cc: Bug#26827 - table->read_set is set incorrectly, causing update of a different column Moved increment of pointer out of bitmap_set_bit() call. --- include/my_bitmap.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/my_bitmap.h b/include/my_bitmap.h index 488c41ffb22..0b12172946a 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -103,6 +103,17 @@ extern void bitmap_lock_invert(MY_BITMAP *map); &= ~ (1 << ((BIT) & 7))) #define _bitmap_is_set(MAP, BIT) (uint) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \ & (1 << ((BIT) & 7))) +/* + WARNING! + + The below symbols are inline functions in DEBUG builds and macros in + non-DEBUG builds. The latter evaluate their 'bit' argument twice. + + NEVER use an increment/decrement operator with the 'bit' argument. + It would work with DEBUG builds, but fails later in production builds! + + FORBIDDEN: bitmap_set_bit($my_bitmap, (field++)->field_index); +*/ #ifndef DBUG_OFF static inline void bitmap_set_bit(MY_BITMAP *map,uint bit) -- cgit v1.2.1