diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/mysqldump.result | 41 | ||||
-rw-r--r-- | mysql-test/t/mysqldump.test | 60 |
2 files changed, 101 insertions, 0 deletions
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 8d8e3b7eda4..4d3991404b7 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -5628,3 +5628,44 @@ select count(*) from t2; count(*) 2 drop tables t2, t1; +# +# MDEV-20939:Race condition between mysqldump import and InnoDB +# persistent statistics calculation +# +use mysql; +# add smomething to be sure the tables are not empty +insert into mysql.innodb_table_stats +(database_name, table_name, n_rows, clustered_index_size, +sum_of_other_index_sizes) +values ("test","t1", 1, 1, 1); +insert into mysql.innodb_index_stats +(database_name, index_name, table_name, stat_name, stat_value, sample_size) +values ("test", "i1", "t1", "i1", 1, 1); +Warnings: +Warning 1364 Field 'stat_description' doesn't have a default value +# check that all tables we need are not empty +select count(*) >= 1 from mysql.innodb_table_stats; +count(*) >= 1 +1 +select count(*) >= 1 from mysql.innodb_index_stats; +count(*) >= 1 +1 +select count(*) >= 1 from mysql.proc; +count(*) >= 1 +1 +select count(*) >= 1 from mysql.db; +count(*) >= 1 +1 +# for proc we have CREATE and INSERT for all other only CREATE +FOUND /INSERT INTO `proc`/ in MDEV-20939.sql +NOT FOUND /INSERT INTO `innodb_table_stats`/ in MDEV-20939.sql +NOT FOUND /INSERT INTO `innodb_index_stats`/ in MDEV-20939.sql +NOT FOUND /INSERT INTO `db`/ in MDEV-20939.sql +FOUND /CREATE TABLE `innodb_table_stats`/ in MDEV-20939.sql +FOUND /CREATE TABLE `innodb_index_stats`/ in MDEV-20939.sql +FOUND /CREATE TABLE `db`/ in MDEV-20939.sql +FOUND /CREATE TABLE `proc`/ in MDEV-20939.sql +delete from mysql.innodb_table_stats; +delete from mysql.innodb_index_stats; +use test; +# End of 10.1 tests diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 7382bd455c8..22a040144ca 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -2678,3 +2678,63 @@ select count(*) from t2; --remove_file $MYSQLTEST_VARDIR/tmp/t2.txt drop tables t2, t1; + + +--echo # +--echo # MDEV-20939:Race condition between mysqldump import and InnoDB +--echo # persistent statistics calculation +--echo # + +use mysql; + +--echo # add smomething to be sure the tables are not empty + +insert into mysql.innodb_table_stats + (database_name, table_name, n_rows, clustered_index_size, + sum_of_other_index_sizes) + values ("test","t1", 1, 1, 1); + +insert into mysql.innodb_index_stats + (database_name, index_name, table_name, stat_name, stat_value, sample_size) + values ("test", "i1", "t1", "i1", 1, 1); + + +--echo # check that all tables we need are not empty + +select count(*) >= 1 from mysql.innodb_table_stats; +select count(*) >= 1 from mysql.innodb_index_stats; +select count(*) >= 1 from mysql.proc; +select count(*) >= 1 from mysql.db; + + +--exec $MYSQL_DUMP mysql --ignore-table-data=mysql.db >$MYSQLTEST_VARDIR/tmp/MDEV-20939.sql + + +--echo # for proc we have CREATE and INSERT for all other only CREATE + +let SEARCH_RANGE=500000000; +let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/MDEV-20939.sql; +let SEARCH_PATTERN=INSERT INTO `proc`; +source include/search_pattern_in_file.inc; +let SEARCH_PATTERN=INSERT INTO `innodb_table_stats`; +source include/search_pattern_in_file.inc; +let SEARCH_PATTERN=INSERT INTO `innodb_index_stats`; +source include/search_pattern_in_file.inc; +let SEARCH_PATTERN=INSERT INTO `db`; +source include/search_pattern_in_file.inc; +let SEARCH_PATTERN=CREATE TABLE `innodb_table_stats`; +source include/search_pattern_in_file.inc; +let SEARCH_PATTERN=CREATE TABLE `innodb_index_stats`; +source include/search_pattern_in_file.inc; +let SEARCH_PATTERN=CREATE TABLE `db`; +source include/search_pattern_in_file.inc; +let SEARCH_PATTERN=CREATE TABLE `proc`; +source include/search_pattern_in_file.inc; + +--remove_file $MYSQLTEST_VARDIR/tmp/MDEV-20939.sql +delete from mysql.innodb_table_stats; +delete from mysql.innodb_index_stats; +use test; + + +--echo # End of 10.1 tests |