summaryrefslogtreecommitdiff
path: root/mysql-test/t/csv.test
diff options
context:
space:
mode:
authorunknown <petr/cps@mysql.com/owlet.>2006-07-11 15:54:52 +0400
committerunknown <petr/cps@mysql.com/owlet.>2006-07-11 15:54:52 +0400
commit83aade738787f991122b3dcf519789eba7becb93 (patch)
tree14b80f2cbea92c4466d455c702b0ccc75109e0b9 /mysql-test/t/csv.test
parent0eaae4157d4bd467fa7fecf88bc37c81c8d069b1 (diff)
downloadmariadb-git-83aade738787f991122b3dcf519789eba7becb93.tar.gz
Fix Bug#15205 "Select from CSV table without the datafile causes crash"
mysql-test/r/csv.result: update result file mysql-test/t/csv.test: add a test for the bug sql/examples/ha_tina.cc: move open() call before my_hash_insert, so that we don't insert invalid share to the hash. To avoid other possible problems also add hash_delete(), so that the share is removed from hash before it is freed.
Diffstat (limited to 'mysql-test/t/csv.test')
-rw-r--r--mysql-test/t/csv.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index a028f6ced6d..8bd48b7da2c 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1384,3 +1384,27 @@ truncate table t1; -- truncate
--disable_info
drop table t1;
+#
+# Bug #15205 Select from CSV table without the datafile causes crash
+#
+# NOTE: the bug is not deterministic
+
+# The crash happens because the necessary cleanup after an error wasn't
+# performed. Namely, the table share, inserted in the hash during table
+# open, was not deleted from hash. At the same time the share was freed
+# when an error was encountered. Thus, subsequent access to the hash
+# resulted in scanning through deleted memory and we were geting a crash.
+# that's why we need two tables in the bugtest
+
+create table bug15205 (val int(11) default null) engine=csv;
+create table bug15205_2 (val int(11) default null) engine=csv;
+--exec rm $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
+# system error (can't open the datafile)
+--error ER_GET_ERRNO
+select * from bug15205;
+select * from bug15205_2;
+--exec touch $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
+select * from bug15205;
+drop table bug15205;
+drop table bug15205_2;
+