From: Satya B Date: September 17 2009 6:29am Subject: bzr commit into mysql-5.1-bugteam branch (satya.bn:3110) Bug#44030 List-Archive: http://lists.mysql.com/commits/83551 X-Bug: 44030 Message-Id: <0KQ3009F9RDUFF90@mail-apac.sun.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_yB5Hk/6jlMPZOZ4d0qdJlw)" --Boundary_(ID_yB5Hk/6jlMPZOZ4d0qdJlw) MIME-version: 1.0 Content-type: text/plain; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Content-disposition: inline #At file:///home/satya/WORK/mysql/mysql-5.1-bugteam/ based on revid:ingo.struewing@stripped 3110 Satya B 2009-09-17 Applying InnoDB snapshot 5.1-ss5282, Fixes BUG#44030 1. Fixes BUG#44030 - Error: (1500) Couldn't read the MAX(ID) autoinc value from the index (PRIMARY) 2. Disables the innodb-autoinc test for innodb plugin temporarily. The testcase for this bug has different result file for InnoDB plugin. Should add the testcase to Innodb suite with a different result file. Detailed revision comments: r5243 | sunny | 2009-06-04 03:17:14 +0300 (Thu, 04 Jun 2009) | 14 lines branches/5.1: When the InnoDB and MySQL data dictionaries go out of sync, before the bug fix we would assert on missing autoinc columns. With this fix we allow MySQL to open the table but set the next autoinc value for the column to the MAX value. This effectively disables the next value generation. INSERTs will fail with a generic AUTOINC failure. However, the user should be able to read/dump the table, set the column values explicitly, use ALTER TABLE to set the next autoinc value and/or sync the two data dictionaries to resume normal operations. Fix Bug#44030 Error: (1500) Couldn't read the MAX(ID) autoinc value from the index (PRIMARY) rb://118 r5252 | sunny | 2009-06-04 10:16:24 +0300 (Thu, 04 Jun 2009) | 2 lines branches/5.1: The version of the result file checked in was broken in r5243. r5259 | vasil | 2009-06-05 10:29:16 +0300 (Fri, 05 Jun 2009) | 7 lines branches/5.1: Remove the word "Error" from the printout because the mysqltest suite interprets it as an error and thus the innodb-autoinc test fails. Approved by: Sunny (via IM) r5466 | vasil | 2009-07-02 10:46:45 +0300 (Thu, 02 Jul 2009) | 6 lines branches/5.1: Adjust the failing innodb-autoinc test to conform to the latest behavior of the MySQL code. The idea and the comment in innodb-autoinc.test come from Sunny. modified: mysql-test/lib/mtr_cases.pm mysql-test/r/innodb-autoinc.result mysql-test/t/innodb-autoinc.test storage/innobase/handler/ha_innodb.cc === modified file 'mysql-test/lib/mtr_cases.pm' --- a/mysql-test/lib/mtr_cases.pm 2009-08-12 12:46:12 +0000 +++ b/mysql-test/lib/mtr_cases.pm 2009-09-17 06:29:43 +0000 @@ -495,6 +495,7 @@ sub collect_one_suite($) # Exceptions next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk) next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff + next if ($test->{'name'} eq 'main.innodb-autoinc'); # Need dfrnt result file # innodb_file_per_table is rw with innodb_plugin next if ($test->{'name'} eq 'sys_vars.innodb_file_per_table_basic'); # innodb_lock_wait_timeout is rw with innodb_plugin === modified file 'mysql-test/r/innodb-autoinc.result' --- a/mysql-test/r/innodb-autoinc.result 2009-03-12 00:18:44 +0000 +++ b/mysql-test/r/innodb-autoinc.result 2009-09-17 06:29:43 +0000 @@ -867,3 +867,25 @@ INSERT INTO t2 SELECT NULL FROM t1; Got one of the listed errors DROP TABLE t1; DROP TABLE t2; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +INSERT INTO t1 VALUES (null); +ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; +SELECT * FROM t1; +d1 +1 +3 +SELECT * FROM t1; +d1 +1 +3 +INSERT INTO t1 VALUES(null); +ALTER TABLE t1 AUTO_INCREMENT = 3; +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +d1 +1 +3 +4 +5 +DROP TABLE t1; === modified file 'mysql-test/t/innodb-autoinc.test' --- a/mysql-test/t/innodb-autoinc.test 2009-03-12 00:18:44 +0000 +++ b/mysql-test/t/innodb-autoinc.test 2009-09-17 06:29:43 +0000 @@ -478,3 +478,27 @@ INSERT INTO t2 SELECT c1 FROM t1; INSERT INTO t2 SELECT NULL FROM t1; DROP TABLE t1; DROP TABLE t2; +# +# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from +# the index (PRIMARY) +# This test requires a restart of the server +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +INSERT INTO t1 VALUES (null); +ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; +SELECT * FROM t1; +# Restart the server +-- source include/restart_mysqld.inc +# The MySQL and InnoDB data dictionaries should now be out of sync. +# The select should print message to the error log +SELECT * FROM t1; +# MySQL have made a change (http://lists.mysql.com/commits/75268) that no +# longer results in the two data dictionaries being out of sync. If they +# revert their changes then this check for ER_AUTOINC_READ_FAILED will need +# to be enabled. +# -- error ER_AUTOINC_READ_FAILED,1467 +INSERT INTO t1 VALUES(null); +ALTER TABLE t1 AUTO_INCREMENT = 3; +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +DROP TABLE t1; === modified file 'storage/innobase/handler/ha_innodb.cc' --- a/storage/innobase/handler/ha_innodb.cc 2009-08-11 13:05:25 +0000 +++ b/storage/innobase/handler/ha_innodb.cc 2009-09-17 06:29:43 +0000 @@ -2515,12 +2515,28 @@ ha_innobase::innobase_initialize_autoinc dict_table_autoinc_initialize(innodb_table, auto_inc); - } else { + } else if (error == DB_RECORD_NOT_FOUND) { ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: Error: (%lu) Couldn't read " - "the MAX(%s) autoinc value from the " - "index (%s).\n", error, col_name, index->name); - } + fprintf(stderr, " InnoDB: MySQL and InnoDB data " + "dictionaries are out of sync.\n" + "InnoDB: Unable to find the AUTOINC column %s in the " + "InnoDB table %s.\n" + "InnoDB: We set the next AUTOINC column value to the " + "maximum possible value,\n" + "InnoDB: in effect disabling the AUTOINC next value " + "generation.\n" + "InnoDB: You can either set the next AUTOINC value " + "explicitly using ALTER TABLE\n" + "InnoDB: or fix the data dictionary by recreating " + "the table.\n", + col_name, index->table->name); + + auto_inc = 0xFFFFFFFFFFFFFFFFULL; + + dict_table_autoinc_initialize(innodb_table, auto_inc); + + error = DB_SUCCESS; + } /* else other errors are still fatal */ return(ulong(error)); } @@ -2731,7 +2747,6 @@ retry: if (dict_table_autoinc_read(prebuilt->table) == 0) { error = innobase_initialize_autoinc(); - /* Should always succeed! */ ut_a(error == DB_SUCCESS); } --Boundary_(ID_yB5Hk/6jlMPZOZ4d0qdJlw) MIME-version: 1.0 Content-type: text/bzr-bundle; CHARSET=US-ASCII; name="bzr/satya.bn@stripped" Content-transfer-encoding: 7BIT Content-disposition: inline; filename="bzr/satya.bn@stripped" # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: satya.bn@stripped # target_branch: file:///home/satya/WORK/mysql/mysql-5.1-bugteam/ # testament_sha1: 70592c61758ee08f9eb111e1efbb6312113b0536 # timestamp: 2009-09-17 11:59:57 +0530 # source_branch: file:///home/satya/WORK/mysql/mysql-5.0-bugteam/ # base_revision_id: ingo.struewing@stripped\ # 6053el2ucp5z7pyn # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWWiEfHUABc7/gFA0IABf//// f///5L////5gDX1fbS4dd041QCrYMpSImRZdxjtd3A5Vm0jtqOEkiJpgieqflNoJqeaZCjyNTTKP 1QY1HqepiZqGh6geoBqekCZMmkanpqT2qaaZPUP1RptIaMgAAAABkDmmIyMmmTQDIaMhkyAAAGRp kaBhDIEiQmhAmFT2TU2mpHpo0ank1NB6T0nqekyMmgeoGmTT1DmmIyMmmTQDIaMhkyAAAGRpkaBh DIEkgEAEyTTRkp7SZGICam1GIepo9TR6h6g9QGjT4q0BUSG2mkbWiC5IzwrO7qajPp3r4oMju7dr rT/PK72sfI/DDq7x02zBRBW81tnpPe+Kfx+Xx8JlmGVE76VAhqHiCCb0vDvXa68llzkFmCDV76b0 1R+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