Commit d58437d1 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-20149 innodb.innodb-system-table-view fails with wrong result

The test occasionally fails with different table reference count
due to purge activity after INSERT operations (MDEV-12288).
Wait for purge before accessing dict_table_t::n_ref_count.
parent d4246e25
SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
SELECT table_id INTO @table_stats_id FROM information_schema.innodb_sys_tables
WHERE name = 'mysql/innodb_table_stats';
SELECT table_id INTO @index_stats_id FROM information_schema.innodb_sys_tables
......@@ -108,6 +110,7 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
test/constraint_test parent_id id 0
INSERT INTO parent VALUES(1);
InnoDB 0 transactions not purged
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
......@@ -169,6 +172,7 @@ INSERT INTO parent VALUES(1, 9);
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
id newid
1 9
InnoDB 0 transactions not purged
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
......@@ -176,3 +180,4 @@ name num_rows ref_count
test/parent 1 2
DROP TABLE child;
DROP TABLE parent;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
......@@ -4,6 +4,8 @@
--source include/innodb_page_size_small.inc
SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
LET $MYSQLD_DATADIR = `select @@datadir`;
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
......@@ -70,6 +72,8 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
# INNODB_SYS_TABLESTATS
INSERT INTO parent VALUES(1);
--source include/wait_all_purged.inc
--sorted_result
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
......@@ -126,6 +130,8 @@ INSERT INTO parent VALUES(1, 9);
--sorted_result
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
--source include/wait_all_purged.inc
--sorted_result
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
......@@ -134,3 +140,4 @@ WHERE name LIKE "%parent";
DROP TABLE child;
DROP TABLE parent;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment