| Bug #30648 | Partition handler may not initialize variable used w/ autoincrement | ||
|---|---|---|---|
| Submitted: | 27 Aug 2007 17:47 | Modified: | 31 Aug 2007 13:48 |
| Reporter: | Timothy Smith | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Partitions | Severity: | S3 (Non-critical) |
| Version: | 5.1 | OS: | Any |
| Assigned to: | Timothy Smith | CPU Architecture: | Any |
[27 Aug 2007 17:49]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/33164 ChangeSet@1.2576, 2007-08-27 11:46:34-06:00, tsmith@ramayana.hindu.god +1 -0 Bug #30648: Partition handler may not initialize variable used w/ autoincrement A local variable may be used uninitialized in ha_partition::get_auto_increment(). Initialize it properly.
[28 Aug 2007 16:56]
Trudy Pelzer
Patch has been pushed to 5.1.22 tree.
[28 Aug 2007 18:36]
Timothy Smith
Queued to target-5.1.22
[29 Aug 2007 18:55]
Timothy Smith
Docs team: I'm not aware of any release in which this bug would show up. It became visible only after some changes to InnoDB's auto-increment handling (see bug #16979), but I don't have a test case against any released version of MySQL which tickles this bug. So, it may not need to be documented. The symptom, by the way, was that partitioning an innodb table based on an auto_increment key failed to generate correct values for the key column. Instead, it would use the contents of some uninitialized variable, repeatedly (i.e., you get the same junk value over and over).
[31 Aug 2007 13:48]
Paul DuBois
No changelog entry needed.
[4 Sep 2007 17:11]
Bugs System
Pushed into 5.1.23-beta

Description: Quick bug filed for problem found by partition_innodb.test, where the following would fail: create table t1 (a int auto_increment primary key) engine = innodb partition by key (a); insert into t1 values (NULL), (NULL), (NULL), (NULL); Fails with: mysqltest: At line 26: query 'insert into t1 values (NULL), (NULL), (NULL), (NULL)' failed: 1022: Can't write; duplicate key in table 't1' How to repeat: With new InnoDB autoincrement fixes, run the above statements. Suggested fix: Initialize first_value_part in ha_partition::get_auto_increment() with *first_value before it's used in the underlying table handler. Thanks to Antony for digging up this fix. --- 1.98/sql/ha_partition.cc 2007-07-04 21:55:21 +02:00 +++ 1.99/sql/ha_partition.cc 2007-07-20 01:52:41 +02:00 @@ -5432,6 +5432,7 @@ void ha_partition::get_auto_increment(ul for (pos=m_file, end= m_file+ m_tot_parts; pos != end ; pos++) { + first_value_part= *first_value; (*pos)->get_auto_increment(offset, increment, nb_desired_values, &first_value_part, &nb_reserved_values_part); if (first_value_part == ~(ulonglong)(0)) // error in one partition