#At file:///home/gluh/MySQL/mysql-6.0-bug-41441/ based on
revid:sergey.glukhov@stripped
2828 Sergey Glukhov 2008-12-26
Bug#41441 repair csv table crashes debug server(for 6.0)
File renaming fails on Win because MoveFile() func can not
get stat info of repaired file.
The fix is to use my_redel() func instead of my_rename.
modified:
mysql-test/r/csv.result
mysql-test/t/csv.test
storage/csv/ha_tina.cc
per-file messages:
mysql-test/r/csv.result
test result
mysql-test/t/csv.test
test case
storage/csv/ha_tina.cc
File renaming fails on Win because MoveFile() func can not
get stat info of repaired file.
The fix is to use my_redel() func instead of my_rename.
=== modified file 'mysql-test/r/csv.result'
--- a/mysql-test/r/csv.result 2008-12-10 09:05:18 +0000
+++ b/mysql-test/r/csv.result 2008-12-26 11:38:56 +0000
@@ -5394,4 +5394,17 @@ select * from t1;
ERROR HY000: File './test/t1.CSV' not found (Errcode: 2)
unlock tables;
drop table t1;
+create table t1(a enum ('a') not null) engine=csv;
+insert into t1 values (2);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+select * from t1 limit 1;
+ERROR HY000: Table 't1' is marked as crashed and should be repaired
+repair table t1;
+Table Op Msg_type Msg_text
+test.t1 repair Warning Data truncated for column 'a' at row 1
+test.t1 repair status OK
+select * from t1 limit 1;
+a
+drop table t1;
End of 5.1 tests
=== modified file 'mysql-test/t/csv.test'
--- a/mysql-test/t/csv.test 2008-12-10 09:05:18 +0000
+++ b/mysql-test/t/csv.test 2008-12-26 11:38:56 +0000
@@ -1804,4 +1804,17 @@ unlock tables;
drop table t1;
--disconnect con1
+#
+# Bug#41441 repair csv table crashes debug server
+#
+# Note: The test should be removed after Bug#33717 is fixed
+
+create table t1(a enum ('a') not null) engine=csv;
+insert into t1 values (2);
+--error 1194
+select * from t1 limit 1;
+repair table t1;
+select * from t1 limit 1;
+drop table t1;
+
--echo End of 5.1 tests
=== modified file 'storage/csv/ha_tina.cc'
--- a/storage/csv/ha_tina.cc 2008-12-10 09:21:13 +0000
+++ b/storage/csv/ha_tina.cc 2008-12-26 11:38:56 +0000
@@ -1450,7 +1450,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_O
when trying to delete the "to"-file in my_rename().
*/
if (my_close(data_file,MYF(0)) || my_close(repair_file, MYF(0)) ||
- my_rename(repaired_fname, share->data_file_name, MYF(0)))
+ my_redel(share->data_file_name, repaired_fname, MYF(0)))
DBUG_RETURN(-1);
/* Open the file again, it should now be repaired */