diff options
author | Timothy Smith <timothy.smith@sun.com> | 2008-12-14 12:29:59 -0700 |
---|---|---|
committer | Timothy Smith <timothy.smith@sun.com> | 2008-12-14 12:29:59 -0700 |
commit | ea912a97c7eb3b8b2c879bccca072287deaab6f0 (patch) | |
tree | e46f7573dadfdd01d4ec66228511dc9503f3f7ed /mysql-test/t/innodb-autoinc.test | |
parent | 2450190eed67992c910615418137046ecfc0e2f4 (diff) | |
download | mariadb-git-ea912a97c7eb3b8b2c879bccca072287deaab6f0.tar.gz |
Apply InnoDB snapshot innodb-5.1-ss2637, part 2. Fixes
Bug #38839: auto increment does not work properly with InnoDB after update
Detailed revision comments:
r2609 | sunny | 2008-08-24 01:19:05 +0300 (Sun, 24 Aug 2008) | 12 lines
branches/5.1: Fix for MySQL Bug#38839. Reset the statement level last
value field in prebuilt. This field tracks the last value in an autoincrement
interval. We use this value to check whether we need to update a table's
AUTOINC counter, if the value written to a table is less than this value
then we avoid updating the table's AUTOINC value in order to reduce
mutex contention. If it's not reset (e.g., after a DELETE statement) then
there is the possibility of missing updates to the table's AUTOINC counter
resulting in a subsequent duplicate row error message under certain
conditions (see the test case for details).
Bug #38839 - auto increment does not work properly with InnoDB after update
Diffstat (limited to 'mysql-test/t/innodb-autoinc.test')
-rw-r--r-- | mysql-test/t/innodb-autoinc.test | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test index aa464e42627..1c97364199b 100644 --- a/mysql-test/t/innodb-autoinc.test +++ b/mysql-test/t/innodb-autoinc.test @@ -139,3 +139,24 @@ SELECT c1 FROM t1; SHOW CREATE TABLE t1; DROP TABLE t1; +# +# Bug 38839 +# Reset the last value generated at end of statement +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (NULL,8); +SELECT * FROM t1; +DROP TABLE t1; +# Bug 38839 -- same as above but for multi value insert +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1), (NULL, 8); +INSERT INTO t1 VALUES (NULL,9); +SELECT * FROM t1; +DROP TABLE t1; |