1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Fix main.create_or_replace better

InnoDB background statistics recalculation may acquire
a metadata also on the table itself, not only on the tables
that store the statistics.

Hence, it is better to disable InnoDB persistent statistics altogether.
This fixes up commit 9b8d9a1db3.
This commit is contained in:
Marko Mäkelä
2022-03-28 08:33:52 +03:00
parent f92388fa14
commit a6dbb6b264
2 changed files with 36 additions and 56 deletions

View File

@ -5,6 +5,9 @@
--source include/have_innodb.inc
--source include/have_metadata_lock_info.inc
SET @save_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=OFF;
#
# Create help table
#
@ -212,21 +215,18 @@ create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
--error ER_TABLE_MUST_HAVE_COLUMNS
create or replace table test.t1;
show tables;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
--error ER_TABLE_MUST_HAVE_COLUMNS
create or replace table mysqltest2.t2;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
create table t1 (i int);
drop table t1;
@ -235,21 +235,18 @@ create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
--error ER_DUP_FIELDNAME
create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a';
show tables;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
--error ER_DUP_FIELDNAME
create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a';
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
create table t1 (i int);
drop table t1;
@ -258,8 +255,7 @@ create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
unlock tables;
drop table test.t1,mysqltest2.t2;
@ -268,8 +264,7 @@ create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
unlock tables;
drop table t1;
@ -285,15 +280,13 @@ create table t1 (i int);
lock table t1 write;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_schema!='mysql' or table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
--error ER_DATA_TOO_LONG
create or replace table t1 (a char(1)) engine=Innodb select 'foo' as a;
show tables;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_schema!='mysql' or table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
create table t1 (i int);
drop table t1;
@ -371,24 +364,20 @@ create table t1 (a int);
lock table t1 write, t2 read;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
create or replace table t1 (i int);
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
create or replace table t1 like t2;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
create or replace table t1 select 1 as f1;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
select * from information_schema.metadata_lock_info;
drop table t1;
unlock tables;
@ -520,3 +509,5 @@ UNLOCK TABLES;
DROP TABLE t3;
--echo # End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_persistent;