mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-31618: Server crashes in process_i_s_table_temporary_tables/get_all_tables
- Pre-open temporary table on sequence creation. - Without this patch, if rename alter is done on the temporary sequence, and after that `create replace`, since table is not preopened and alter rename marked the table as reopen, and such table is deleted in the `find_temporary_table()` leaving the share without the table, that causes `show tables` to fail - Closes PR #2685 - Reviewer: <serg@mariadb.com>
This commit is contained in:
committed by
Sergei Golubchik
parent
62decb5e8b
commit
82d9d72fb1
@ -231,3 +231,38 @@ def test t1 BASE TABLE MyISAM 10 Fixed 1 7 X X X X NULL X X NULL latin1_swedish_
|
||||
def test t2 TEMPORARY MRG_MyISAM 10 Fixed 0 0 X X X X NULL X X NULL latin1_swedish_ci NULL X Y
|
||||
def test t3 BASE TABLE MRG_MyISAM 10 Fixed 1 5 X X X X NULL X X NULL latin1_swedish_ci NULL X N
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
# MDEV-31618: Server crashes in
|
||||
# process_i_s_table_temporary_tables/get_all_tables
|
||||
#
|
||||
CREATE TEMPORARY SEQUENCE seq1;
|
||||
SHOW FULL TABLES;
|
||||
Tables_in_test Table_type
|
||||
seq1 TEMPORARY SEQUENCE
|
||||
SELECT table_schema, table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_type='temporary sequence';
|
||||
table_schema table_name
|
||||
test seq1
|
||||
mysqltest s2
|
||||
mysqltest s1
|
||||
ALTER TABLE `seq1` CHANGE `cache_size` cache_size int;
|
||||
ERROR HY000: Sequence 'test.seq1' table structure is invalid (cache_size)
|
||||
SHOW FULL TABLES;
|
||||
Tables_in_test Table_type
|
||||
seq1 TEMPORARY SEQUENCE
|
||||
SELECT table_schema, table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_type='temporary sequence';
|
||||
table_schema table_name
|
||||
test seq1
|
||||
mysqltest s2
|
||||
mysqltest s1
|
||||
CREATE OR REPLACE TEMPORARY SEQUENCE seq1;
|
||||
SHOW FULL TABLES;
|
||||
Tables_in_test Table_type
|
||||
seq1 TEMPORARY SEQUENCE
|
||||
SELECT table_schema, table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_type='temporary sequence';
|
||||
table_schema table_name
|
||||
test seq1
|
||||
mysqltest s2
|
||||
mysqltest s1
|
||||
DROP TABLE seq1;
|
||||
DROP TABLE mysqltest.s1;
|
||||
DROP TABLE mysqltest.s2;
|
||||
|
@ -219,3 +219,26 @@ CREATE TABLE t3 (a INT) ENGINE=MERGE UNION=(t1);
|
||||
--replace_column 10 X 11 X 12 X 13 X 15 X 16 X 22 X
|
||||
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test';
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-31618: Server crashes in
|
||||
--echo # process_i_s_table_temporary_tables/get_all_tables
|
||||
--echo #
|
||||
|
||||
CREATE TEMPORARY SEQUENCE seq1;
|
||||
# Check show temp tables before alter
|
||||
SHOW FULL TABLES;
|
||||
SELECT table_schema, table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_type='temporary sequence';
|
||||
--error 4086
|
||||
ALTER TABLE `seq1` CHANGE `cache_size` cache_size int;
|
||||
# Check show temp tables after alter
|
||||
SHOW FULL TABLES;
|
||||
SELECT table_schema, table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_type='temporary sequence';
|
||||
|
||||
CREATE OR REPLACE TEMPORARY SEQUENCE seq1;
|
||||
# Check show temp tables after create/replace alter
|
||||
SHOW FULL TABLES;
|
||||
SELECT table_schema, table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_type='temporary sequence';
|
||||
DROP TABLE seq1;
|
||||
DROP TABLE mysqltest.s1;
|
||||
DROP TABLE mysqltest.s2;
|
||||
|
@ -787,6 +787,7 @@ void init_update_queries(void)
|
||||
Note that SQLCOM_RENAME_TABLE should not be in this list!
|
||||
*/
|
||||
sql_command_flags[SQLCOM_CREATE_TABLE]|= CF_PREOPEN_TMP_TABLES;
|
||||
sql_command_flags[SQLCOM_CREATE_SEQUENCE]|= CF_PREOPEN_TMP_TABLES;
|
||||
sql_command_flags[SQLCOM_CREATE_INDEX]|= CF_PREOPEN_TMP_TABLES;
|
||||
sql_command_flags[SQLCOM_ALTER_TABLE]|= CF_PREOPEN_TMP_TABLES;
|
||||
sql_command_flags[SQLCOM_TRUNCATE]|= CF_PREOPEN_TMP_TABLES;
|
||||
|
@ -5351,7 +5351,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
system_charset_info);
|
||||
schema_table_store_record(thd, table);
|
||||
}
|
||||
else /* SCH_TABLE */
|
||||
else /* SCH_TABLES */
|
||||
process_i_s_table_temporary_tables(thd, table, tmp_tbl);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user