summaryrefslogtreecommitdiff
path: root/mysql-test/main/temp_table.test
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2018-09-12 16:36:45 +0400
committerSergey Vojtovich <svoj@mariadb.org>2018-10-02 13:42:44 +0400
commitbad2f1569da57c4a81cc84ec2f4a79924df9c8d6 (patch)
tree9ec5b4596b163d275051f7de74736183a6c191c3 /mysql-test/main/temp_table.test
parentb9a5ff364466d2d1495352dd6c932d877923a614 (diff)
downloadmariadb-git-bad2f1569da57c4a81cc84ec2f4a79924df9c8d6.tar.gz
MDEV-17167 - InnoDB: Failing assertion: table->get_ref_count() == 0 uponmariadb-10.3.10
truncating a temporary table TRUNCATE expects only one TABLE instance (which is used by TRUNCATE itself) to be open. However this requirement wasn't enforced after "MDEV-5535: Cannot reopen temporary table". Fixed by closing unused table instances before performing TRUNCATE.
Diffstat (limited to 'mysql-test/main/temp_table.test')
-rw-r--r--mysql-test/main/temp_table.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/main/temp_table.test b/mysql-test/main/temp_table.test
index fb44362b537..a528e27b890 100644
--- a/mysql-test/main/temp_table.test
+++ b/mysql-test/main/temp_table.test
@@ -594,4 +594,30 @@ DROP TABLE nonexisting_table, t1;
--echo # Cleanup
DROP DATABASE temp_db;
+USE test;
+
+--echo #
+--echo # MDEV-17167 - InnoDB: Failing assertion: table->get_ref_count() == 0
+--echo # upon truncating a temporary table
+--echo #
+CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB;
+SELECT * FROM t1 AS t1a1, t1 AS t2a2;
+TRUNCATE TABLE t1;
+
+LOCK TABLES t1 WRITE;
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+UNLOCK TABLES;
+
+LOCK TABLES t1 AS t1a1 WRITE, t1 AS t1a2 WRITE;
+TRUNCATE TABLE t1;
+SELECT * FROM t1 AS t1a1, t1 AS t1a2;
+UNLOCK TABLES;
+
+CREATE TABLE t2(a INT) ENGINE=InnoDB;
+LOCK TABLES t2 WRITE;
+TRUNCATE TABLE t1;
+UNLOCK TABLES;
+
+DROP TABLE t1, t2;