Bug #26802 Falcon: undetected unique violation when updating maximum values
Submitted: 2 Mar 2007 19:15 Modified: 23 Mar 2007 8:04
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S2 (Serious)
Version:5.2.4-falcon-alpha-debug OS:Linux (SUSE 10.0 / 64-bit)
Assigned to: CPU Architecture:Any

[2 Mar 2007 19:15] Peter Gulutzan
Description:
I create a Falcon table with a unsigned integer column.
I create a unique index on the column.
I insert (maximum unsigned integer),(maximum unsigned integer minus 1).
I update both rows.
Now they have the same value.
But they shouldn't. There's a unique index.

How to repeat:
mysql> create table m2 (s1 int unsigned) engine=falcon;
Query OK, 0 rows affected (0.01 sec)

mysql> insert into m2 values (4294967295),(4294967294);
Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> create unique index im2 on m2 (s1);
Query OK, 2 rows affected (0.03 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> update m2 set s1 = s1 + 1;
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 2  Changed: 1  Warnings: 1

mysql> select * from m2;
+------------+
| s1         |
+------------+
| 4294967295 |
| 4294967295 |
+------------+
2 rows in set (0.00 sec)
[2 Mar 2007 19:46] Hakan Küçükyılmaz
Verified as described. Added test case falcon_bug_26802.test and pushed to mysql-5.1-falcon tree.

TEST                           RESULT         TIME (ms)
-------------------------------------------------------

falcon_bug_26802               [ fail ]

Regards, Hakan
[12 Mar 2007 21:58] Kevin Lewis
Table::checkUniqueIndexes failed to recognize a unique violation because there was a lock record before the record containting the duplicate key.  The lock record was interpreted as a deleted record by the same transaction and this no other record versions were checked.  An explicit check for a lock record is added so that prior versions are searched for duplictes.
[12 Mar 2007 22:57] Hakan Küçükyılmaz
Works now on Linux 32-bit and Linux 64-bit.

TEST                           RESULT         TIME (ms)
-------------------------------------------------------

falcon_bug_26802               [ pass ]            232
-------------------------------------------------------
Stopping All Servers
All 1 tests were successful.
The servers where restarted 1 times
Spent 0.232 seconds actually executing testcases

Best regards, Hakan
[23 Mar 2007 8:04] MC Brown
An entry has been added to the 5.2.4 changelog for Falcon.
[10 Jul 2007 19:10] MC Brown
This bug report entry has been moved to the 6.0.0 Falcon changelog.