Skip to content

Commit

Permalink
MDEV-29507 InnoDB: Failing assertion: table->n_rec_locks == 0
Browse files Browse the repository at this point in the history
lock_place_prdt_page_lock(): Do not place locks on temporary tables.
Temporary tables can only be accessed from one connection, so
it does not make any sense to acquire any transactional locks on them.
  • Loading branch information
dr-m committed Sep 12, 2022
1 parent 43745b7 commit 667df98
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mysql-test/suite/innodb_gis/r/rtree_temporary.result
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ CREATE TEMPORARY TABLE t1 (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB;
INSERT INTO t1 SELECT POINT(0,0) FROM seq_1_to_366;
INSERT INTO t1 VALUES (POINT(1e-270,1e-130));
DROP TABLE t1;
#
# MDEV-29507 InnoDB: Failing assertion: table->n_rec_locks == 0
#
connect con1,localhost,root,,;
CREATE TEMPORARY TABLE t (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB;
INSERT INTO t SELECT POINTFROMTEXT ('POINT(0 0)') FROM seq_1_to_500;
XA BEGIN 'a';
DELETE FROM t ORDER BY c;
disconnect con1;
# End of 10.3 tests
13 changes: 13 additions & 0 deletions mysql-test/suite/innodb_gis/t/rtree_temporary.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,16 @@ CREATE TEMPORARY TABLE t1 (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB;
INSERT INTO t1 SELECT POINT(0,0) FROM seq_1_to_366;
INSERT INTO t1 VALUES (POINT(1e-270,1e-130));
DROP TABLE t1;

--echo #
--echo # MDEV-29507 InnoDB: Failing assertion: table->n_rec_locks == 0
--echo #

connect con1,localhost,root,,;
CREATE TEMPORARY TABLE t (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB;
INSERT INTO t SELECT POINTFROMTEXT ('POINT(0 0)') FROM seq_1_to_500;
XA BEGIN 'a';
DELETE FROM t ORDER BY c;
disconnect con1;

--echo # End of 10.3 tests
3 changes: 3 additions & 0 deletions storage/innobase/lock/lock0prdt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,9 @@ lock_place_prdt_page_lock(

ut_ad(!dict_index_is_clust(index));
ut_ad(!dict_index_is_online_ddl(index));
if (index->table->is_temporary()) {
return DB_SUCCESS;
}

/* Another transaction cannot have an implicit lock on the record,
because when we come here, we already have modified the clustered
Expand Down

0 comments on commit 667df98

Please sign in to comment.