summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/handler.result18
-rw-r--r--mysql-test/t/handler.test29
2 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result
index 5af153930d5..3a61236ea14 100644
--- a/mysql-test/r/handler.result
+++ b/mysql-test/r/handler.result
@@ -447,3 +447,21 @@ drop table t2;
drop table t3;
drop table t4;
drop table t5;
+create table t1 (c1 int);
+insert into t1 values (1);
+handler t1 open;
+handler t1 read first;
+c1
+1
+send the below to another connection, do not wait for the result
+ optimize table t1;
+proceed with the normal connection
+handler t1 read next;
+c1
+1
+handler t1 close;
+read the result from the other connection
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+proceed with the normal connection
+drop table t1;
diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test
index 53fe8c0a059..d91587b8070 100644
--- a/mysql-test/t/handler.test
+++ b/mysql-test/t/handler.test
@@ -339,3 +339,32 @@ drop table t2;
drop table t3;
drop table t4;
drop table t5;
+
+#
+# Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
+#
+create table t1 (c1 int);
+insert into t1 values (1);
+# client 1
+handler t1 open;
+handler t1 read first;
+# client 2
+connect (con2,localhost,root,,);
+connection con2;
+--exec echo send the below to another connection, do not wait for the result
+send optimize table t1;
+--sleep 1
+# client 1
+--exec echo proceed with the normal connection
+connection default;
+handler t1 read next;
+handler t1 close;
+# client 2
+--exec echo read the result from the other connection
+connection con2;
+reap;
+# client 1
+--exec echo proceed with the normal connection
+connection default;
+drop table t1;
+