Bug #14672 Bug in deletion
Submitted: 5 Nov 2005 18:20 Modified: 9 Nov 2005 3:35
Reporter: Brian Aker Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:
Assigned to: Petr Chardin CPU Architecture:Any

[5 Nov 2005 18:20] Brian Aker
Description:
mysql> create table csvtst ( c1 integer ) engine = CSV; 
Query OK, 0 rows affected (0.02 sec) 

mysql> insert into csvtst values ( 1 ); 
Query OK, 1 row affected (0.02 sec) 

mysql> insert into csvtst values ( 2 ); 
Query OK, 1 row affected (0.02 sec) 

mysql> insert into csvtst values ( 3 ); 
Query OK, 1 row affected (0.01 sec) 

mysql> select * from csvtst; 
+------+ 
| c1 | 
+------+ 
| 1 | 
| 2 | 
| 3 | 
+------+ 
3 rows in set (0.01 sec) 

mysql> delete from csvtst where c1 = 2; 
Query OK, 1 row affected (0.01 sec) 

mysql> select * from csvtst; 
+------+ 
| c1 | 
+------+ 
| 1 | 
| 3 | 
+------+ 
2 rows in set (0.00 sec) 

mysql> insert into csvtst values ( 4 ); 
Query OK, 1 row affected (0.01 sec) 

mysql> select * from csvtst; 
+------+ 
| c1 | 
+------+ 
| 1 | 
| 3 | 
| 0 | 
+------+ 
3 rows in set (0.01 sec) 

mysql> insert into csvtst values ( 5 ); 
Query OK, 1 row affected (0.00 sec) 

mysql> select * from csvtst; 
+------+ 
| c1 | 
+------+ 
| 1 | 
| 3 | 
| 0 | 
| 5 | 
+------+ 
4 rows in set (0.01 sec) 

By the way, the contents of the file look like this... 

"1" 
"3" 
^@^@^@^@"4" 
"5" 

How to repeat:
Run the  above

Suggested fix:
Check to see how the chain is working for the delete, I would suspect that the offset has somehow become munged.
[5 Nov 2005 23:13] 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/internals/32008
[6 Nov 2005 5:50] Brian Aker
Patch approved. I suspect that this may fail on Windows do to the way the truncate of the file is called ( I never tested this on Windows and there was a note not to run it on Windows at one point), but that is a different problem :)
[8 Nov 2005 0:36] Petr Chardin
pushed into 4.1.16 and merged to 5.0.16
[9 Nov 2005 3:35] Paul DuBois
Noted in 4.0.16, 5.0.16 changelogs.