summaryrefslogtreecommitdiff
path: root/mysql-test/t/mysqldump.test
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-03-19 15:02:09 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2020-03-19 15:02:09 +0100
commit5514b48673ceeefc0427834df233e2e8e381f862 (patch)
tree2bd7ae7992f0ca8d364ebc11542fc7f529873673 /mysql-test/t/mysqldump.test
parent5c1ed707a3d03a081fde2b2c960998d797757adf (diff)
downloadmariadb-git-bb-10.1-MDEV-20939.tar.gz
MDEV-20939: Race condition between mysqldump import and InnoDB persistent statistics calculationbb-10.1-MDEV-20939
For mysql.innodb_index_stats and mysql.innodb_table_stats by default backed up only structure. --ignore-table-data parameter added.
Diffstat (limited to 'mysql-test/t/mysqldump.test')
-rw-r--r--mysql-test/t/mysqldump.test60
1 files changed, 60 insertions, 0 deletions
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