summaryrefslogtreecommitdiff
path: root/mysql-test/t/csv.test
diff options
context:
space:
mode:
authorunknown <petr@mysql.com>2006-03-13 19:36:34 +0300
committerunknown <petr@mysql.com>2006-03-13 19:36:34 +0300
commitecba6dc67bfd8f837fb76d63e0c15d9988ca1c86 (patch)
tree16df6bda76911bdd1dae072cff2c449de65a4318 /mysql-test/t/csv.test
parent7e2a9aa45938da567035af4f54e731f4a69c8e8e (diff)
downloadmariadb-git-ecba6dc67bfd8f837fb76d63e0c15d9988ca1c86.tar.gz
WL#3154 "Enable REPAIR for CSV tables".
This is the first commit. Cleanups are likely to follow after the merge. mysql-test/r/csv.result: update result mysql-test/t/csv.test: add tests for CSV REPAIR/RESTORE. storage/csv/ha_tina.cc: add repair/check and a meta-file processing for it storage/csv/ha_tina.h: add new functions required for tina repair/check
Diffstat (limited to 'mysql-test/t/csv.test')
-rw-r--r--mysql-test/t/csv.test39
1 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 916a2132deb..3d23a838762 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1388,6 +1388,45 @@ UNLOCK TABLES;
DROP TABLE test_concurrent_insert;
#
+# Test REPAIR/CHECK TABLE (5.1)
+#
+
+# Check that repair on the newly created table works fine
+
+CREATE TABLE test_repair_table ( val integer ) ENGINE = CSV;
+
+CHECK TABLE test_repair_table;
+REPAIR TABLE test_repair_table;
+
+DROP TABLE test_repair_table;
+
+#
+# Check autorepair. Here we also check that we can work w/o metafile
+# restore the meta-file
+#
+
+CREATE TABLE test_repair_table2 ( val integer ) ENGINE = CSV;
+--exec rm $MYSQLTEST_VARDIR/master-data/test/test_repair_table2.CSM
+# should give a warning and perform autorepair
+SELECT * from test_repair_table2;
+# this should work ok, as the table is already repaired
+SELECT * from test_repair_table2;
+# check that the metafile appeared again. chop the path to it
+--exec ls $MYSQLTEST_VARDIR/master-data/test/test_repair_table2.CSM | perl -pi -e "s/.*\///"
+CHECK TABLE test_repair_table2;
+DROP TABLE test_repair_table2;
+
+
+# Corrupt csv file and see if we can repair it
+CREATE TABLE test_repair_table3 ( val integer ) ENGINE = CSV;
+--exec echo -n -e \"1\"\\n\"4\"\\n\"3 > $MYSQLTEST_VARDIR/master-data/test/test_repair_table3.CSV
+CHECK TABLE test_repair_table3;
+REPAIR TABLE test_repair_table3;
+SELECT * FROM test_repair_table3;
+DROP TABLE test_repair_table3;
+
+
+#
# BUG#13406 - incorrect amount of "records deleted"
#