Bug #45775 | Crash when adding primary key to Falcon table with unique constraint. | ||
---|---|---|---|
Submitted: | 26 Jun 2009 6:49 | Modified: | 26 May 2010 17:46 |
Reporter: | Dmitry Lenev | Email Updates: | |
Status: | Unsupported | Impact on me: | |
Category: | MySQL Server: Falcon storage engine | Severity: | S3 (Non-critical) |
Version: | 6.0-bzr | OS: | Any |
Assigned to: | Christopher Powers | CPU Architecture: | Any |
Tags: | F_HANDLER |
[26 Jun 2009 6:49]
Dmitry Lenev
[26 Jun 2009 7:07]
Valeriy Kravchuk
Thank you for the bug report. Verified just as described.
[28 Jun 2009 18:58]
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/77408 2750 Christopher Powers 2009-06-28 Bug #45775, "Crash when adding primary key to Falcon table with unique constraint." There are several issues here: 1) The server assigns TABLE->s->primary_key != MAX_KEY for EITHER a primary key OR a unique key with non-null columns. 2) Falcon assumed ::primary_key unambiguously identifies ONLY the primary key, and therfore incorrectly interpreted (a INT NOT NULL UNIQUE) as being a primary key declaration. 3) Given (2), the command "ALTER TABLE ADD PRIMARY KEY (b)" caused an update conflict for which Falcon raised an exception that subsequently crashed. 4) The crash was caused by a null pointer encountered during exception handling. Item 4 was easy to fix. Item 2, not so easy. Fortunately, the server always names the primary key "PRIMARY", so to distinguish between a primary key and a unique, non-null key, Falcon now checks the key name. added: mysql-test/suite/falcon/r/falcon_bug_45775.result mysql-test/suite/falcon/t/falcon_bug_45775.test modified: storage/falcon/StorageTableShare.cpp storage/falcon/StorageTableShare.h storage/falcon/ha_falcon.cpp storage/falcon/ha_falcon.h
[29 Jun 2009 13:25]
Kevin Lewis
This is another undocumented quirk in the Handler API for pluggable storage engines.
[2 Jul 2009 4:47]
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/77721 2724 Dmitry Lenev 2009-07-02 Bug #45775, "Crash when adding primary key to Falcon table with unique constraint." There are several issues here: 1) The server assigns TABLE->s->primary_key != MAX_KEY for EITHER a primary key OR a unique key with non-null columns. 2) Falcon assumed ::primary_key unambiguously identifies ONLY the primary key, and therfore incorrectly interpreted (a INT NOT NULL UNIQUE) as being a primary key declaration. 3) Given (2), the command "ALTER TABLE ADD PRIMARY KEY (b)" caused an update conflict for which Falcon raised an exception that subsequently crashed. 4) The crash was caused by a null pointer encountered during exception handling. Item 4 was easy to fix. Item 2, not so easy. Fortunately, the server always names the primary key "PRIMARY", so to distinguish between a primary key and a unique, non-null key, Falcon now checks the key name. Manually applied patch from Falcon team tree to mysql-6.1-fk tree.