mirror of
https://github.com/MariaDB/server.git
synced 2025-11-27 05:41:41 +03:00
MDEV-14831 CREATE OR REPLACE SEQUENCE under LOCK TABLE corrupts the sequence, causes ER_KEY_NOT_FOUND The problem was that sequence_insert didn't properly handle the case where there where there was a LOCK TABLE while creating the sequence. Fixed by opening the sequence table, for inserting the first record, in a new environment without any other open tables. Found also a bug in Locked_tables_list::reopen_tables() where the lock structure for the new tables was allocated in THD::mem_root, which causes crashes. This could cause problems with other create tables done under LOCK TABLES.
25 lines
539 B
Plaintext
25 lines
539 B
Plaintext
--source include/have_sequence.inc
|
|
--source include/have_innodb.inc
|
|
|
|
--disable_warnings
|
|
drop table if exists s1, t1, t2;
|
|
--enable_warnings
|
|
|
|
#
|
|
# MDEV-14831 CREATE OR REPLACE SEQUENCE under LOCK TABLE corrupts the
|
|
# sequence, causes ER_KEY_NOT_FOUND
|
|
#
|
|
CREATE SEQUENCE s1;
|
|
create table t1 (a int);
|
|
create table t2 (a int);
|
|
LOCK TABLE s1 WRITE, t1 write;
|
|
create or replace sequence s1;
|
|
select * from s1;
|
|
select * from t1;
|
|
--error ER_TABLE_NOT_LOCKED
|
|
select * from t2;
|
|
unlock tables;
|
|
select * from t1;
|
|
select * from t2;
|
|
drop tables s1, t1, t2;
|