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.
20 lines
501 B
Plaintext
20 lines
501 B
Plaintext
drop table if exists s1, t1, t2;
|
|
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;
|
|
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
|
|
1 1 9223372036854775806 1 1 1000 0 0
|
|
select * from t1;
|
|
a
|
|
select * from t2;
|
|
ERROR HY000: Table 't2' was not locked with LOCK TABLES
|
|
unlock tables;
|
|
select * from t1;
|
|
a
|
|
select * from t2;
|
|
a
|
|
drop tables s1, t1, t2;
|