mariadb/mysql-test/suite
Michael Widenius af4eeaf548 This fix+comments was originally made by Alexey Kopytov
LP bug #1035225 / MySQL bug #66301: INSERT ... ON DUPLICATE KEY UPDATE +
innodb_autoinc_lock_mode=1 is broken

The problem was that when certain INSERT ... ON DUPLICATE KEY UPDATE
were executed concurrently on a table containing an AUTO_INCREMENT
column as a primary key, InnoDB would correctly reserve non-overlapping
AUTO_INCREMENT intervals for each statement, but when the server
encountered the first duplicate key error on the secondary key in one of
the statements and performed an UPDATE, it also updated the internal
AUTO_INCREMENT value to the one from the existing row that caused a
duplicate key error, even though the AUTO_INCREMENT value was not
specified explicitly in the UPDATE clause. It would then proceed with
using AUTO_INCREMENT values the range reserved previously by another
statement, causing duplicate key errors on the AUTO_INCREMENT column.

Fixed by changing write_record() to ensure that in case of a duplicate
key error the internal AUTO_INCREMENT counter is only updated when the
AUTO_INCREMENT value was explicitly updated by the UPDATE
clause. Otherwise it is restored to what it was before the duplicate key
error, as that value is unused and can be reused for subsequent
successfully inserted rows.

sql/sql_insert.cc:
  Don't update next_insert_id to the value of a row found during ON DUPLICATE KEY UPDATE.
sql/sql_parse.cc:
  Added DBUG_SYNC
sql/table.h:
  Added next_number_field_updated flag to detect changing of auto increment fields.
  Moved fields a bit to get bool fields after each other (better alignment)
2012-09-18 23:34:16 +03:00
..
archive Created suites for heap, archive and csv. 2012-04-04 00:16:38 +03:00
binlog Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values 2012-09-18 15:14:19 +03:00
csv automatic merge 2012-05-03 16:00:41 +03:00
engines 5.2 merge. 2012-08-22 16:45:25 +02:00
federated mysql-5.1.62 merge 2012-04-05 10:49:38 +02:00
funcs_1 5.2 merge. 2012-08-22 16:45:25 +02:00
funcs_2 overlay support for mysql-test-run and mysqltest 2012-02-23 07:50:11 +01:00
handler after merge changes: 2011-12-12 23:58:40 +01:00
heap Fixed Bug#1002564: Wrong result for a lookup query from a heap table 2012-09-10 16:46:33 +03:00
innodb This fix+comments was originally made by Alexey Kopytov 2012-09-18 23:34:16 +03:00
jp overlay support for mysql-test-run and mysqltest 2012-02-23 07:50:11 +01:00
large_tests
manual
maria Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values 2012-09-18 15:14:19 +03:00
mtr/t overlay support for mysql-test-run and mysqltest 2012-02-23 07:50:11 +01:00
mtr2 MDEV-399 Combinations defined in the base suite cannot be skipped by overlay 2012-08-01 19:57:36 +02:00
optimizer_unfixed_bugs Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values 2012-09-18 15:14:19 +03:00
oqgraph 1. support for testing statically built oqgraph 2012-03-30 22:15:44 +02:00
parts overlay support for mysql-test-run and mysqltest 2012-02-23 07:50:11 +01:00
percona merged with XtraDB 1.1.8-26.0 2012-06-15 14:54:23 +02:00
perfschema merge with MySQL 5.5.27 2012-08-09 17:22:00 +02:00
perfschema_stress mysql-5.5 merge 2012-01-16 20:16:35 +01:00
plugins mdev-224 plugin usage statistics in the feedback reports 2012-04-18 04:00:08 +02:00
rpl Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values 2012-09-18 15:14:19 +03:00
sphinx Removed one variable from the test output that was depending on timing. 2012-06-15 13:36:34 +03:00
storage_engine MDEV-11: Generic storage engine test suite 2012-07-16 06:17:56 +04:00
stress Bug #11751927 42960: MTR2: NO MORE --STRESS PARAMETERS 2011-09-15 12:34:32 +02:00
sys_vars sys_vars.expensive_subquery_limit_basic 2012-09-05 13:15:05 +02:00
unit post-merge changes to the mysql-test suite 2011-10-19 23:01:15 +02:00
vcol Merge 5.3->5.5. 2012-06-24 09:10:11 -07:00