summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-07-25 13:56:39 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-07-25 13:56:39 +0530
commitde85355436e483902e0fff432348bc16f9ec1557 (patch)
tree301d9c0bb381f39b9d0a238b5d66b503fd2d67e2
parent969939e89c29bb3f3d91f8b4ab539601b5daa4d8 (diff)
downloadmariadb-git-de85355436e483902e0fff432348bc16f9ec1557.tar.gz
MDEV-16713 Hangs server with repeating log entry
At most one transaction can be active at a time for temporary tables. There is no need to check previous version of record for the temporary tables.
-rw-r--r--mysql-test/suite/innodb/r/temporary_table.result13
-rw-r--r--mysql-test/suite/innodb/t/temporary_table.test17
-rw-r--r--storage/innobase/row/row0sel.cc7
-rw-r--r--storage/innobase/row/row0vers.cc2
4 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result
index 64eb3270934..628bb648ead 100644
--- a/mysql-test/suite/innodb/r/temporary_table.result
+++ b/mysql-test/suite/innodb/r/temporary_table.result
@@ -650,3 +650,16 @@ SELECT * FROM t1;
f1
0
DROP TABLE t1;
+create procedure t1_proc()
+begin
+DECLARE var INT UNSIGNED;
+CREATE TEMPORARY TABLE t1(f1 INT UNSIGNED, f2 INT UNSIGNED, KEY( f1, f2 ) )engine=innodb;
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+INSERT INTO t1 SET f1 = 1, f2 = 1;
+UPDATE t1 SET f2 = 2;
+SET var = ( SELECT 1 FROM t1 );
+DROP TABLE t1;
+END//
+call t1_proc;
+drop procedure t1_proc;
diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test
index db87367dbb9..6856ca86323 100644
--- a/mysql-test/suite/innodb/t/temporary_table.test
+++ b/mysql-test/suite/innodb/t/temporary_table.test
@@ -476,3 +476,20 @@ UPDATE t1 SET f1 = 0;
ROLLBACK;
SELECT * FROM t1;
DROP TABLE t1;
+
+delimiter //;
+create procedure t1_proc()
+begin
+DECLARE var INT UNSIGNED;
+CREATE TEMPORARY TABLE t1(f1 INT UNSIGNED, f2 INT UNSIGNED, KEY( f1, f2 ) )engine=innodb;
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+INSERT INTO t1 SET f1 = 1, f2 = 1;
+UPDATE t1 SET f2 = 2;
+SET var = ( SELECT 1 FROM t1 );
+DROP TABLE t1;
+END//
+delimiter ;//
+
+call t1_proc;
+drop procedure t1_proc;
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index d21fd4a10ed..5d142c24490 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -5023,6 +5023,13 @@ wrong_offs:
if (!rec_get_deleted_flag(rec, comp)) {
goto no_gap_lock;
}
+
+ /* At most one transaction can be active
+ for temporary table. */
+ if (dict_table_is_temporary(clust_index->table)) {
+ goto no_gap_lock;
+ }
+
if (index == clust_index) {
trx_id_t trx_id = row_get_rec_trx_id(
rec, index, offsets);
diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc
index f58f0a47bd5..24acd04c84b 100644
--- a/storage/innobase/row/row0vers.cc
+++ b/storage/innobase/row/row0vers.cc
@@ -114,6 +114,8 @@ row_vers_impl_x_locked_low(
trx_id = row_get_rec_trx_id(clust_rec, clust_index, clust_offsets);
corrupt = FALSE;
+ ut_ad(!dict_table_is_temporary(clust_index->table));
+
trx_t* trx = trx_rw_is_active(trx_id, &corrupt, true);
if (trx == 0) {